@Override public long getWritePointer() { Transaction tx = getCurrentTransaction(); return tx == null ? HConstants.LATEST_TIMESTAMP : tx.getWritePointer(); }
/** * Returns the maximum timestamp to use for time-range operations, based on the given transaction. * @param tx The current transaction * @return The maximum timestamp (exclusive) to use for time-range operations */ public static long getMaxVisibleTimestamp(Transaction tx) { // NOTE: +1 here because we want read up to writepointer inclusive, but timerange's end is exclusive // however, we also need to guard against overflow in the case write pointer is set to MAX_VALUE return tx.getWritePointer() < Long.MAX_VALUE ? tx.getWritePointer() + 1 : tx.getWritePointer(); }
/** * Block until the transaction used by this context is completed (either commit or invalidate). * * @throws InterruptedException if current thread is interrupted while waiting */ private void awaitCompletion() throws InterruptedException { LOG.debug("Awaiting completion for {}", transaction.getWritePointer()); if (completion != null) { completion.await(); } discardDatasets(); }
/** * Block until the transaction used by this context is completed (either commit or invalidate). * * @throws InterruptedException if current thread is interrupted while waiting */ private void awaitCompletion() throws InterruptedException { LOG.debug("Awaiting completion for {}", transaction.getWritePointer()); if (completion != null) { completion.await(); } discardDatasets(); }
/** * Block until the transaction used by this context is completed (either commit or invalidate). * * @throws InterruptedException if current thread is interrupted while waiting */ private void awaitCompletion() throws InterruptedException { LOG.debug("Awaiting completion for {}", transaction.getWritePointer()); if (completion != null) { completion.await(); } discardDatasets(); }
@Override public long getWritePointer() { Transaction tx = getCurrentTransaction(); return tx == null ? HConstants.LATEST_TIMESTAMP : tx.getWritePointer(); }
@Override public long getWritePointer() { Transaction tx = getCurrentTransaction(); return tx == null ? HConstants.LATEST_TIMESTAMP : tx.getWritePointer(); }
@Override public void set(TransactionalDatasetContext value) { String txKey = Long.toString(value.getTransaction().getWritePointer()); if (SparkRuntimeEnv.setLocalProperty(ACTIVE_TRANSACTION_KEY, txKey)) { transactionInfos.put(txKey, value); } super.set(value); }
@Override public void set(TransactionalDatasetContext value) { String txKey = Long.toString(value.getTransaction().getWritePointer()); if (SparkRuntimeEnv.setLocalProperty(ACTIVE_TRANSACTION_KEY, txKey)) { transactionInfos.put(txKey, value); } super.set(value); }
@Override public void set(TransactionalDatasetContext value) { String txKey = Long.toString(value.getTransaction().getWritePointer()); if (SparkRuntimeEnv.setLocalProperty(ACTIVE_TRANSACTION_KEY, txKey)) { transactionInfos.put(txKey, value); } super.set(value); }
@Override public void onTransactionCompleted(boolean jobSucceeded, @Nullable TransactionFailureException failureCause) { // Shouldn't happen Preconditions.checkState(commitOnJobEnded(), "Not expecting transaction to be completed"); transactionInfos.remove(Long.toString(transaction.getWritePointer())); if (jobSucceeded && failureCause == null) { postCommit(); } else { rollbackWithoutFailure(); } completion.countDown(); }
@Override public void onTransactionCompleted(boolean jobSucceeded, @Nullable TransactionFailureException failureCause) { // Shouldn't happen Preconditions.checkState(commitOnJobEnded(), "Not expecting transaction to be completed"); transactionInfos.remove(Long.toString(transaction.getWritePointer())); if (jobSucceeded && failureCause == null) { postCommit(); } else { rollbackWithoutFailure(); } completion.countDown(); }
@Override public void onTransactionCompleted(boolean jobSucceeded, @Nullable TransactionFailureException failureCause) { // Shouldn't happen Preconditions.checkState(commitOnJobEnded(), "Not expecting transaction to be completed"); transactionInfos.remove(Long.toString(transaction.getWritePointer())); if (jobSucceeded && failureCause == null) { postCommit(); } else { rollbackWithoutFailure(); } completion.countDown(); }
@Override public Void execute(TransactionServiceThriftClient client) throws Exception { client.commit(tx.getTransactionId(), tx.getWritePointer()); return null; } });
@Override protected void doRollback() { if (commitTransaction != null) { InMemoryQueue queue = getQueue(); for (int seqId = 0; seqId < lastEnqueueCount; seqId++) { queue.undoEnqueue(commitTransaction.getWritePointer(), seqId); } } } }
@WriteOnly private void undoPersisted(NavigableMap<byte[], NavigableMap<byte[], Update>> persisted) { // NOTE: we could just use merge and pass the changes with all values = null, but separate method is more efficient InMemoryTableService.undo(getTableName(), persisted, tx.getWritePointer()); }
@WriteOnly private void undoPersisted(NavigableMap<byte[], NavigableMap<byte[], Update>> persisted) { // NOTE: we could just use merge and pass the changes with all values = null, but separate method is more efficient InMemoryTableService.undo(getTableName(), persisted, tx.getWritePointer()); }
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()); }
private byte[] encodeStateColumn(ConsumerEntryState state) { // State column content is encoded as (writePointer) + (instanceId) + (state) byte[] stateContent = new byte[Longs.BYTES + Ints.BYTES + 1]; Bytes.putLong(stateContent, 0, transaction.getWritePointer()); Bytes.putInt(stateContent, Longs.BYTES, getConfig().getInstanceId()); Bytes.putByte(stateContent, Longs.BYTES + Ints.BYTES, state.getState()); return stateContent; }
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())); }