org.apache.tephra.Transaction.getInProgress()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.apache.tephra.Transaction.getInProgress()方法的一些代码示例,展示了Transaction.getInProgress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.getInProgress()方法的具体详情如下:
包路径:org.apache.tephra.Transaction
类名称:Transaction
方法名:getInProgress

Transaction.getInProgress介绍

暂无

代码示例

代码示例来源:origin: org.apache.tephra/tephra-core

@Override
public void startTx(Transaction tx) {
 this.tx = tx;
 if (inProgressChanges == null) {
  inProgressChanges = new TreeSet<>(UnsignedBytes.lexicographicalComparator());
  for (long inProgressTx : tx.getInProgress()) {
   inProgressChanges.add(Bytes.concat(fenceId, Longs.toByteArray(inProgressTx)));
  }
 }
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

public static void write(DataOutput dataOutput, Transaction tx) throws IOException {
 dataOutput.writeLong(tx.getReadPointer());
 dataOutput.writeLong(tx.getWritePointer());
 dataOutput.writeLong(tx.getFirstShortInProgress());
 write(dataOutput, tx.getInProgress());
 write(dataOutput, tx.getInvalids());
}

代码示例来源:origin: org.apache.tephra/tephra-core

/**
 * Returns the maximum transaction that can be removed from the invalid list for the state represented by the given
 * transaction.
 */
public static long getPruneUpperBound(Transaction tx) {
 // If there are no invalid transactions, and no in-progress transactions then we can prune the invalid list
 // up to the current read pointer
 if (tx.getInvalids().length == 0 && tx.getInProgress().length == 0) {
  return tx.getReadPointer() - 1;
 }
 long maxInvalidTx =
  tx.getInvalids().length > 0 ? tx.getInvalids()[tx.getInvalids().length - 1] : Transaction.NO_TX_IN_PROGRESS;
 long firstInProgress = tx.getFirstInProgress();
 return Math.min(maxInvalidTx, firstInProgress - 1);
}

代码示例来源:origin: org.apache.tephra/tephra-core

", readPointer: " + tx.getReadPointer() +
", invalids: " + tx.getInvalids().length +
", inProgress: " + tx.getInProgress().length);

代码示例来源:origin: cdapio/cdap

Predicate<PartitionDetail> predicate) {
List<Long> previousInProgress = partitionConsumerState.getVersionsToCheck();
Set<Long> noLongerInProgress = setDiff(previousInProgress, tx.getInProgress());
for (long txId : tx.getInProgress()) {
 if (txId >= scanUpTo) {
  break;

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

Predicate<PartitionDetail> predicate) {
List<Long> previousInProgress = partitionConsumerState.getVersionsToCheck();
Set<Long> noLongerInProgress = setDiff(previousInProgress, tx.getInProgress());
for (long txId : tx.getInProgress()) {
 if (txId >= scanUpTo) {
  break;

代码示例来源:origin: org.apache.tephra/tephra-api

/**
 * Creates a new transaction for a checkpoint operation, copying all members from the original transaction,
 * with the updated checkpoint write pointers.
 *
 * @param toCopy the original transaction containing the state to copy
 * @param writePointer the new write pointer to use for the transaction
 * @param checkpointPointers the list of write pointers added from checkpoints on the transaction
 */
public Transaction(Transaction toCopy, long writePointer, long[] checkpointPointers) {
 this(toCopy.getReadPointer(), toCopy.getTransactionId(), writePointer, toCopy.getInvalids(),
   toCopy.getInProgress(), toCopy.getFirstShortInProgress(), toCopy.getType(), checkpointPointers,
   toCopy.getVisibilityLevel());
}

代码示例来源:origin: cdapio/cdap

@Override
 public void collect() throws Exception {
  Collection<MetricTimeSeries> collection =
   metricStore.query(new MetricDataQuery(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, METRICS,
                      Constants.Metrics.TRANSACTION_MANAGER_CONTEXT,
                      Collections.<String>emptyList(), null));
  for (MetricTimeSeries metricTimeSeries : collection) {
   if (metricTimeSeries.getMetricName().equals("system.committing.size")) {
    numCommittingChangeSets = (int) aggregateMetricValue(metricTimeSeries);
   }
   if (metricTimeSeries.getMetricName().equals("system.committed.size")) {
    numCommittedChangeSets = (int) aggregateMetricValue(metricTimeSeries);
   }
  }

  Transaction transaction = txClient.startShort();
  readPointer = transaction.getReadPointer();
  writePointer = transaction.getWritePointer();
  numInProgressTx = transaction.getInProgress().length;
  numInvalidTx = transaction.getInvalids().length;
  txClient.abort(transaction);
 }
}

代码示例来源:origin: org.apache.tephra/tephra-core

public static TTransaction wrap(Transaction tx) {
 return new TTransaction(tx.getTransactionId(), tx.getReadPointer(),
             Longs.asList(tx.getInvalids()), Longs.asList(tx.getInProgress()),
             tx.getFirstShortInProgress(), getTTransactionType(tx.getType()),
             tx.getWritePointer(), Longs.asList(tx.getCheckpointWritePointers()),
             getTVisibilityLevel(tx.getVisibilityLevel()));
}

相关文章