[
https://issues.apache.org/jira/browse/HBASE-30571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated HBASE-30571:
-----------------------------------
Labels: pull-request-available (was: )
> [HBase CanaryTool] Exclude disabled tables from probed regions pool in
> regionserver mode
> ----------------------------------------------------------------------------------------
>
> Key: HBASE-30571
> URL: https://issues.apache.org/jira/browse/HBASE-30571
> Project: HBase
> Issue Type: Bug
> Components: canary
> Affects Versions: 3.0.0, 2.7.0, 2.5.16, 2.6.7
> Reporter: Bach Tran
> Priority: Minor
> Labels: pull-request-available
>
> When running CanaryTool in RegionServer mode, encountering a
> *TableNotEnabledException* (TNEE) results in {*}{color:#ff0000}no metric data
> being emitted to the sink, causing regionserver count to become inconsistent
> across canary runs{color}{*}.
> [CanaryTool.java#L764-L766|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L764-L766]
> {code:java}
> } catch (TableNotEnabledException tnee) {
> // This is considered a success since we got a response.
> successes.incrementAndGet();
> LOG.debug("The targeted table was disabled. Assuming success.");{code}
>
> Currently, CanaryTool swallows TNEE and increments the success counter under
> the assumption that receiving a response confirms the targeted RegionServer
> is healthy. However, this assumption is flawed: the TNEE verdict is
> synthesized from an `hbase:meta` lookup, which is served by whichever
> RegionServer happens to host the `hbase:meta` region, not specifically the
> RegionServer under test. Consequently, treating TNEE as a successful probe
> falsely validates the target server while silently omitting sink metrics,
> leading to unreliable run-over-run canary results.
>
> The alternative approach is to *filter out disabled tables* when constructing
> RegionServer - Regions mapping
> ([rsAndRMap|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L1859]),
> and treat a TNEE that slips through with no-op. This is not a regression and
> non-breaking as existing handling of TNEE is already a no-op besides
> [incrementing success
> count|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L764-L766]
> that is ONLY used for [INFO
> logging|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L1933-L1934]
> (when `-allRegions` flag is enabled).
> h4. IMPORTANT
> As we skip over regions from disabled table during `rsAndRMap` construction,
> regionservers that *only host disabled tables* will not be included in the
> map after the first pass. Those regionservers will be picked up in the second
> pass and assigned empty list as they don't hold any valid (readable) region.
> [CanaryTool.java#L1977-1983|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L1977-L1983]
> {code:java}
> for (ServerName rs : this.admin.getRegionServers()) {
> String rsName = rs.getAddress().toString();
> if (!rsAndRMap.containsKey(rsName)) {
> rsAndRMap.put(rsName, Collections.<RegionInfo> emptyList());
> }
> } {code}
>
> *Filtering out disabled tables* mirrors the behavior of the CanaryTool in
> [Region
> mode|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L1646]
> read flow.
> h4. Suggested code changes:
> 1.
> [CanaryTool.java#L764|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L764]:
> Remove the assumption that TNEE means success RegionServer read.
> {code:java}
> } catch (TableNotEnabledException tnee) {
> LOG.debug("The targeted table was disabled.");
> }
> ...{code}
> 2.
> [CanaryTool.java#getAllRegionServerByName#L1955|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java#L1955]
> Filter out disabled tables while constructing RegionServer - Region mapping.
> {code:java}
> for (TableDescriptor tableDesc : tableDescs) { TableName tableName =
> tableDesc.getTableName();
> try {
> if (!this.admin.isTableEnabled(tableName)) {
> // don't include regions of disabled table
> LOG.debug("Skipping disabled table {}", tableName);
> continue;
> }
> } catch (TableNotFoundException e) {
> LOG.debug("Skipping table {} as it no longer exists", tableName);
> continue;
> }
> ... {code}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)