File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1818package org .apache .hadoop .hbase .regionserver ;
1919
2020import static org .junit .Assert .assertEquals ;
21+ import static org .junit .Assert .assertNotEquals ;
2122import static org .junit .Assert .assertNotNull ;
2223import static org .junit .Assert .assertNull ;
2324import static org .junit .Assert .assertTrue ;
@@ -598,4 +599,21 @@ public void testReadBytes() throws Exception {
598599 assertEquals ("Total zero-byte read bytes should be equal to 0" , 0 ,
599600 metricsRegionServer .getRegionServerWrapper ().getZeroCopyBytesRead ());
600601 }
602+
603+ @ Test
604+ public void testTableDescriptorHashMetric () throws Exception {
605+ doNPuts (1 , false );
606+ metricsRegionServer .getRegionServerWrapper ().forceRecompute ();
607+
608+ HRegion region = rs .getRegions (tableName ).get (0 );
609+ assertNotNull ("Region should exist" , region );
610+
611+ try (MetricsRegionWrapperImpl wrapper = new MetricsRegionWrapperImpl (region )) {
612+ String hash = wrapper .getTableDescriptorHash ();
613+
614+ assertNotNull ("TableDescriptorHash should not be null" , hash );
615+ assertNotEquals ("TableDescriptorHash should not be 'UNKNOWN'" , "UNKNOWN" , hash );
616+ assertEquals ("Hash should be 64 characters (SHA-256 hex)" , 64 , hash .length ());
617+ }
618+ }
601619}
You can’t perform that action at this time.
0 commit comments