Skip to content

Commit ee468f2

Browse files
maochongxinshenyunlong
authored andcommitted
fix normal del case
1 parent 40060f2 commit ee468f2

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

src/test/java/com/alipay/oceanbase/hbase/secondary/OHTableSecondaryPartDeleteTest.java

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ public static void testMultiCFDeleteFamilyImpl(Map.Entry<String, List<String>> e
412412
hTable.close();
413413
}
414414

415-
public static void testMultiCFDeleteFamilyVersionImpl(Map.Entry<String, List<String>> entry) throws Exception {
415+
public static void testMultiCFDeleteFamilyWithVersionImpl(Map.Entry<String, List<String>> entry) throws Exception {
416416
String key = "putKey";
417417
String value = "value";
418418
String column = "putColumn";
@@ -449,6 +449,43 @@ public static void testMultiCFDeleteFamilyVersionImpl(Map.Entry<String, List<Str
449449
hTable.close();
450450
}
451451

452+
public static void testMultiCFDeleteFamilyVersionImpl(Map.Entry<String, List<String>> entry) throws Exception {
453+
String key = "putKey";
454+
String value = "value";
455+
String column = "putColumn";
456+
457+
long ts1 = System.currentTimeMillis();
458+
long ts2 = ts1 + 1000;
459+
long ts3 = ts2 + 1000;
460+
long ts4 = ts3 + 1000;
461+
System.out.println("ts1:" + ts1 + ", ts2:" + ts2 + ", ts3:" + ts3 + ", ts4:" + ts4);
462+
OHTableClient hTable = ObHTableTestUtil.newOHTableClient(entry.getKey());
463+
hTable.init();
464+
Put put = new Put(toBytes(key));
465+
Delete delete = new Delete(toBytes(key));
466+
for (String tableName : entry.getValue()) {
467+
String family = getColumnFamilyName(tableName);
468+
put.addColumn(toBytes(family), toBytes(column + family), ts1, toBytes(value + ts1));
469+
put.addColumn(toBytes(family), toBytes(column + family), ts2, toBytes(value + ts2));
470+
put.addColumn(toBytes(family), toBytes(column + family), ts3, toBytes(value + ts3));
471+
put.addColumn(toBytes(family), toBytes(column + family), ts4, toBytes(value + ts4));
472+
delete.addFamilyVersion(toBytes(family), ts2);
473+
}
474+
hTable.put(put);
475+
hTable.delete(delete);
476+
477+
478+
Get get = new Get(toBytes(key));
479+
get.setMaxVersions();
480+
for (String tableName : entry.getValue()) {
481+
String family = getColumnFamilyName(tableName);
482+
get.addColumn(toBytes(family), toBytes(column + family));
483+
}
484+
Result result = hTable.get(get);
485+
Assert(entry.getValue(), ()->Assert.assertEquals(6, result.size()));
486+
hTable.close();
487+
}
488+
452489
public static void testDeleteAllImpl(Map.Entry<String, List<String>> entry) throws Exception {
453490
String key = "putKey";
454491
String value = "value";
@@ -530,6 +567,11 @@ public void testMultiCFDeleteFamily() throws Throwable {
530567
FOR_EACH(group2tableNames, OHTableSecondaryPartDeleteTest::testMultiCFDeleteFamilyImpl);
531568
}
532569

570+
@Test
571+
public void testMultiCFDeleteFamilyWithVersion() throws Throwable {
572+
FOR_EACH(group2tableNames, OHTableSecondaryPartDeleteTest::testMultiCFDeleteFamilyWithVersionImpl);
573+
}
574+
533575
@Test
534576
public void testMultiCFDeleteFamilyVersion() throws Throwable {
535577
FOR_EACH(group2tableNames, OHTableSecondaryPartDeleteTest::testMultiCFDeleteFamilyVersionImpl);

0 commit comments

Comments
 (0)