use of com.palantir.atlasdb.keyvalue.api.RetryLimitReachedException in project atlasdb by palantir.
the class CassandraKeyValueServiceImpl method deleteRows.
@Override
public void deleteRows(TableReference tableRef, Iterable<byte[]> rows) {
Set<ByteBuffer> actualKeys = StreamSupport.stream(rows.spliterator(), false).map(ByteBuffer::wrap).collect(Collectors.toSet());
if (actualKeys.isEmpty()) {
return;
}
long timestamp = mutationTimestampProvider.getRemoveTimestamp();
Map<ByteBuffer, Map<String, List<Mutation>>> mutationMap = KeyedStream.of(actualKeys).map(row -> new Deletion().setTimestamp(timestamp)).map(deletion -> new Mutation().setDeletion(deletion)).map(mutation -> keyMutationMapByColumnFamily(tableRef, mutation)).collectToMap();
try {
clientPool.runWithRetry(client -> {
client.batch_mutate("deleteRows", mutationMap, DELETE_CONSISTENCY);
return null;
});
} catch (RetryLimitReachedException e) {
throw CassandraUtils.wrapInIceForDeleteOrRethrow(e);
} catch (TException e) {
throw Throwables.unwrapAndThrowAtlasDbDependencyException(e);
}
}
Aggregations