kgeisz commented on code in PR #7474:
URL: https://github.com/apache/hbase/pull/7474#discussion_r2608864186
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterMetrics.java:
##########
@@ -225,4 +228,70 @@ public void testClusterMetricsMetaTableSkipping() throws
Exception {
master.getTableDescriptors().remove(replicaMetaTable);
}
}
+
+ @Test
+ public void testClusterMetricsForeignTableSkipping() throws Exception {
+ List<TableName> allTables = new ArrayList<>();
+
+ // These tables, including the cluster's meta table, should not be foreign
to the cluster.
+ // The cluster should be able to find their state.
+ allTables.add(TableName.META_TABLE_NAME);
+ List<TableName> familiarTables = new ArrayList<>();
+ familiarTables.add(TableName.valueOf(null, "familiarTable1"));
+ familiarTables.add(TableName.valueOf("", "familiarTable2"));
+ familiarTables.add(TableName.valueOf("default", "familiarTable3"));
+ familiarTables.add(TableName.valueOf("familiarNamespace",
"familiarTable4"));
+ familiarTables.add(TableName.valueOf("familiarNamespace",
"familiarTable5"));
+
+ // Create these "familiar" tables so their state can be found
+
TEST_UTIL.getAdmin().createNamespace(NamespaceDescriptor.create("familiarNamespace").build());
+ for (TableName familiarTable : familiarTables) {
+ TEST_UTIL.createTable(familiarTable, "cf");
+ allTables.add(familiarTable);
+ }
+
+ // These tables should be foreign to the cluster.
+ // The cluster should not be able to find their state.
+ allTables.add(TableName.valueOf("hbase", "meta_replica"));
+ allTables.add(TableName.valueOf(null, "defaultNamespaceTable1"));
+ allTables.add(TableName.valueOf("", "defaultNamespaceTable2"));
+ allTables.add(TableName.valueOf("default", "defaultNamespaceTable3"));
+ allTables.add(TableName.valueOf("customNamespace",
"customNamespaceTable1"));
+ allTables.add(TableName.valueOf("customNamespace",
"customNamespaceTable2"));
+ allTables.add(TableName.valueOf("anotherNamespace",
"anotherNamespaceTable"));
+ allTables.add(TableName.valueOf("sharedNamespace",
"sharedNamespaceTable1"));
+ allTables.add(TableName.valueOf("sharedNamespace",
"sharedNamespaceTable2"));
+
+ // Update master's table descriptors to have all tables
+ TableDescriptor foreignTableDescriptor;
+ for (TableName tableName : allTables) {
+ foreignTableDescriptor = TableDescriptorBuilder.newBuilder(tableName)
+ .setColumnFamily(ColumnFamilyDescriptorBuilder.of("cf")).build();
+ master.getTableDescriptors().update(foreignTableDescriptor, true);
+ }
Review Comment:
The table descriptors were coming from the filesystem. The replica cluster
was seeing these, and if its meta had not been refreshed, then any foreign
table descriptors could not have their state found.
--
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]