本文整理了Java中org.apache.tephra.Transaction.getReadPointer()
方法的一些代码示例,展示了Transaction.getReadPointer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transaction.getReadPointer()
方法的具体详情如下:
包路径:org.apache.tephra.Transaction
类名称:Transaction
方法名:getReadPointer
暂无
代码示例来源:origin: apache/phoenix
@Override
public long getReadPointer() {
Transaction tx = getCurrentTransaction();
if (tx == null) {
return (-1);
}
return tx.getReadPointer();
}
代码示例来源:origin: apache/phoenix
+ getCurrentTransaction().getReadPointer());
代码示例来源:origin: org.apache.phoenix/phoenix-core
@Override
public long getReadPointer() {
Transaction tx = getCurrentTransaction();
if (tx == null) {
return (-1);
}
return tx.getReadPointer();
}
代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core
@Override
public long getReadPointer() {
Transaction tx = getCurrentTransaction();
if (tx == null) {
return (-1);
}
return tx.getReadPointer();
}
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
/**
* Gets the stop row for scan up to the read pointer of a transaction. Stop row is queueName + (readPointer + 1).
*/
public static byte[] getStopRowForTransaction(byte[] queueRowPrefix, Transaction transaction) {
return Bytes.add(queueRowPrefix, Bytes.toBytes(transaction.getReadPointer() + 1));
}
代码示例来源:origin: org.apache.tephra/tephra-api
/**
* Returns whether or not the given version should be visible to the current transaction. A version will be visible
* if it was successfully committed prior to the current transaction starting, or was written by the current
* transaction (using either the current write pointer or the write pointer from a prior checkpoint).
*
* @param version the data version to check for visibility
* @return true if the version is visible, false if it should be hidden (filtered)
*
* @see #setVisibility(VisibilityLevel) to control whether the current write pointer is visible.
*/
public boolean isVisible(long version) {
// either it was committed before or the change belongs to current tx
return (version <= getReadPointer() && !isExcluded(version)) ||
(isCurrentWrite(version) &&
(visibilityLevel != VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT || writePointer != version));
}
代码示例来源: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
} else {
LOG.info("Started tx: " + tx.getTransactionId() +
", readPointer: " + tx.getReadPointer() +
", invalids: " + tx.getInvalids().length +
", inProgress: " + tx.getInProgress().length);
代码示例来源: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: co.cask.cdap/cdap-data-fabric
private void populateRowCache(Set<byte[]> excludeRows, int maxBatchSize, Stopwatch stopwatch) throws IOException {
long readPointer = transaction.getReadPointer();
代码示例来源:origin: cdapio/cdap
if (partitions.size() < limit) {
scanUpTo = Math.min(tx.getWritePointer(), tx.getReadPointer() + 1);
Long endTxId;
try (Scanner scanner = partitionsTable.scanByIndex(WRITE_PTR_COL,
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
if (partitions.size() < limit) {
scanUpTo = Math.min(tx.getWritePointer(), tx.getReadPointer() + 1);
Long endTxId;
try (Scanner scanner = partitionsTable.scanByIndex(WRITE_PTR_COL,
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
if (tx.getReadPointer() < key.txId) {
代码示例来源:origin: org.apache.phoenix/phoenix-core
@Override
public void commitDDLFence(PTable dataTable)
throws SQLException {
byte[] key = dataTable.getName().getBytes();
try {
FenceWait fenceWait = VisibilityFence.prepareWait(key,
txServiceClient);
fenceWait.await(10000, TimeUnit.MILLISECONDS);
if (logger.isInfoEnabled()) {
logger.info("Added write fence at ~"
+ getCurrentTransaction().getReadPointer());
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new SQLExceptionInfo.Builder(
SQLExceptionCode.INTERRUPTED_EXCEPTION).setRootCause(e)
.build().buildException();
} catch (TimeoutException | TransactionFailureException e) {
throw new SQLExceptionInfo.Builder(
SQLExceptionCode.TX_UNABLE_TO_GET_WRITE_FENCE)
.setSchemaName(dataTable.getSchemaName().getString())
.setTableName(dataTable.getTableName().getString()).build()
.buildException();
}
}
代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core
+ getCurrentTransaction().getReadPointer());
代码示例来源: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()));
}
内容来源于网络,如有侵权,请联系作者删除!