@Before public void setUp() throws Exception { sdt = new ScanDeleteTracker(CellComparatorImpl.COMPARATOR); }
@Test public void testDeleteKeepVersionZero() { byte[] qualifier = Bytes.toBytes("qualifier"); long deleteTimestamp = 10; long valueTimestamp = 0; sdt.reset(); KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, deleteTimestamp, KeyValue.Type.Delete); sdt.add(kv); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, valueTimestamp, KeyValue.Type.Delete); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.NOT_DELETED, ret); } }
@Test public void testDeleteColumnDelete() { byte[] qualifier = Bytes.toBytes("qualifier"); KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.DeleteColumn); sdt.add(kv); qualifier = Bytes.toBytes("qualifier1"); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.Delete); sdt.add(kv); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.VERSION_DELETED, ret); }
@Override public void reset() { super.reset(); // clear only here visibilityTagsDeleteColumns = null; visibilityTagsDeleteFamily = null; visibilityTagsDeleteFamilyVersion = null; visiblityTagsDeleteColumnVersion = null; } }
@Test public void testDeletedByDeleteFamily() { KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteFamily); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteColumn); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.FAMILY_DELETED, ret); }
@Override // should not be called at all even (!) public void update() { this.reset(); }
@Test public void testDeleteKeepVersionZero() { byte[] qualifier = Bytes.toBytes("qualifier"); long deleteTimestamp = 10; long valueTimestamp = 0; sdt.reset(); KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, deleteTimestamp, KeyValue.Type.Delete); sdt.add(kv); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, valueTimestamp, KeyValue.Type.Delete); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.NOT_DELETED, ret); } }
oldestUnexpiredTS); } else { deleteTracker = new ScanDeleteTracker(scanInfo.getComparator());
@Test public void testDeleteDeleteColumn() { byte[] qualifier = Bytes.toBytes("qualifier"); KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.Delete); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.DeleteColumn); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.DeleteColumn); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.COLUMN_DELETED, ret); }
@Before public void setUp() throws Exception { sdt = new ScanDeleteTracker(CellComparatorImpl.COMPARATOR); }
@Test public void testDeletedByDeleteColumn() { KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteColumn); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteColumn); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.COLUMN_DELETED, ret); }
KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), null, timestamp, KeyValue.Type.DeleteFamilyVersion); sdt.add(kv); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier1, timestamp, KeyValue.Type.DeleteFamilyVersion); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.FAMILY_VERSION_DELETED, ret); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier2, timestamp, KeyValue.Type.DeleteFamilyVersion); ret = sdt.isDeleted(kv); assertEquals(DeleteResult.FAMILY_VERSION_DELETED, ret); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier3, timestamp, KeyValue.Type.DeleteFamilyVersion); ret = sdt.isDeleted(kv); assertEquals(DeleteResult.FAMILY_VERSION_DELETED, ret); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier4, timestamp, KeyValue.Type.DeleteFamilyVersion); ret = sdt.isDeleted(kv); assertEquals(DeleteResult.FAMILY_VERSION_DELETED, ret); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier1, timestamp + 3, KeyValue.Type.DeleteFamilyVersion); ret = sdt.isDeleted(kv); assertEquals(DeleteResult.NOT_DELETED, ret); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier2, timestamp - 2, KeyValue.Type.DeleteFamilyVersion); ret = sdt.isDeleted(kv); assertEquals(DeleteResult.NOT_DELETED, ret); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier3, timestamp - 5, KeyValue.Type.DeleteFamilyVersion);
@Test public void testDeleteColumnDelete() { byte[] qualifier = Bytes.toBytes("qualifier"); KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.DeleteColumn); sdt.add(kv); qualifier = Bytes.toBytes("qualifier1"); kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.Delete); sdt.add(kv); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.VERSION_DELETED, ret); }
@Test public void testDeletedByDeleteColumn() { KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteColumn); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteColumn); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.COLUMN_DELETED, ret); }
@Test public void testDeletedByDeleteFamily() { KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteFamily); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), Bytes.toBytes("qualifier"), timestamp, KeyValue.Type.DeleteColumn); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.FAMILY_DELETED, ret); }
@Test public void testDeleteDeleteColumn() { byte[] qualifier = Bytes.toBytes("qualifier"); KeyValue kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.Delete); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.DeleteColumn); sdt.add(kv); timestamp -= 5; kv = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("f"), qualifier, timestamp, KeyValue.Type.DeleteColumn); DeleteResult ret = sdt.isDeleted(kv); assertEquals(DeleteResult.COLUMN_DELETED, ret); }