Search in sources :

Example 1 with SweepResults

use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.

the class AbstractSweepTaskRunnerTest method testSweepManyLatestDeletedThoroughIncludingUncommitted2.

@Test(timeout = 50000)
public void testSweepManyLatestDeletedThoroughIncludingUncommitted2() {
    createTable(SweepStrategy.THOROUGH);
    putIntoDefaultColumn("foo", "bar", 50);
    putUncommitted("foo", "bad", 75);
    putIntoDefaultColumn("foo", "baz", 100);
    putIntoDefaultColumn("foo", "foo", 125);
    putUncommitted("foo", "", 150);
    SweepResults results = completeSweep(175).get();
    assertEquals(4, results.getStaleValuesDeleted());
    assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(5);
    assertEquals("foo", getFromDefaultColumn("foo", 200));
    assertEquals(ImmutableSet.of(125L), getAllTsFromDefaultColumn("foo"));
}
Also used : SweepResults(com.palantir.atlasdb.keyvalue.api.SweepResults) ImmutableSweepResults(com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults) Test(org.junit.Test)

Example 2 with SweepResults

use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.

the class AbstractSweepTaskRunnerTest method testSweepManyValuesIncludingUncommittedConservative.

@Test(timeout = 50000)
public void testSweepManyValuesIncludingUncommittedConservative() {
    createTable(SweepStrategy.CONSERVATIVE);
    putIntoDefaultColumn("foo", "bar", 50);
    putUncommitted("foo", "bad", 75);
    putIntoDefaultColumn("foo", "baz", 100);
    putIntoDefaultColumn("foo", "buzz", 125);
    putUncommitted("foo", "foo", 150);
    SweepResults results = completeSweep(175).get();
    assertEquals(4, results.getStaleValuesDeleted());
    assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(5);
    assertEquals("buzz", getFromDefaultColumn("foo", 200));
    assertEquals("", getFromDefaultColumn("foo", 124));
    assertEquals(ImmutableSet.of(-1L, 125L), getAllTsFromDefaultColumn("foo"));
}
Also used : SweepResults(com.palantir.atlasdb.keyvalue.api.SweepResults) ImmutableSweepResults(com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults) Test(org.junit.Test)

Example 3 with SweepResults

use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.

the class AbstractSweepTaskRunnerTest method testSweeperFailsHalfwayThroughOnDeleteTable.

@Test(timeout = 50000)
public void testSweeperFailsHalfwayThroughOnDeleteTable() {
    createTable(SweepStrategy.CONSERVATIVE);
    putIntoDefaultColumn("foo", "bar", 50);
    putIntoDefaultColumn("foo2", "bang", 75);
    putIntoDefaultColumn("foo3", "baz", 100);
    putIntoDefaultColumn("foo4", "buzz", 125);
    byte[] nextStartRow = partialSweep(150).getNextStartRow().get();
    kvs.dropTable(TABLE_NAME);
    SweepResults results = sweepRunner.run(TABLE_NAME, ImmutableSweepBatchConfig.builder().deleteBatchSize(DEFAULT_BATCH_SIZE).candidateBatchSize(DEFAULT_BATCH_SIZE).maxCellTsPairsToExamine(DEFAULT_BATCH_SIZE).build(), nextStartRow);
    assertEquals(SweepResults.createEmptySweepResult(Optional.empty()), results);
}
Also used : SweepResults(com.palantir.atlasdb.keyvalue.api.SweepResults) ImmutableSweepResults(com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults) Test(org.junit.Test)

Example 4 with SweepResults

use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.

the class AbstractSweepTaskRunnerTest method testSweepUncommittedThorough.

@Test(timeout = 50000)
public void testSweepUncommittedThorough() {
    createTable(SweepStrategy.THOROUGH);
    putIntoDefaultColumn("foo", "bar", 50);
    putUncommitted("foo", "baz", 100);
    SweepResults results = completeSweep(175).get();
    assertEquals(1, results.getStaleValuesDeleted());
    assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(2);
    assertEquals("bar", getFromDefaultColumn("foo", 750));
    assertEquals(ImmutableSet.of(50L), getAllTsFromDefaultColumn("foo"));
}
Also used : SweepResults(com.palantir.atlasdb.keyvalue.api.SweepResults) ImmutableSweepResults(com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults) Test(org.junit.Test)

Example 5 with SweepResults

use of com.palantir.atlasdb.keyvalue.api.SweepResults in project atlasdb by palantir.

the class AbstractSweepTaskRunnerTest method testSweepStrategyNothing.

@Test(timeout = 50000)
public void testSweepStrategyNothing() {
    createTable(SweepStrategy.NOTHING);
    putIntoDefaultColumn("foo", "bar", 50);
    putUncommitted("foo", "bad", 75);
    putIntoDefaultColumn("foo", "baz", 100);
    putIntoDefaultColumn("foo", "buzz", 125);
    putUncommitted("foo", "foo", 150);
    SweepResults results = sweepRunner.run(TABLE_NAME, ImmutableSweepBatchConfig.builder().deleteBatchSize(DEFAULT_BATCH_SIZE).candidateBatchSize(DEFAULT_BATCH_SIZE).maxCellTsPairsToExamine(DEFAULT_BATCH_SIZE).build(), PtBytes.EMPTY_BYTE_ARRAY);
    assertEquals(SweepResults.createEmptySweepResult(Optional.empty()), results);
    assertEquals(ImmutableSet.of(50L, 75L, 100L, 125L, 150L), getAllTsFromDefaultColumn("foo"));
}
Also used : SweepResults(com.palantir.atlasdb.keyvalue.api.SweepResults) ImmutableSweepResults(com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults) Test(org.junit.Test)

Aggregations

SweepResults (com.palantir.atlasdb.keyvalue.api.SweepResults)27 Test (org.junit.Test)16 ImmutableSweepResults (com.palantir.atlasdb.keyvalue.api.ImmutableSweepResults)15 Cell (com.palantir.atlasdb.keyvalue.api.Cell)4 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)4 List (java.util.List)4 ImmutableList (com.google.common.collect.ImmutableList)3 ImmutableSweepBatchConfig (com.palantir.atlasdb.sweep.ImmutableSweepBatchConfig)3 SweepBatchConfig (com.palantir.atlasdb.sweep.SweepBatchConfig)3 SweepTaskRunner (com.palantir.atlasdb.sweep.SweepTaskRunner)3 ArrayList (java.util.ArrayList)3 Stopwatch (com.google.common.base.Stopwatch)2 AtlasDbConstants (com.palantir.atlasdb.AtlasDbConstants)2 PtBytes (com.palantir.atlasdb.encoding.PtBytes)2 LoggingArgs (com.palantir.atlasdb.logging.LoggingArgs)2 AbstractSweepTaskRunnerTest (com.palantir.atlasdb.sweep.AbstractSweepTaskRunnerTest)2 UnsafeArg (com.palantir.logsafe.UnsafeArg)2 Arrays (java.util.Arrays)2 Optional (java.util.Optional)2 TimeUnit (java.util.concurrent.TimeUnit)2