protected void putIntoDefaultColumn(final String row, final String val, final long ts) { put(row, COL, val, ts); }
@Test(timeout = 50000) public void testSweepLatestDeletedMultiRowThorough() { createTable(SweepStrategy.THOROUGH); putIntoDefaultColumn("foo", "", 50); put("foo-2", "other", "womp", 60); Optional<SweepResults> optResults = completeSweep(75); optResults.ifPresent(results -> { assertEquals(1, results.getStaleValuesDeleted()); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(1); }); assertNull(getFromDefaultColumn("foo", 150)); assertEquals(ImmutableSet.of(), getAllTsFromDefaultColumn("foo")); }
@Test(timeout = 50000) public void testSweepLatestDeletedMultiColThorough() { createTable(SweepStrategy.THOROUGH); put("foo", "other column", "other value", 40); putIntoDefaultColumn("foo", "", 50); Optional<SweepResults> optResults = completeSweep(75); optResults.ifPresent(results -> { assertEquals(1, results.getStaleValuesDeleted()); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(1); }); // The default column had its only value deleted assertNull(getFromDefaultColumn("foo", 150)); assertEquals(ImmutableSet.of(), getAllTsFromDefaultColumn("foo")); // The other column was unaffected assertEquals("other value", get("foo", "other column", 150)); assertEquals(ImmutableSet.of(40L), getAllTs("foo", "other column")); }
protected void put(Cell cell, final String val, final long ts) { put(TABLE_NAME, cell, val, ts); }
@Test(timeout = 50000) public void testSweepLatestDeletedMultiRowThorough() { createTable(SweepStrategy.THOROUGH); putIntoDefaultColumn("foo", "", 50); put("foo-2", "other", "womp", 60); Optional<SweepResults> optResults = completeSweep(75); optResults.ifPresent(results -> { assertEquals(1, results.getStaleValuesDeleted()); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(1); }); assertNull(getFromDefaultColumn("foo", 150)); assertEquals(ImmutableSet.of(), getAllTsFromDefaultColumn("foo")); }
@Test(timeout = 50000) public void testSweepLatestDeletedMultiColThorough() { createTable(SweepStrategy.THOROUGH); put("foo", "other column", "other value", 40); putIntoDefaultColumn("foo", "", 50); Optional<SweepResults> optResults = completeSweep(75); optResults.ifPresent(results -> { assertEquals(1, results.getStaleValuesDeleted()); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(1); }); // The default column had its only value deleted assertNull(getFromDefaultColumn("foo", 150)); assertEquals(ImmutableSet.of(), getAllTsFromDefaultColumn("foo")); // The other column was unaffected assertEquals("other value", get("foo", "other column", 150)); assertEquals(ImmutableSet.of(40L), getAllTs("foo", "other column")); }
protected void put(final TableReference tableRef, final String row, final String column, final String val, final long ts) { Cell cell = Cell.create(row.getBytes(StandardCharsets.UTF_8), column.getBytes(StandardCharsets.UTF_8)); put(tableRef, cell, val, ts); }
@Override protected void put(final TableReference tableRef, Cell cell, final String val, final long ts) { super.put(tableRef, cell, val, ts); sweepQueue.enqueue(ImmutableMap.of(tableRef, ImmutableMap.of(cell, PtBytes.toBytes(val))), ts); }
@Test(timeout = 50000) public void testSweepOnMixedCaseTable() { TableReference mixedCaseTable = TableReference.create(Namespace.create("someNamespace"), "someTable"); createTable(mixedCaseTable, SweepStrategy.CONSERVATIVE); put(mixedCaseTable, "row", "col", "val", 10); put(mixedCaseTable, "row", "col", "val", 20); Optional<SweepResults> optResults = completeSweep(mixedCaseTable, 30); optResults.ifPresent(results -> { assertEquals(1, results.getStaleValuesDeleted()); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(2); }); }
protected void putIntoDefaultColumn(final String row, final String val, final long ts) { put(row, COL, val, ts); }
protected void put(Cell cell, final String val, final long ts) { put(TABLE_NAME, cell, val, ts); }
protected void put(final TableReference tableRef, final String row, final String column, final String val, final long ts) { Cell cell = Cell.create(row.getBytes(StandardCharsets.UTF_8), column.getBytes(StandardCharsets.UTF_8)); put(tableRef, cell, val, ts); }
@Override protected void put(final TableReference tableRef, Cell cell, final String val, final long ts) { super.put(tableRef, cell, val, ts); sweepQueue.enqueue(ImmutableMap.of(tableRef, ImmutableMap.of(cell, PtBytes.toBytes(val))), ts); }
@Test(timeout = 50000) public void testSweepOnMixedCaseTable() { TableReference mixedCaseTable = TableReference.create(Namespace.create("someNamespace"), "someTable"); createTable(mixedCaseTable, SweepStrategy.CONSERVATIVE); put(mixedCaseTable, "row", "col", "val", 10); put(mixedCaseTable, "row", "col", "val", 20); Optional<SweepResults> optResults = completeSweep(mixedCaseTable, 30); optResults.ifPresent(results -> { assertEquals(1, results.getStaleValuesDeleted()); assertThat(results.getCellTsPairsExamined()).isGreaterThanOrEqualTo(2); }); }