Andrew Kyle Purtell created PHOENIX-8089:
--------------------------------------------
Summary: HighAvailabilityTestingUtility.createTableOnClusterPair
keeps a stale connection
Key: PHOENIX-8089
URL: https://issues.apache.org/jira/browse/PHOENIX-8089
Project: Phoenix
Issue Type: Test
Components: test
Affects Versions: 5.3.2
Reporter: Andrew Kyle Purtell
Assignee: Andrew Kyle Purtell
Fix For: 5.4.0, 5.3.3
{{HighAvailabilityGroup2IT.testNotFallbackToSingleConnection}} failed in a
normal {{mvn clean verify}} run with HBase 2.5 and JDK 11. It was the only
error of 9 tests in the class:
{{org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table
undefined. tableName=FBVTWUDRSZ
at
org.apache.phoenix.query.ConnectionQueryServicesImpl.getTableRegions(ConnectionQueryServicesImpl.java:1047)
at
org.apache.phoenix.iterate.DefaultParallelScanGrouper.getRegionBoundaries(DefaultParallelScanGrouper.java:81)
...
at
org.apache.phoenix.compile.PostLocalIndexDDLCompiler$PostLocalIndexDDLMutationPlan.execute(PostLocalIndexDDLCompiler.java:120)
at
org.apache.phoenix.schema.MetaDataClient.buildIndex(MetaDataClient.java:1481)
at
org.apache.phoenix.schema.MetaDataClient.createIndex(MetaDataClient.java:1954)
...
at
org.apache.phoenix.jdbc.HighAvailabilityTestingUtility$HBaseTestingUtilityPair.createTableOnClusterPair(HighAvailabilityTestingUtility.java:525)
at
org.apache.phoenix.jdbc.HighAvailabilityTestingUtility$HBaseTestingUtilityPair.createTableOnClusterPair(HighAvailabilityTestingUtility.java:506)
at
org.apache.phoenix.jdbc.HighAvailabilityGroup2IT.testNotFallbackToSingleConnection(HighAvailabilityGroup2IT.java:347)}}
The {{CREATE TABLE}} in {{createTableOnClusterPair}} succeeded. The {{CREATE
LOCAL INDEX}} that follows failed in the index build. The class passed in 4
earlier local full runs and in all 19 cached GitHub CI results.
This is a test defect in
{{{}HighAvailabilityTestingUtility.createTableOnClusterPair{}}}. An HBase
client behavior makes it visible. Two things combine.
*(1) The utility keeps its connection for the whole class.*
{{createTableOnClusterPair}} opens a connection to each cluster with empty
{{{}Properties{}}}. {{PhoenixDriver}} caches the {{ConnectionQueryServices}}
(CQS) by URL and properties. The utility calls {{{}clearCache(){}}}, which
clears only the metadata cache. The CQS and its HBase connection stay in the
driver cache for the whole class, through every mini cluster restart in later
tests. {{HighAvailabilityGroup2IT.tearDown}} closes the CQS that it opened with
{{{}haGroup.getProperties(){}}}. That is a different cache key, because
{{ConnectionInfo}} equality includes the HA group name from
{{{}PHOENIX_HA_GROUP_ATTR{}}}. So no code closes the utility's CQS.
*(2) The HBase 2.5 client keeps a cached master stub while a master answers on
its host and port.* {{ConnectionImplementation.getKeepAliveMasterService}}
makes a new stub only when {{isMasterRunning()}} on the cached stub fails. That
check uses host and port only, not the cluster identity. Region lookups go
through the ZooKeeper registry of the correct cluster.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)