Package org.cloudera.htrace

Examples of org.cloudera.htrace.Span


    // dump all the index updates into a single WAL. They will get combined in the end anyways, so
    // don't worry which one we get
    WALEdit edit = miniBatchOp.getWalEdit(0);

        // get the current span, or just use a null-span to avoid a bunch of if statements
        Span current = Trace.startSpan("Starting to build index updates").getSpan();
        if (current == null) {
            current = NullSpan.INSTANCE;
        }

    // get the index updates for all elements in this batch
    Collection<Pair<Mutation, byte[]>> indexUpdates =
        this.builder.getIndexUpdate(miniBatchOp, mutations.values());

        current.addTimelineAnnotation("Built index updates, doing preStep");
        TracingCompat.addAnnotation(current, "index update count", indexUpdates.size());

    // write them, either to WAL or the index tables
    doPre(indexUpdates, edit, durability);

        // close the span
        current.stop();
  }
View Full Code Here


     */
    public static Span childOnServer(OperationWithAttributes scan, Configuration conf,
            String description) {
        // check to see if we are currently tracing. Generally, this will only work when we go to
        // 0.96. CPs should always be setting up and tearing down their own tracing
        Span current = Trace.currentSpan();
        if (current == null) {
            // its not tracing yet, but maybe it should be.
            current = enable(scan, conf, description);
        } else {
            current = Trace.startSpan(description, current).getSpan();
View Full Code Here

      // already did the index update in prePut, so we are done
      return;
    }

        // get the current span, or just use a null-span to avoid a bunch of if statements
        Span current = Trace.startSpan("Completing index writes").getSpan();
        if (current == null) {
            current = NullSpan.INSTANCE;
        }

    // there is a little bit of excess here- we iterate all the non-indexed kvs for this check first
    // and then do it again later when getting out the index updates. This should be pretty minor
    // though, compared to the rest of the runtime
    IndexedKeyValue ikv = getFirstIndexedKeyValue(edit);

    /*
     * early exit - we have nothing to write, so we don't need to do anything else. NOTE: we don't
     * release the WAL Rolling lock (INDEX_UPDATE_LOCK) since we never take it in doPre if there are
     * no index updates.
     */
    if (ikv == null) {
            current.stop();
      return;
    }

    /*
     * only write the update if we haven't already seen this batch. We only want to write the batch
     * once (this hook gets called with the same WALEdit for each Put/Delete in a batch, which can
     * lead to writing all the index updates for each Put/Delete).
     */
    if (!ikv.getBatchFinished()) {
      Collection<Pair<Mutation, byte[]>> indexUpdates = extractIndexUpdate(edit);

      // the WAL edit is kept in memory and we already specified the factory when we created the
      // references originally - therefore, we just pass in a null factory here and use the ones
      // already specified on each reference
      try {
                current.addTimelineAnnotation("Actually doing index update for first time");
          writer.writeAndKillYourselfOnFailure(indexUpdates);
      } finally {
        // With a custom kill policy, we may throw instead of kill the server.
        // Without doing this in a finally block (at least with the mini cluster),
        // the region server never goes down.

        // mark the batch as having been written. In the single-update case, this never gets check
        // again, but in the batch case, we will check it again (see above).
        ikv.markBatchFinished();

                // finish the span

                current.stop();
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.cloudera.htrace.Span

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.