taklwu commented on code in PR #7474:
URL: https://github.com/apache/hbase/pull/7474#discussion_r2612097480


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java:
##########
@@ -3116,16 +3116,9 @@ public ClusterMetrics 
getClusterMetricsWithoutCoprocessor(EnumSet<Option> option
           if (isActiveMaster() && isInitialized() && assignmentManager != 
null) {
             try {
               Map<TableName, RegionStatesCount> tableRegionStatesCountMap = 
new HashMap<>();
-              Map<String, TableDescriptor> tableDescriptorMap = 
getTableDescriptors().getAll();
-              for (TableDescriptor tableDescriptor : 
tableDescriptorMap.values()) {
+              List<TableDescriptor> tableDescriptors = 
listTableDescriptors(null, null, null, true);
+              for (TableDescriptor tableDescriptor : tableDescriptors) {

Review Comment:
   you probably clean my concern that we're comparing the meta state in 
`tableStateManager` vs the table descriptor found on the filesystem. 
   
   just again the unit test is doing slightly different, it called 
`master.getTableDescriptors().update(foreignTableDescriptor, true)` to update 
the `cache` of the `tableDescriptors`/`FSTableDescriptors` (not writing the 
TableDescriptors on actual file system) with the additional tables, and then 
compare with the `tableStateManager` when `TABLE_TO_REGIONS_COUNT` hook is 
being called. 
   
   since `FSTableDescriptors.getAll()` is always using the cache after the 
master is initialized (not reloading from the filesystem), the test is 
partially correct that neither the `tableStateManager` of meta or 
`FSTableDescriptors.getAll()` from the view of filesystem does not have those 
unsynced table, or `tableStateManager` does not have those additional loaded 
table in `cache` of `FSTableDescriptors`
   
   I should have used debug mode to clear the confusion that the  
`FSTableDescriptors.getAll()` in the unit test are always from cache, thanks 
again.



-- 
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]

Reply via email to