Apache9 commented on a change in pull request #4030:
URL: https://github.com/apache/hbase/pull/4030#discussion_r785401858
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAdmin3.java
##########
@@ -393,4 +398,156 @@ public void testDeleteEditUnknownColumnFamilyAndOrTable()
throws IOException {
ADMIN.deleteTable(tableName);
}
}
+
+ private static final String SRC_IMPL =
"hbase.store.file-tracker.migration.src.impl";
+
+ private static final String DST_IMPL =
"hbase.store.file-tracker.migration.dst.impl";
+
+ private void verifyModifyTableResult(TableName tableName, byte[] family,
byte[] qual, byte[] row,
+ byte[] value, String sft) throws IOException {
+ TableDescriptor td = ADMIN.getDescriptor(tableName);
+ assertEquals(sft, td.getValue(StoreFileTrackerFactory.TRACKER_IMPL));
+ // no migration related configs
+ assertNull(td.getValue(SRC_IMPL));
+ assertNull(td.getValue(DST_IMPL));
+ try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
+ assertArrayEquals(value, table.get(new Get(row)).getValue(family, qual));
+ }
+ }
+
+ @Test
+ public void testModifyTableStoreFileTracker() throws IOException {
+ TableName tableName = TableName.valueOf(name.getMethodName());
+ byte[] family = Bytes.toBytes("info");
+ byte[] qual = Bytes.toBytes("q");
+ byte[] row = Bytes.toBytes(0);
+ byte[] value = Bytes.toBytes(1);
+ try (Table table = TEST_UTIL.createTable(tableName, family)) {
+ table.put(new Put(row).addColumn(family, qual, value));
+ }
+ // change to FILE
+ ADMIN.modifyTableStoreFileTracker(tableName,
StoreFileTrackerFactory.Trackers.FILE.name());
+ verifyModifyTableResult(tableName, family, qual, row, value,
+ StoreFileTrackerFactory.Trackers.FILE.name());
+
+ // change to FILE again, should have no effect
+ ADMIN.modifyTableStoreFileTracker(tableName,
StoreFileTrackerFactory.Trackers.FILE.name());
+ verifyModifyTableResult(tableName, family, qual, row, value,
+ StoreFileTrackerFactory.Trackers.FILE.name());
+
+ // change to MIGRATION, and then to FILE
+
ADMIN.modifyTable(TableDescriptorBuilder.newBuilder(ADMIN.getDescriptor(tableName))
+ .setValue(StoreFileTrackerFactory.TRACKER_IMPL,
+ StoreFileTrackerFactory.Trackers.MIGRATION.name())
+ .setValue(SRC_IMPL,
+ StoreFileTrackerFactory.Trackers.FILE.name())
+ .setValue(DST_IMPL,
+ StoreFileTrackerFactory.Trackers.DEFAULT.name())
+ .build());
Review comment:
Yes. This one is for MIGRATION but the dst is different.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]