/** * Deletes values from the key-value store. * <p> * Requires all Cassandra nodes to be up and available, otherwise throws an PalantirRuntimeException. * * @param tableRef the name of the table to delete values from. * @param keys map containing the keys to delete values for. * * @throws PalantirRuntimeException if not all hosts respond successfully. */ @Override public void delete(TableReference tableRef, Multimap<Cell, Long> keys) { new CellDeleter(clientPool, wrappingQueryRunner, DELETE_CONSISTENCY, mutationTimestampProvider.getDeletionTimestampOperatorForBatchDelete()).delete(tableRef, keys); }
@Test public void supplierBackedProviderQueriesSupplierForDeletionTimestamps() { assertThat(supplierBackedProvider.getDeletionTimestampOperatorForBatchDelete().applyAsLong(1234)).isEqualTo(1); assertThat(supplierBackedProvider.getDeletionTimestampOperatorForBatchDelete().applyAsLong(12345678)) .isEqualTo(2); assertThat(supplierBackedProvider.getDeletionTimestampOperatorForBatchDelete().applyAsLong(314159265358979L)) .isEqualTo(3); }
@Test public void legacyProviderWritesTombstonesAtAtlasTimestampPlusOne() { assertThat(LEGACY_PROVIDER.getDeletionTimestampOperatorForBatchDelete().applyAsLong(1234)).isEqualTo(1234 + 1); assertThat(LEGACY_PROVIDER.getDeletionTimestampOperatorForBatchDelete().applyAsLong(12345678)) .isEqualTo(12345678 + 1); }
@Test public void supplierBackedProviderOnlyInvokesSupplierOncePerDeletionOperator() { LongUnaryOperator deletionTimestamps = supplierBackedProvider.getDeletionTimestampOperatorForBatchDelete(); assertThat(deletionTimestamps.applyAsLong(42)).isEqualTo(1); assertThat(deletionTimestamps.applyAsLong(9999)).isEqualTo(1); assertThat(deletionTimestamps.applyAsLong(1213141516171819L)).isEqualTo(1); }
/** * Deletes values from the key-value store. * <p> * Requires all Cassandra nodes to be up and available, otherwise throws an PalantirRuntimeException. * * @param tableRef the name of the table to delete values from. * @param keys map containing the keys to delete values for. * * @throws PalantirRuntimeException if not all hosts respond successfully. */ @Override public void delete(TableReference tableRef, Multimap<Cell, Long> keys) { new CellDeleter(clientPool, wrappingQueryRunner, DELETE_CONSISTENCY, mutationTimestampProvider.getDeletionTimestampOperatorForBatchDelete()).delete(tableRef, keys); }