use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SnapshotTransaction method throwIfConflictOnCommit.
/**
* Make sure we have all the rows we are checking already locked before calling this.
*/
protected void throwIfConflictOnCommit(LockToken commitLocksToken, TransactionService transactionService) throws TransactionConflictException {
for (Entry<TableReference, ConcurrentNavigableMap<Cell, byte[]>> write : writesByTable.entrySet()) {
ConflictHandler conflictHandler = getConflictHandlerForTable(write.getKey());
throwIfWriteAlreadyCommitted(write.getKey(), write.getValue(), conflictHandler, commitLocksToken, transactionService);
}
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SerializableTransaction method verifyRows.
private void verifyRows(Transaction ro) {
for (Map.Entry<TableReference, Set<RowRead>> tableAndRowsEntry : rowsRead.entrySet()) {
TableReference table = tableAndRowsEntry.getKey();
Set<RowRead> rows = tableAndRowsEntry.getValue();
ConcurrentNavigableMap<Cell, byte[]> readsForTable = getReadsForTable(table);
Multimap<ColumnSelection, byte[]> rowsReadByColumns = Multimaps.newSortedSetMultimap(Maps.newHashMap(), () -> Sets.newTreeSet(UnsignedBytes.lexicographicalComparator()));
for (RowRead r : rows) {
rowsReadByColumns.putAll(r.cols, r.rows);
}
for (ColumnSelection cols : rowsReadByColumns.keySet()) {
verifyColumns(ro, table, readsForTable, rowsReadByColumns, cols);
}
}
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class SpecificTableSweeper method runOnceAndSaveResults.
void runOnceAndSaveResults(TableToSweep tableToSweep, SweepBatchConfig batchConfig) {
TableReference tableRef = tableToSweep.getTableRef();
byte[] startRow = tableToSweep.getStartRow();
SweepResults results = runOneIteration(tableRef, startRow, batchConfig);
processSweepResults(tableToSweep, results);
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class KeyValueServiceScrubberStoreTest method testMultipleEntryStore.
@Test
public void testMultipleEntryStore() {
Cell cell1 = Cell.create(new byte[] { 1, 2, 3 }, new byte[] { 4, 5, 6 });
Cell cell2 = Cell.create(new byte[] { 7, 8, 9 }, new byte[] { 4, 5, 6 });
Cell cell3 = Cell.create(new byte[] { 1, 2, 3 }, new byte[] { 7, 8, 9 });
TableReference ref1 = TableReference.fromString("foo.bar");
TableReference ref2 = TableReference.fromString("foo.baz");
long timestamp1 = 10;
long timestamp2 = 20;
scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell2, ref1), timestamp1, 1000);
scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell1, ref1, cell3, ref2), timestamp2, 1000);
Assert.assertEquals(ImmutableList.of(ImmutableSortedMap.of(timestamp1, ImmutableMultimap.of(ref1, cell2), timestamp2, ImmutableMultimap.of(ref2, cell3, ref1, cell1))), getScrubQueue());
scrubStore.markCellsAsScrubbed(ImmutableMap.of(ref2, ImmutableMultimap.of(cell3, timestamp2), ref1, ImmutableMultimap.of(cell1, timestamp1, cell1, timestamp2)), 1000);
Assert.assertEquals(ImmutableList.of(ImmutableSortedMap.of(timestamp1, ImmutableMultimap.of(ref1, cell2))), getScrubQueue());
}
use of com.palantir.atlasdb.keyvalue.api.TableReference in project atlasdb by palantir.
the class KeyValueServiceScrubberStoreTest method testSingleEntryStore.
@Test
public void testSingleEntryStore() {
Cell cell = Cell.create(new byte[] { 1, 2, 3 }, new byte[] { 4, 5, 6 });
TableReference ref = TableReference.fromString("foo.bar");
long timestamp = 10;
scrubStore.queueCellsForScrubbing(ImmutableMultimap.of(cell, ref), timestamp, 1000);
Assert.assertEquals(ImmutableList.of(ImmutableSortedMap.of(timestamp, ImmutableMultimap.of(ref, cell))), getScrubQueue());
scrubStore.markCellsAsScrubbed(ImmutableMap.of(ref, ImmutableMultimap.of(cell, timestamp)), 1000);
Assert.assertEquals(ImmutableList.of(), getScrubQueue());
}
Aggregations