use of com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction in project atlasdb by palantir.
the class CoordinationServiceUtilitiesTest method cleanMultipleRangesWithSchemasWithinBounds.
@Test
public void cleanMultipleRangesWithSchemasWithinBounds() {
final long migrateToTxns2 = IMMUTABLE_TIMESTAMP + FASTFORWARD_TIMESTAMP / 2;
Map<Range<Long>, Integer> rangesWithSchemas = ImmutableMap.of(Range.closedOpen(AtlasDbConstants.STARTING_TS, migrateToTxns2), 1, Range.atLeast(migrateToTxns2), 2);
final long coordServiceBound = FASTFORWARD_TIMESTAMP + 1000L;
Optional<InternalSchemaMetadataState> coordService = createCoordService(rangesWithSchemas, coordServiceBound);
List<TransactionsTableInteraction> txnInteractions = TransactionsTableInteraction.getTransactionTableInteractions(CoordinationServiceUtilities.getCoordinationMapOnRestore(coordService, FASTFORWARD_TIMESTAMP, IMMUTABLE_TIMESTAMP), POLICY);
assertThat(txnInteractions).hasSize(2);
TransactionsTableInteraction txn1 = txnInteractions.stream().filter(txn -> txn instanceof Transactions1TableInteraction).findFirst().get();
TransactionsTableInteraction txn2 = txnInteractions.stream().filter(txn -> txn instanceof Transactions2TableInteraction).findFirst().get();
assertThat(txn1).extracting(TransactionsTableInteraction::getTimestampRange).isEqualTo(FullyBoundedTimestampRange.of(Range.closedOpen(IMMUTABLE_TIMESTAMP, migrateToTxns2)));
assertThat(txn2).extracting(TransactionsTableInteraction::getTimestampRange).isEqualTo(FullyBoundedTimestampRange.of(Range.closed(migrateToTxns2, FASTFORWARD_TIMESTAMP)));
}
use of com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction in project atlasdb by palantir.
the class RepairRangeFetcherTest method testRepairBothTxnTables.
@Test
public void testRepairBothTxnTables() {
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions1TableInteraction(range(1L, 5L), POLICY), new Transactions2TableInteraction(range(6L, 10L), POLICY));
Map<String, Map<InetSocketAddress, RangeSet<LightweightOppToken>>> rangesForRepair = repairRangeFetcher.getTransactionTableRangesForRepair(interactions);
assertThat(rangesForRepair.keySet()).containsExactlyInAnyOrder(TXN_1, TXN_2);
}
use of com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction in project atlasdb by palantir.
the class RepairRangeFetcherTest method testRepairOnlyTxn1.
@Test
public void testRepairOnlyTxn1() {
List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions1TableInteraction(range(1L, 10_000_000L), POLICY));
Map<String, Map<InetSocketAddress, RangeSet<LightweightOppToken>>> rangesForRepair = repairRangeFetcher.getTransactionTableRangesForRepair(interactions);
assertThat(rangesForRepair.keySet()).containsExactly(TXN_1);
}
use of com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction in project atlasdb by palantir.
the class RepairRangeFetcherTest method testRepairsEachTableOnceOnly.
@Test
public void testRepairsEachTableOnceOnly() {
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));
Map<String, Map<InetSocketAddress, RangeSet<LightweightOppToken>>> rangesForRepair = repairRangeFetcher.getTransactionTableRangesForRepair(interactions);
assertThat(rangesForRepair.keySet()).containsExactlyInAnyOrder(TXN_1, TXN_2);
}
use of com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction 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());
}
Aggregations