You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ss...@apache.org on 2023/01/18 14:53:06 UTC

[phoenix] branch 5.1 updated: PHOENIX-6855 Upgrade from 4.7 to 5+ fails if any of the local indexes exist.

This is an automated email from the ASF dual-hosted git repository.

ssa 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 335c52fc07 PHOENIX-6855 Upgrade from 4.7 to 5+ fails if any of the local indexes exist.
335c52fc07 is described below

commit 335c52fc07e217388a12bfa0fab5388b4cc9cef9
Author: Sergey Soldatov <ss...@cloudera.com>
AuthorDate: Mon Jan 16 21:53:01 2023 -0800

    PHOENIX-6855 Upgrade from 4.7 to 5+ fails if any of the local indexes exist.
---
 .../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 99c434f924..86ed6713ee 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
@@ -374,6 +374,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
     private final int maxInternalConnectionsAllowed;
     private final boolean shouldThrottleNumConnections;
     public static final byte[] MUTEX_LOCKED = "MUTEX_LOCKED".getBytes(StandardCharsets.UTF_8);
+    private boolean localIndexUpgradeRequired;
 
     private static interface FeatureSupported {
         boolean isSupported(ConnectionQueryServices services);
@@ -3746,7 +3747,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,
@@ -4004,6 +4005,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) {