This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch 5.1 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push: new 86d0632019 PHOENIX-7290 Cannot load or instantiate class org.apache.phoenix.query.DefaultGuidePostsCacheFactory from SquirrelSQL 86d0632019 is described below commit 86d06320196da303ffbd0e3ceec3cfb97a9ec482 Author: Istvan Toth <st...@apache.org> AuthorDate: Thu Apr 4 17:16:58 2024 +0200 PHOENIX-7290 Cannot load or instantiate class org.apache.phoenix.query.DefaultGuidePostsCacheFactory from SquirrelSQL --- .../apache/phoenix/query/ConnectionQueryServicesImpl.java | 13 ++++++------- .../phoenix/query/ConnectionlessQueryServicesImpl.java | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 859251fe98..e7dad8e149 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -312,8 +312,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement private static final int DEFAULT_OUT_OF_ORDER_MUTATIONS_WAIT_TIME_MS = 1000; private static final String ALTER_TABLE_SET_PROPS = "ALTER TABLE %s SET %s=%s"; - private final GuidePostsCacheProvider - GUIDE_POSTS_CACHE_PROVIDER = new GuidePostsCacheProvider(); protected final Configuration config; protected final ConnectionInfo connectionInfo; // Copy of config.getProps(), but read-only to prevent synchronization that we @@ -322,7 +320,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement private final String userName; private final User user; private final ConcurrentHashMap<ImmutableBytesWritable,ConnectionQueryServices> childServices; - private final GuidePostsCacheWrapper tableStatsCache; + private GuidePostsCacheWrapper tableStatsCache; // Cache the latest meta data here for future connections // writes guarded by "latestMetaDataLock" @@ -453,10 +451,6 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } connectionQueues = ImmutableList.copyOf(list); - // A little bit of a smell to leak `this` here, but should not be a problem - this.tableStatsCache = GUIDE_POSTS_CACHE_PROVIDER.getGuidePostsCache(props.get(GUIDE_POSTS_CACHE_FACTORY_CLASS, - QueryServicesOptions.DEFAULT_GUIDE_POSTS_CACHE_FACTORY_CLASS), this, config); - this.isAutoUpgradeEnabled = config.getBoolean(AUTO_UPGRADE_ENABLED, QueryServicesOptions.DEFAULT_AUTO_UPGRADE_ENABLED); this.maxConnectionsAllowed = config.getInt(QueryServices.CLIENT_CONNECTION_MAX_ALLOWED_CONNECTIONS, QueryServicesOptions.DEFAULT_CLIENT_CONNECTION_MAX_ALLOWED_CONNECTIONS); @@ -3342,6 +3336,11 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement LOGGER.info("An instance of ConnectionQueryServices was created."); openConnection(); hConnectionEstablished = true; + tableStatsCache = + (new GuidePostsCacheProvider()).getGuidePostsCache( + props.getProperty(GUIDE_POSTS_CACHE_FACTORY_CLASS, + QueryServicesOptions.DEFAULT_GUIDE_POSTS_CACHE_FACTORY_CLASS), + ConnectionQueryServicesImpl.this, config); String skipSystemExistenceCheck = props.getProperty(SKIP_SYSTEM_TABLES_EXISTENCE_CHECK); if (skipSystemExistenceCheck != null && diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java index f215786f2e..2a048c7319 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java @@ -110,8 +110,6 @@ import org.apache.phoenix.thirdparty.com.google.common.collect.Maps; */ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices implements ConnectionQueryServices { private static ServerName SERVER_NAME = ServerName.parseServerName(HConstants.LOCALHOST + Addressing.HOSTNAME_PORT_SEPARATOR + HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT); - private static final GuidePostsCacheProvider - GUIDE_POSTS_CACHE_PROVIDER = new GuidePostsCacheProvider(); private final ReadOnlyProps props; private PMetaData metaData; private final Map<SequenceKey, SequenceInfo> sequenceMap = Maps.newHashMap(); @@ -120,7 +118,7 @@ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices imple private volatile boolean initialized; private volatile SQLException initializationException; private final Map<String, List<HRegionLocation>> tableSplits = Maps.newHashMap(); - private final GuidePostsCacheWrapper guidePostsCache; + private GuidePostsCacheWrapper guidePostsCache; private final Configuration config; private User user; @@ -153,9 +151,6 @@ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices imple // set replication required parameter ConfigUtil.setReplicationConfigIfAbsent(this.config); this.props = new ReadOnlyProps(this.config.iterator()); - - this.guidePostsCache = GUIDE_POSTS_CACHE_PROVIDER.getGuidePostsCache(props.get(GUIDE_POSTS_CACHE_FACTORY_CLASS, - QueryServicesOptions.DEFAULT_GUIDE_POSTS_CACHE_FACTORY_CLASS), null, config); } private PMetaData newEmptyMetaData() { @@ -382,6 +377,11 @@ public class ConnectionlessQueryServicesImpl extends DelegateQueryServices imple } return; } + guidePostsCache = + (new GuidePostsCacheProvider()).getGuidePostsCache( + props.getProperty(GUIDE_POSTS_CACHE_FACTORY_CLASS, + QueryServicesOptions.DEFAULT_GUIDE_POSTS_CACHE_FACTORY_CLASS), + null, config); SQLException sqlE = null; PhoenixConnection metaConnection = null; try {