This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch 5.2 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.2 by this push: new 781016f5cd PHOENIX-7290 Cannot load or instantiate class org.apache.phoenix.query.DefaultGuidePostsCacheFactory from SquirrelSQL 781016f5cd is described below commit 781016f5cdffd466ce8655d8b6ab511c5a60af7a 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-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 4578b075e2..df4aaf5d05 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -306,8 +306,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; public ConnectionInfo getConnectionInfo() { @@ -321,7 +319,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" @@ -470,10 +468,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); @@ -3561,6 +3555,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-client/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java b/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java index 1885658259..470a44fb76 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java +++ b/phoenix-core-client/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_ZOOKEEPER_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() { @@ -387,6 +382,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 {