public void putInternal(TableReference tableRef, Map<Cell, byte[]> values) { Preconditions.checkArgument(!AtlasDbConstants.HIDDEN_TABLES.contains(tableRef)); markTableAsInvolvedInThisTransaction(tableRef); if (values.isEmpty()) { return; } numWriters.incrementAndGet(); try { // We need to check the status after incrementing writers to ensure that we fail if we are committing. ensureUncommitted(); ConcurrentNavigableMap<Cell, byte[]> writes = getLocalWrites(tableRef); putWritesAndLogIfTooLarge(values, writes); } finally { numWriters.decrementAndGet(); } }
@Override public void abort() { if (state.get() == State.ABORTED) { return; } while (true) { ensureUncommitted(); if (state.compareAndSet(State.UNCOMMITTED, State.ABORTED)) { if (hasWrites()) { throwIfPreCommitRequirementsNotMet(null, getStartTimestamp()); } transactionOutcomeMetrics.markAbort(); return; } } }
private <T> SortedMap<Cell, T> postFilterRows(TableReference tableRef, List<RowResult<Value>> rangeRows, Function<Value, T> transformer) { ensureUncommitted(); if (rangeRows.isEmpty()) { return ImmutableSortedMap.of(); } Map<Cell, Value> rawResults = Maps.newHashMapWithExpectedSize(estimateSize(rangeRows)); for (RowResult<Value> rowResult : rangeRows) { for (Map.Entry<byte[], Value> e : rowResult.getColumns().entrySet()) { rawResults.put(Cell.create(rowResult.getRowName(), e.getKey()), e.getValue()); } } ImmutableSortedMap.Builder<Cell, T> postFilter = ImmutableSortedMap.naturalOrder(); getWithPostFiltering(tableRef, rawResults, postFilter, transformer); return postFilter.build(); }
ensureUncommitted(); if (state.compareAndSet(State.UNCOMMITTED, State.COMMITTING)) { break;
public void putInternal(TableReference tableRef, Map<Cell, byte[]> values) { Preconditions.checkArgument(!AtlasDbConstants.HIDDEN_TABLES.contains(tableRef)); markTableAsInvolvedInThisTransaction(tableRef); if (values.isEmpty()) { return; } numWriters.incrementAndGet(); try { // We need to check the status after incrementing writers to ensure that we fail if we are committing. ensureUncommitted(); ConcurrentNavigableMap<Cell, byte[]> writes = getLocalWrites(tableRef); putWritesAndLogIfTooLarge(values, writes); } finally { numWriters.decrementAndGet(); } }
@Override public void abort() { if (state.get() == State.ABORTED) { return; } while (true) { ensureUncommitted(); if (state.compareAndSet(State.UNCOMMITTED, State.ABORTED)) { if (hasWrites()) { throwIfPreCommitRequirementsNotMet(null, getStartTimestamp()); } transactionOutcomeMetrics.markAbort(); return; } } }
private <T> SortedMap<Cell, T> postFilterRows(TableReference tableRef, List<RowResult<Value>> rangeRows, Function<Value, T> transformer) { ensureUncommitted(); if (rangeRows.isEmpty()) { return ImmutableSortedMap.of(); } Map<Cell, Value> rawResults = Maps.newHashMapWithExpectedSize(estimateSize(rangeRows)); for (RowResult<Value> rowResult : rangeRows) { for (Map.Entry<byte[], Value> e : rowResult.getColumns().entrySet()) { rawResults.put(Cell.create(rowResult.getRowName(), e.getKey()), e.getValue()); } } ImmutableSortedMap.Builder<Cell, T> postFilter = ImmutableSortedMap.naturalOrder(); getWithPostFiltering(tableRef, rawResults, postFilter, transformer); return postFilter.build(); }
ensureUncommitted(); if (state.compareAndSet(State.UNCOMMITTED, State.COMMITTING)) { break;