use of com.palantir.atlasdb.keyvalue.jdbc.impl.JdbcConstants.TIMESTAMP in project atlasdb by palantir.
the class JdbcKeyValueService method addGarbageCollectionSentinelValues.
@Override
public void addGarbageCollectionSentinelValues(final TableReference tableRef, Iterable<Cell> cells) {
int numCells = Iterables.size(cells);
if (numCells == 0) {
return;
}
for (List<Cell> partCells : Iterables.partition(cells, batchSizeForMutations)) {
Long timestamp = Value.INVALID_VALUE_TIMESTAMP;
byte[] value = new byte[0];
final RowN[] rows = new RowN[numCells];
int i = 0;
for (Cell cell : partCells) {
rows[i++] = row(new Object[] { cell.getRowName(), cell.getColumnName(), timestamp, value });
}
run((Function<DSLContext, Void>) ctx -> {
ctx.insertInto(table(tableName(tableRef)), field(ROW_NAME, byte[].class), field(COL_NAME, byte[].class), field(TIMESTAMP, Long.class), field(VALUE, byte[].class)).select(ctx.select(T1_ROW_NAME, T1_COL_NAME, T1_TIMESTAMP, T1_VALUE).from(values(ctx, rows, TEMP_TABLE_1, ROW_NAME, COL_NAME, TIMESTAMP, VALUE)).whereNotExists(ctx.selectOne().from(atlasTable(tableRef).as(ATLAS_TABLE)).where(A_ROW_NAME.eq(T1_ROW_NAME).and(A_COL_NAME.eq(T1_COL_NAME)).and(A_TIMESTAMP.eq(T1_TIMESTAMP))))).execute();
return null;
});
}
}
Aggregations