use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.
the class CassandraRepairEteTest method testRepairBothTxnTables.
@Test
public void testRepairBothTxnTables() {
List<String> tablesRepaired = new ArrayList<>();
BiConsumer<String, RangesForRepair> repairer = (table, _unused) -> tablesRepaired.add(table);
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions1TableInteraction(range(1L, 5L), POLICY), new Transactions2TableInteraction(range(6L, 10L), POLICY));
cassandraRepairHelper.repairTransactionsTables(ATLAS_SERVICE, interactions, repairer);
assertThat(tablesRepaired).containsExactlyInAnyOrder(TransactionConstants.TRANSACTION_TABLE.getTableName(), TransactionConstants.TRANSACTIONS2_TABLE.getTableName());
}
use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.
the class CassandraRepairEteTest method testRepairOnlyTxn2.
@Test
public void testRepairOnlyTxn2() {
List<String> tablesRepaired = new ArrayList<>();
BiConsumer<String, RangesForRepair> repairer = (table, _unused) -> tablesRepaired.add(table);
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions2TableInteraction(range(1L, 10_000_000L), POLICY));
cassandraRepairHelper.repairTransactionsTables(ATLAS_SERVICE, interactions, repairer);
assertThat(tablesRepaired).containsExactly(TransactionConstants.TRANSACTIONS2_TABLE.getTableName());
}
use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.
the class CassandraRepairEteTest method testRepairTxn3.
@Test
public void testRepairTxn3() {
List<String> tablesRepaired = new ArrayList<>();
BiConsumer<String, RangesForRepair> repairer = (table, _unused) -> tablesRepaired.add(table);
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions3TableInteraction(range(1L, 10_000_000L)));
cassandraRepairHelper.repairTransactionsTables(ATLAS_SERVICE, interactions, repairer);
// Transactions3 is backed by Transactions2 under the hood, so this is the table that will be repaired.
assertThat(tablesRepaired).containsExactly(TransactionConstants.TRANSACTIONS2_TABLE.getTableName());
}
use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.
the class CassandraRepairEteTest method testRepairOnlyTxn1.
@Test
public void testRepairOnlyTxn1() {
List<String> tablesRepaired = new ArrayList<>();
BiConsumer<String, RangesForRepair> repairer = (table, _unused) -> tablesRepaired.add(table);
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions1TableInteraction(range(1L, 10_000_000L), POLICY));
cassandraRepairHelper.repairTransactionsTables(ATLAS_SERVICE, interactions, repairer);
assertThat(tablesRepaired).containsExactly(TransactionConstants.TRANSACTION_TABLE.getTableName());
}
use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.
the class CassandraRepairEteTest method testRepairsEachTableOnceOnly.
@Test
public void testRepairsEachTableOnceOnly() {
List<String> tablesRepaired = new ArrayList<>();
AtomicInteger numRepairs = new AtomicInteger(0);
BiConsumer<String, RangesForRepair> repairer = (table, _unused) -> {
numRepairs.incrementAndGet();
tablesRepaired.add(table);
};
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions1TableInteraction(range(1L, 5L), POLICY), new Transactions2TableInteraction(range(6L, 10L), POLICY), new Transactions1TableInteraction(range(11L, 15L), POLICY), new Transactions2TableInteraction(range(16L, 20L), POLICY));
cassandraRepairHelper.repairTransactionsTables(ATLAS_SERVICE, interactions, repairer);
assertThat(tablesRepaired).containsExactlyInAnyOrder(TransactionConstants.TRANSACTION_TABLE.getTableName(), TransactionConstants.TRANSACTIONS2_TABLE.getTableName());
assertThat(numRepairs).hasValue(2);
}
Aggregations