Search in sources :

Example 1 with TraceScope

use of org.apache.htrace.TraceScope in project hbase by apache.

the class AbstractFSWAL method stampSequenceIdAndPublishToRingBuffer.

protected long stampSequenceIdAndPublishToRingBuffer(HRegionInfo hri, WALKey key, WALEdit edits, boolean inMemstore, RingBuffer<RingBufferTruck> ringBuffer) throws IOException {
    if (this.closed) {
        throw new IOException("Cannot append; log is closed, regionName = " + hri.getRegionNameAsString());
    }
    TraceScope scope = Trace.startSpan(implClassName + ".append");
    MutableLong txidHolder = new MutableLong();
    MultiVersionConcurrencyControl.WriteEntry we = key.getMvcc().begin(() -> {
        txidHolder.setValue(ringBuffer.next());
    });
    long txid = txidHolder.longValue();
    try {
        FSWALEntry entry = new FSWALEntry(txid, key, edits, hri, inMemstore);
        entry.stampRegionSequenceId(we);
        ringBuffer.get(txid).load(entry, scope.detach());
    } finally {
        ringBuffer.publish(txid);
    }
    return txid;
}
Also used : MutableLong(org.apache.commons.lang.mutable.MutableLong) MultiVersionConcurrencyControl(org.apache.hadoop.hbase.regionserver.MultiVersionConcurrencyControl) TraceScope(org.apache.htrace.TraceScope) InterruptedIOException(java.io.InterruptedIOException) TimeoutIOException(org.apache.hadoop.hbase.exceptions.TimeoutIOException) IOException(java.io.IOException)

Example 2 with TraceScope

use of org.apache.htrace.TraceScope in project hbase by apache.

the class AsyncFSWAL method sync.

@Override
public void sync(long txid) throws IOException {
    if (highestSyncedTxid.get() >= txid) {
        return;
    }
    TraceScope scope = Trace.startSpan("AsyncFSWAL.sync");
    try {
        // here we do not use ring buffer sequence as txid
        long sequence = waitingConsumePayloads.next();
        SyncFuture future;
        try {
            future = getSyncFuture(txid, scope.detach());
            RingBufferTruck truck = waitingConsumePayloads.get(sequence);
            truck.load(future);
        } finally {
            waitingConsumePayloads.publish(sequence);
        }
        if (shouldScheduleConsumer()) {
            eventLoop.execute(consumer);
        }
        scope = Trace.continueSpan(blockOnSync(future));
    } finally {
        assert scope == NullScope.INSTANCE || !scope.isDetached();
        scope.close();
    }
}
Also used : TraceScope(org.apache.htrace.TraceScope)

Example 3 with TraceScope

use of org.apache.htrace.TraceScope in project hbase by apache.

the class AsyncFSWAL method addTimeAnnotation.

private void addTimeAnnotation(SyncFuture future, String annotation) {
    TraceScope scope = Trace.continueSpan(future.getSpan());
    Trace.addTimelineAnnotation(annotation);
    future.setSpan(scope.detach());
}
Also used : TraceScope(org.apache.htrace.TraceScope)

Example 4 with TraceScope

use of org.apache.htrace.TraceScope in project hbase by apache.

the class AsyncFSWAL method sync.

@Override
public void sync() throws IOException {
    TraceScope scope = Trace.startSpan("AsyncFSWAL.sync");
    try {
        long txid = waitingConsumePayloads.next();
        SyncFuture future;
        try {
            future = getSyncFuture(txid, scope.detach());
            RingBufferTruck truck = waitingConsumePayloads.get(txid);
            truck.load(future);
        } finally {
            waitingConsumePayloads.publish(txid);
        }
        if (shouldScheduleConsumer()) {
            eventLoop.execute(consumer);
        }
        scope = Trace.continueSpan(blockOnSync(future));
    } finally {
        assert scope == NullScope.INSTANCE || !scope.isDetached();
        scope.close();
    }
}
Also used : TraceScope(org.apache.htrace.TraceScope)

Example 5 with TraceScope

use of org.apache.htrace.TraceScope in project hbase by apache.

the class RecoverableZooKeeper method getAcl.

/**
   * getAcl is an idempotent operation. Retry before throwing exception
   * @return list of ACLs
   */
public List<ACL> getAcl(String path, Stat stat) throws KeeperException, InterruptedException {
    TraceScope traceScope = null;
    try {
        traceScope = Trace.startSpan("RecoverableZookeeper.getAcl");
        RetryCounter retryCounter = retryCounterFactory.create();
        while (true) {
            try {
                return checkZk().getACL(path, stat);
            } catch (KeeperException e) {
                switch(e.code()) {
                    case CONNECTIONLOSS:
                    case OPERATIONTIMEOUT:
                        retryOrThrow(retryCounter, e, "getAcl");
                        break;
                    default:
                        throw e;
                }
            }
            retryCounter.sleepUntilNextRetry();
        }
    } finally {
        if (traceScope != null)
            traceScope.close();
    }
}
Also used : RetryCounter(org.apache.hadoop.hbase.util.RetryCounter) TraceScope(org.apache.htrace.TraceScope) KeeperException(org.apache.zookeeper.KeeperException)

Aggregations

TraceScope (org.apache.htrace.TraceScope)31 RetryCounter (org.apache.hadoop.hbase.util.RetryCounter)8 KeeperException (org.apache.zookeeper.KeeperException)8 Span (org.apache.htrace.Span)6 IOException (java.io.IOException)5 Pair (org.apache.hadoop.hbase.util.Pair)4 InterruptedIOException (java.io.InterruptedIOException)3 ArrayList (java.util.ArrayList)3 Mutation (org.apache.hadoop.hbase.client.Mutation)3 TimeoutIOException (org.apache.hadoop.hbase.exceptions.TimeoutIOException)3 ResultIterator (org.apache.phoenix.iterate.ResultIterator)3 PhoenixConnection (org.apache.phoenix.jdbc.PhoenixConnection)3 ParseNodeFactory (org.apache.phoenix.parse.ParseNodeFactory)3 NullSpan (org.apache.phoenix.trace.util.NullSpan)3 List (java.util.List)2 Cell (org.apache.hadoop.hbase.Cell)2 HTableInterface (org.apache.hadoop.hbase.client.HTableInterface)2 ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)2 TimeRange (org.apache.hadoop.hbase.io.TimeRange)2 ImmutableBytesPtr (org.apache.phoenix.hbase.index.util.ImmutableBytesPtr)2