This is an automated email from the ASF dual-hosted git repository. ssa pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push: new d2acf9c262 PHOENIX-6855 Upgrade from 4.7 to 5+ fails if any of the local indexes exist. (#1550) d2acf9c262 is described below commit d2acf9c2620e2caf636022fc759844d5c46cb455 Author: Sergey Soldatov <s...@apache.org> AuthorDate: Wed Jan 18 06:43:20 2023 -0800 PHOENIX-6855 Upgrade from 4.7 to 5+ fails if any of the local indexes exist. (#1550) --- .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 84abaee0b6..4a1256f054 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 @@ -392,6 +392,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement private final boolean shouldThrottleNumConnections; public static final byte[] MUTEX_LOCKED = "MUTEX_LOCKED".getBytes(StandardCharsets.UTF_8); private ServerSideRPCControllerFactory serverSideRPCControllerFactory; + private boolean localIndexUpgradeRequired; private static interface FeatureSupported { boolean isSupported(ConnectionQueryServices services); @@ -3933,7 +3934,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement metaConnection = UpgradeUtil.disableViewIndexes(metaConnection); if (getProps().getBoolean(QueryServices.LOCAL_INDEX_CLIENT_UPGRADE_ATTRIB, QueryServicesOptions.DEFAULT_LOCAL_INDEX_CLIENT_UPGRADE)) { - metaConnection = UpgradeUtil.upgradeLocalIndexes(metaConnection); + localIndexUpgradeRequired = true; } ConnectionQueryServicesImpl.this.removeTable(null, PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME, null, @@ -4207,6 +4208,13 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // snapshot entries metaConnection = upgradeOtherSystemTablesIfRequired(metaConnection, moveChildLinks, systemTableToSnapshotMap); + + // Once the system tables are upgraded the local index upgrade can be done + if (localIndexUpgradeRequired) { + LOGGER.info("Upgrading local indexes"); + metaConnection = UpgradeUtil.upgradeLocalIndexes(metaConnection); + } + // Synchronize necessary properties amongst all column families of a base table // and its indexes. See PHOENIX-3955 if (syncAllTableAndIndexProps) {