// delete some rows
random = new Random(10121986L); // pseudo random order of row insertions
for (long i = 0; i < numRows; i++) {
byte[] rowId = Bytes.toBytes(random.nextLong() + "." + i);
if (i % 10 == 7) {
Delete delete = new Delete(rowId, timestamp, null);
region.delete(delete, null, true);
}
}
checkIndexedScanWithDeletedRows(family, false, 7L, 0);
checkIndexedScanWithDeletedRows(family, false, 6L, 8L, 2 * numRows / 5);
/**
* Flush and verify
*/
region.flushcache();
checkIndexedScanWithDeletedRows(family, true, 7L, 0);
checkIndexedScanWithDeletedRows(family, true, 6L, 8L, 2 * numRows / 5);
/**
* New check - now the index should find the 4's and the memstore
* should only contains deleted rows - override the index's findings
*/
checkIndexedScanWithDeletedRows(family, true, 4L, numRows / 5);
checkIndexedScanWithDeletedRows(family, true, 3L, 8L, numRows);
timestamp++;
random = new Random(10121986L); // pseudo random order of row insertions
for (long i = 0; i < numRows; i++) {
byte[] rowId = Bytes.toBytes(random.nextLong() + "." + i);
if (i % 10 == 4) {
Delete delete = new Delete(rowId, timestamp, null);
region.delete(delete, null, true);
}
}
checkIndexedScanWithDeletedRows(family, false, 4L, 0);