Search in sources :

Example 6 with TransactionsTableInteraction

use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction 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);
}
Also used : LightweightOppToken(com.palantir.atlasdb.keyvalue.cassandra.LightweightOppToken) Transactions1TableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction) Map(java.util.Map) TransactionsTableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction) Test(org.junit.Test)

Example 7 with TransactionsTableInteraction

use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.

the class RepairRangeFetcherTest method testRepairOnlyTxn2.

@Test
public void testRepairOnlyTxn2() {
    List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions2TableInteraction(range(1L, 10_000_000L), POLICY));
    Map<String, Map<InetSocketAddress, RangeSet<LightweightOppToken>>> rangesForRepair = repairRangeFetcher.getTransactionTableRangesForRepair(interactions);
    assertThat(rangesForRepair.keySet()).containsExactly(TXN_2);
}
Also used : Transactions2TableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.Transactions2TableInteraction) LightweightOppToken(com.palantir.atlasdb.keyvalue.cassandra.LightweightOppToken) Map(java.util.Map) TransactionsTableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction) Test(org.junit.Test)

Example 8 with TransactionsTableInteraction

use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction 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);
}
Also used : Transactions2TableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.Transactions2TableInteraction) LightweightOppToken(com.palantir.atlasdb.keyvalue.cassandra.LightweightOppToken) Transactions1TableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction) Map(java.util.Map) TransactionsTableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction) Test(org.junit.Test)

Example 9 with TransactionsTableInteraction

use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.

the class RepairRangeFetcherTest method testRepairGivesCorrectTokenRanges.

@Test
public void testRepairGivesCorrectTokenRanges() {
    List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions2TableInteraction(range(1L, 10_000_000L), POLICY));
    Map<String, Map<InetSocketAddress, RangeSet<LightweightOppToken>>> rangesForRepair = repairRangeFetcher.getTransactionTableRangesForRepair(interactions);
    assertThat(rangesForRepair.get(TXN_2).get(BackupTestUtils.HOST_1).asRanges()).containsExactlyInAnyOrder(Range.atMost(BackupTestUtils.TOKEN_1), Range.openClosed(BackupTestUtils.TOKEN_2, OTHER_TOKEN), Range.greaterThan(BackupTestUtils.TOKEN_3));
}
Also used : Transactions2TableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.Transactions2TableInteraction) LightweightOppToken(com.palantir.atlasdb.keyvalue.cassandra.LightweightOppToken) Map(java.util.Map) TransactionsTableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction) Test(org.junit.Test)

Example 10 with TransactionsTableInteraction

use of com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction in project atlasdb by palantir.

the class RepairRangeFetcherTest method testRepairGivesTwoReplicasForRF2.

@Test
public void testRepairGivesTwoReplicasForRF2() {
    when(cqlMetadata.getReplicas(eq(BackupTestUtils.NAMESPACE), any())).thenReturn(ImmutableSet.of(BackupTestUtils.HOST_1, BackupTestUtils.HOST_2));
    List<TransactionsTableInteraction> interactions = ImmutableList.of(new Transactions2TableInteraction(range(1L, 10_000_000L), POLICY));
    Map<String, Map<InetSocketAddress, RangeSet<LightweightOppToken>>> rangesForRepair = repairRangeFetcher.getTransactionTableRangesForRepair(interactions);
    assertThat(rangesForRepair.get(TXN_2).keySet()).containsExactlyInAnyOrder(BackupTestUtils.HOST_1, BackupTestUtils.HOST_2);
}
Also used : Transactions2TableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.Transactions2TableInteraction) LightweightOppToken(com.palantir.atlasdb.keyvalue.cassandra.LightweightOppToken) Map(java.util.Map) TransactionsTableInteraction(com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction) Test(org.junit.Test)

Aggregations

TransactionsTableInteraction (com.palantir.atlasdb.cassandra.backup.transaction.TransactionsTableInteraction)15 Test (org.junit.Test)14 LightweightOppToken (com.palantir.atlasdb.keyvalue.cassandra.LightweightOppToken)13 Map (java.util.Map)13 Transactions2TableInteraction (com.palantir.atlasdb.cassandra.backup.transaction.Transactions2TableInteraction)12 Transactions1TableInteraction (com.palantir.atlasdb.cassandra.backup.transaction.Transactions1TableInteraction)9 Range (com.google.common.collect.Range)6 AtlasService (com.palantir.atlasdb.backup.api.AtlasService)6 Transactions3TableInteraction (com.palantir.atlasdb.cassandra.backup.transaction.Transactions3TableInteraction)6 Cluster (com.datastax.driver.core.Cluster)5 DefaultRetryPolicy (com.datastax.driver.core.policies.DefaultRetryPolicy)5 ImmutableList (com.google.common.collect.ImmutableList)5 ImmutableMap (com.google.common.collect.ImmutableMap)5 ImmutableRangeSet.toImmutableRangeSet (com.google.common.collect.ImmutableRangeSet.toImmutableRangeSet)5 RangeMap (com.google.common.collect.RangeMap)5 RangeSet (com.google.common.collect.RangeSet)5 AtlasDbConstants (com.palantir.atlasdb.AtlasDbConstants)5 KvsRunner (com.palantir.atlasdb.backup.KvsRunner)5 ServiceId (com.palantir.atlasdb.backup.api.ServiceId)5 CassandraKeyValueServiceConfig (com.palantir.atlasdb.cassandra.CassandraKeyValueServiceConfig)5