コード例 #1
0
 @Override
 public WriteStats call() throws Exception {
   statusReporter.numExecutingFlushes.incrementAndGet();
   reportSize();
   long start = System.currentTimeMillis();
   try {
     Timer totalTimer = metricFactory.newTimer();
     totalTimer.startTiming();
     if (LOG.isDebugEnabled())
       SpliceLogUtils.debug(
           LOG,
           "Calling BulkWriteAction: id=%d, initialBulkWritesSize=%d, initialKVPairSize=%d",
           id,
           bulkWrites.numEntries(),
           bulkWrites.numEntries());
     execute(bulkWrites);
     totalTimer.stopTiming();
     if (metricFactory.isActive())
       return new SimpleWriteStats(
           writtenCounter.getTotal(),
           retryCounter.getTotal(),
           thrownErrorsRows.getTotal(),
           retriedRows.getTotal(),
           partialRows.getTotal(),
           partialThrownErrorRows.getTotal(),
           partialRetriedRows.getTotal(),
           partialIgnoredRows.getTotal(),
           partialWrite.getTotal(),
           ignoredRows.getTotal(),
           catchThrownRows.getTotal(),
           catchRetriedRows.getTotal(),
           regionTooBusy.getTotal());
     else return WriteStats.NOOP_WRITE_STATS;
   } finally {
     long timeTakenMs = System.currentTimeMillis() - start;
     long numRecords = bulkWrites.numEntries();
     writeConfiguration.writeComplete(timeTakenMs, numRecords);
     statusReporter.complete(timeTakenMs);
     bulkWrites = null;
   }
 }
コード例 #2
0
 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "Intentional")
 public BulkWriteAction(
     byte[] tableName,
     BulkWrites writes,
     WriteConfiguration writeConfiguration,
     ActionStatusReporter statusReporter,
     BulkWriterFactory writerFactory,
     PipelineExceptionFactory pipelineExceptionFactory,
     PartitionFactory partitionFactory,
     Clock clock) {
   assert writes != null : "writes passed into BWA are null";
   this.tableName = tableName;
   this.bulkWrites = writes;
   this.writeConfiguration = writeConfiguration;
   this.statusReporter = statusReporter;
   this.writerFactory = writerFactory;
   MetricFactory possibleMetricFactory = writeConfiguration.getMetricFactory();
   this.metricFactory =
       possibleMetricFactory == null ? Metrics.noOpMetricFactory() : possibleMetricFactory;
   this.clock = clock;
   this.rejectedCounter = metricFactory.newCounter();
   this.globalErrorCounter = metricFactory.newCounter();
   this.partialFailureCounter = metricFactory.newCounter();
   this.writtenCounter = metricFactory.newCounter();
   this.retryCounter = metricFactory.newCounter();
   this.writeTimer = metricFactory.newTimer();
   this.pipelineExceptionFactory = pipelineExceptionFactory;
   this.partitionFactory = partitionFactory;
   thrownErrorsRows = metricFactory.newCounter();
   retriedRows = metricFactory.newCounter();
   partialRows = metricFactory.newCounter();
   partialThrownErrorRows = metricFactory.newCounter();
   partialRetriedRows = metricFactory.newCounter();
   partialIgnoredRows = metricFactory.newCounter();
   partialWrite = metricFactory.newCounter();
   ignoredRows = metricFactory.newCounter();
   catchThrownRows = metricFactory.newCounter();
   catchRetriedRows = metricFactory.newCounter();
   regionTooBusy = metricFactory.newCounter();
 }