You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ya...@apache.org on 2020/11/07 00:58:04 UTC

[phoenix] branch 4.x updated (31c9912 -> 50edcc9)

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

yanxinyi pushed a change to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git.


    from 31c9912  PHOENIX-6184 : Emit ageOfUnverifiedRow metric during read repairs
     new 893a050  Revert "PHOENIX-6179 : Relax maxLookBackAge check during an upgrade"
     new 50edcc9  PHOENIX-6179 : Relax maxLookBackAge check during an upgrade

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../phoenix/end2end/BackwardCompatibilityIT.java   | 55 +++++++++++++---------
 1 file changed, 32 insertions(+), 23 deletions(-)


[phoenix] 01/02: Revert "PHOENIX-6179 : Relax maxLookBackAge check during an upgrade"

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yanxinyi pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 893a05065d7cac58f57e2cb4f6ebc06d32269c5d
Author: Xinyi Yan <ya...@apache.org>
AuthorDate: Fri Nov 6 16:50:28 2020 -0800

    Revert "PHOENIX-6179 : Relax maxLookBackAge check during an upgrade"
    
    This reverts commit 9ffd740f2ee851abc485a9c283c741dce105dab4.
---
 .../phoenix/end2end/BackwardCompatibilityIT.java   | 76 +++++-----------------
 .../org/apache/phoenix/compile/QueryCompiler.java  |  5 --
 2 files changed, 16 insertions(+), 65 deletions(-)

diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
index 731d045..d20610a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
@@ -53,7 +53,6 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.apache.hadoop.hbase.regionserver.ScanInfoUtil;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
@@ -180,7 +179,7 @@ public class BackwardCompatibilityIT {
     public void testUpsertWithOldClient() throws Exception {
         // Insert data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, false);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
     }
 
@@ -188,16 +187,7 @@ public class BackwardCompatibilityIT {
     public void testCreateDivergedViewWithOldClientReadFromNewClient() throws Exception {
         // Create a base table, view and make it diverge from an old client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_DIVERGED_VIEW);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW, false);
-        assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
-    }
-
-    @Test
-    public void testCreateDivergedViewWithOldClientReadWithMaxLookBackAge()
-            throws Exception {
-        // Create a base table, view and make it diverge from an old client
-        executeQueryWithClientVersion(compatibleClientVersion, CREATE_DIVERGED_VIEW);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW, true);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW);
         assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
     }
 
@@ -224,15 +214,15 @@ public class BackwardCompatibilityIT {
 
     @Test
     public void testCreateDivergedViewWithNewClientReadFromOldClient() throws Exception {
-        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW, false);
+        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_DIVERGED_VIEW);
         assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
     }
 
     @Test
     public void testCreateDivergedViewWithNewClientReadFromNewClient() throws Exception {
-        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW, false);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW, false);
+        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW);
         assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
     }
 
@@ -247,7 +237,7 @@ public class BackwardCompatibilityIT {
     @Test
     public void testSelectWithOldClient() throws Exception {
         // Insert data with new client and read with old client
-        executeQueriesWithCurrentVersion(CREATE_ADD, false);
+        executeQueriesWithCurrentVersion(CREATE_ADD);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
     }
@@ -259,43 +249,18 @@ public class BackwardCompatibilityIT {
      * 3. New Client reads the data inserted by the old client 
      * 4. New Client inserts more data into the tables created by old client 
      * 5. Old Client reads the data inserted by new client
-     * Use phoenix.max.lookback.age.seconds config and ensure that upgrade
-     * is not impacted by the config.
      * 
      * @throws Exception thrown if any errors encountered during query execution or file IO
      */
     @Test
-    public void testSelectUpsertWithNewClientWithMaxLookBackAge() throws Exception {
-        // Insert data with old client and read with new client
-        executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, true);
-        assertExpectedOutput(QUERY_CREATE_ADD);
-
-        // Insert more data with new client and read with old client
-        executeQueriesWithCurrentVersion(ADD_DATA, true);
-        executeQueryWithClientVersion(compatibleClientVersion, QUERY_ADD_DATA);
-        assertExpectedOutput(QUERY_ADD_DATA);
-    }
-
-    /**
-     * Scenario:
-     * 1. Old Client connects to the updated server
-     * 2. Old Client creates tables and inserts data
-     * 3. New Client reads the data inserted by the old client
-     * 4. New Client inserts more data into the tables created by old client
-     * 5. Old Client reads the data inserted by new client
-     *
-     * @throws Exception thrown if any errors encountered during query execution or file IO
-     */
-    @Test
     public void testSelectUpsertWithNewClient() throws Exception {
         // Insert data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, false);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Insert more data with new client and read with old client
-        executeQueriesWithCurrentVersion(ADD_DATA, false);
+        executeQueriesWithCurrentVersion(ADD_DATA);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_ADD_DATA);
         assertExpectedOutput(QUERY_ADD_DATA);
     }
@@ -313,13 +278,13 @@ public class BackwardCompatibilityIT {
     @Test
     public void testSelectUpsertWithOldClient() throws Exception {
         // Insert data with new client and read with old client
-        executeQueriesWithCurrentVersion(CREATE_ADD, false);
+        executeQueriesWithCurrentVersion(CREATE_ADD);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Insert more data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, ADD_DATA);
-        executeQueriesWithCurrentVersion(QUERY_ADD_DATA, false);
+        executeQueriesWithCurrentVersion(QUERY_ADD_DATA);
         assertExpectedOutput(QUERY_ADD_DATA);
     }
 
@@ -336,7 +301,7 @@ public class BackwardCompatibilityIT {
     public void testUpsertDeleteWithOldClient() throws Exception {
         // Insert data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, false);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Deletes with the old client
@@ -357,13 +322,13 @@ public class BackwardCompatibilityIT {
     @Test
     public void testUpsertDeleteWithNewClient() throws Exception {
         // Insert data with old client and read with new client
-        executeQueriesWithCurrentVersion(CREATE_ADD, false);
+        executeQueriesWithCurrentVersion(CREATE_ADD);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Deletes with the new client
-        executeQueriesWithCurrentVersion(ADD_DELETE, false);
-        executeQueriesWithCurrentVersion(QUERY_ADD_DELETE, false);
+        executeQueriesWithCurrentVersion(ADD_DELETE);
+        executeQueriesWithCurrentVersion(QUERY_ADD_DELETE);
         assertExpectedOutput(QUERY_ADD_DELETE);
     }
 
@@ -371,7 +336,7 @@ public class BackwardCompatibilityIT {
     public void testUpdatedSplitPolicyForSysTask() throws Exception {
         executeQueryWithClientVersion(compatibleClientVersion,
             CREATE_DIVERGED_VIEW);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW, false);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW);
         try (org.apache.hadoop.hbase.client.Connection conn =
                 hbaseTestUtil.getConnection(); Admin admin = conn.getAdmin()) {
             HTableDescriptor tableDescriptor = admin.getTableDescriptor(
@@ -468,17 +433,8 @@ public class BackwardCompatibilityIT {
     }
 
     // Executes the SQL commands listed in the given operation file from the sql_files directory
-    private void executeQueriesWithCurrentVersion(String operation,
-            boolean setMaxLookBackAge) throws Exception {
+    private void executeQueriesWithCurrentVersion(String operation) throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        if (setMaxLookBackAge) {
-            props.put(
-                QueryServices.GLOBAL_INDEX_ROW_AGE_THRESHOLD_TO_DELETE_MS_ATTRIB,
-                    Long.toString(0));
-            props.put(ScanInfoUtil.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
-                Integer.toString(15));
-        }
-
         try (Connection conn = DriverManager.getConnection(url, props)) {
             StringBuilder sb = new StringBuilder();
             try (BufferedReader reader =
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
index 58565de..5f75e8b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
@@ -170,11 +170,6 @@ public class QueryCompiler {
 
     private void verifySCN() throws SQLException {
         PhoenixConnection conn = statement.getConnection();
-        if (conn.isRunningUpgrade()) {
-            // PHOENIX-6179 : if upgrade is going on, we don't need to
-            // perform MaxLookBackAge check
-            return;
-        }
         Long scn = conn.getSCN();
         if (scn == null) {
             return;


[phoenix] 02/02: PHOENIX-6179 : Relax maxLookBackAge check during an upgrade

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yanxinyi pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git

commit 50edcc9cb0bbeae15a24c67c3ce7f49ed8357145
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Tue Oct 27 23:29:15 2020 +0530

    PHOENIX-6179 : Relax maxLookBackAge check during an upgrade
    
    Signed-off-by: Xinyi Yan <ya...@apache.org>
---
 .../phoenix/end2end/BackwardCompatibilityIT.java   | 85 ++++++++++++++++++----
 .../org/apache/phoenix/compile/QueryCompiler.java  |  5 ++
 2 files changed, 74 insertions(+), 16 deletions(-)

diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
index d20610a..de72c21 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityIT.java
@@ -53,6 +53,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.regionserver.ScanInfoUtil;
 import org.apache.hadoop.hbase.util.VersionInfo;
 import org.apache.phoenix.coprocessor.MetaDataProtocol;
 import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
@@ -113,6 +114,11 @@ public class BackwardCompatibilityIT {
     private static String zkQuorum;
     private static String url;
 
+    private enum UpgradeProps {
+        NONE,
+        SET_MAX_LOOK_BACK_AGE
+    }
+
     public BackwardCompatibilityIT(String compatibleClientVersion) {
         this.compatibleClientVersion = compatibleClientVersion;
     }
@@ -179,7 +185,7 @@ public class BackwardCompatibilityIT {
     public void testUpsertWithOldClient() throws Exception {
         // Insert data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, UpgradeProps.NONE);
         assertExpectedOutput(QUERY_CREATE_ADD);
     }
 
@@ -187,7 +193,17 @@ public class BackwardCompatibilityIT {
     public void testCreateDivergedViewWithOldClientReadFromNewClient() throws Exception {
         // Create a base table, view and make it diverge from an old client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_DIVERGED_VIEW);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW, UpgradeProps.NONE);
+        assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
+    }
+
+    @Test
+    public void testCreateDivergedViewWithOldClientReadWithMaxLookBackAge()
+            throws Exception {
+        // Create a base table, view and make it diverge from an old client
+        executeQueryWithClientVersion(compatibleClientVersion, CREATE_DIVERGED_VIEW);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW,
+            UpgradeProps.SET_MAX_LOOK_BACK_AGE);
         assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
     }
 
@@ -214,15 +230,15 @@ public class BackwardCompatibilityIT {
 
     @Test
     public void testCreateDivergedViewWithNewClientReadFromOldClient() throws Exception {
-        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW);
+        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW, UpgradeProps.NONE);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_DIVERGED_VIEW);
         assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
     }
 
     @Test
     public void testCreateDivergedViewWithNewClientReadFromNewClient() throws Exception {
-        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW);
+        executeQueriesWithCurrentVersion(CREATE_DIVERGED_VIEW, UpgradeProps.NONE);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW, UpgradeProps.NONE);
         assertExpectedOutput(QUERY_CREATE_DIVERGED_VIEW);
     }
 
@@ -237,7 +253,7 @@ public class BackwardCompatibilityIT {
     @Test
     public void testSelectWithOldClient() throws Exception {
         // Insert data with new client and read with old client
-        executeQueriesWithCurrentVersion(CREATE_ADD);
+        executeQueriesWithCurrentVersion(CREATE_ADD, UpgradeProps.NONE);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
     }
@@ -249,18 +265,43 @@ public class BackwardCompatibilityIT {
      * 3. New Client reads the data inserted by the old client 
      * 4. New Client inserts more data into the tables created by old client 
      * 5. Old Client reads the data inserted by new client
+     * Use phoenix.max.lookback.age.seconds config and ensure that upgrade
+     * is not impacted by the config.
      * 
      * @throws Exception thrown if any errors encountered during query execution or file IO
      */
     @Test
+    public void testSelectUpsertWithNewClientWithMaxLookBackAge() throws Exception {
+        // Insert data with old client and read with new client
+        executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, UpgradeProps.SET_MAX_LOOK_BACK_AGE);
+        assertExpectedOutput(QUERY_CREATE_ADD);
+
+        // Insert more data with new client and read with old client
+        executeQueriesWithCurrentVersion(ADD_DATA, UpgradeProps.SET_MAX_LOOK_BACK_AGE);
+        executeQueryWithClientVersion(compatibleClientVersion, QUERY_ADD_DATA);
+        assertExpectedOutput(QUERY_ADD_DATA);
+    }
+
+    /**
+     * Scenario:
+     * 1. Old Client connects to the updated server
+     * 2. Old Client creates tables and inserts data
+     * 3. New Client reads the data inserted by the old client
+     * 4. New Client inserts more data into the tables created by old client
+     * 5. Old Client reads the data inserted by new client
+     *
+     * @throws Exception thrown if any errors encountered during query execution or file IO
+     */
+    @Test
     public void testSelectUpsertWithNewClient() throws Exception {
         // Insert data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, UpgradeProps.NONE);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Insert more data with new client and read with old client
-        executeQueriesWithCurrentVersion(ADD_DATA);
+        executeQueriesWithCurrentVersion(ADD_DATA, UpgradeProps.NONE);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_ADD_DATA);
         assertExpectedOutput(QUERY_ADD_DATA);
     }
@@ -278,13 +319,13 @@ public class BackwardCompatibilityIT {
     @Test
     public void testSelectUpsertWithOldClient() throws Exception {
         // Insert data with new client and read with old client
-        executeQueriesWithCurrentVersion(CREATE_ADD);
+        executeQueriesWithCurrentVersion(CREATE_ADD, UpgradeProps.NONE);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Insert more data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, ADD_DATA);
-        executeQueriesWithCurrentVersion(QUERY_ADD_DATA);
+        executeQueriesWithCurrentVersion(QUERY_ADD_DATA, UpgradeProps.NONE);
         assertExpectedOutput(QUERY_ADD_DATA);
     }
 
@@ -301,7 +342,7 @@ public class BackwardCompatibilityIT {
     public void testUpsertDeleteWithOldClient() throws Exception {
         // Insert data with old client and read with new client
         executeQueryWithClientVersion(compatibleClientVersion, CREATE_ADD);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_ADD, UpgradeProps.NONE);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Deletes with the old client
@@ -322,13 +363,13 @@ public class BackwardCompatibilityIT {
     @Test
     public void testUpsertDeleteWithNewClient() throws Exception {
         // Insert data with old client and read with new client
-        executeQueriesWithCurrentVersion(CREATE_ADD);
+        executeQueriesWithCurrentVersion(CREATE_ADD, UpgradeProps.NONE);
         executeQueryWithClientVersion(compatibleClientVersion, QUERY_CREATE_ADD);
         assertExpectedOutput(QUERY_CREATE_ADD);
 
         // Deletes with the new client
-        executeQueriesWithCurrentVersion(ADD_DELETE);
-        executeQueriesWithCurrentVersion(QUERY_ADD_DELETE);
+        executeQueriesWithCurrentVersion(ADD_DELETE, UpgradeProps.NONE);
+        executeQueriesWithCurrentVersion(QUERY_ADD_DELETE, UpgradeProps.NONE);
         assertExpectedOutput(QUERY_ADD_DELETE);
     }
 
@@ -336,7 +377,8 @@ public class BackwardCompatibilityIT {
     public void testUpdatedSplitPolicyForSysTask() throws Exception {
         executeQueryWithClientVersion(compatibleClientVersion,
             CREATE_DIVERGED_VIEW);
-        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW);
+        executeQueriesWithCurrentVersion(QUERY_CREATE_DIVERGED_VIEW,
+            UpgradeProps.NONE);
         try (org.apache.hadoop.hbase.client.Connection conn =
                 hbaseTestUtil.getConnection(); Admin admin = conn.getAdmin()) {
             HTableDescriptor tableDescriptor = admin.getTableDescriptor(
@@ -433,8 +475,19 @@ public class BackwardCompatibilityIT {
     }
 
     // Executes the SQL commands listed in the given operation file from the sql_files directory
-    private void executeQueriesWithCurrentVersion(String operation) throws Exception {
+    private void executeQueriesWithCurrentVersion(String operation,
+            UpgradeProps upgradeProps) throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        if (UpgradeProps.SET_MAX_LOOK_BACK_AGE.equals(upgradeProps)) {
+            // any value < 31 is enough to test relaxing the MaxLookBack age
+            // checks during an upgrade because during upgrade, SCN for the
+            // connection is set to be the phoenix version timestamp
+            // (31 as of now: MIN_SYSTEM_TABLE_TIMESTAMP_4_16_0 / MIN_SYSTEM_TABLE_TIMESTAMP_5_1_0)
+            // Hence, keeping value: 15
+            props.put(ScanInfoUtil.PHOENIX_MAX_LOOKBACK_AGE_CONF_KEY,
+                Integer.toString(15));
+        }
+
         try (Connection conn = DriverManager.getConnection(url, props)) {
             StringBuilder sb = new StringBuilder();
             try (BufferedReader reader =
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
index 5f75e8b..58565de 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/QueryCompiler.java
@@ -170,6 +170,11 @@ public class QueryCompiler {
 
     private void verifySCN() throws SQLException {
         PhoenixConnection conn = statement.getConnection();
+        if (conn.isRunningUpgrade()) {
+            // PHOENIX-6179 : if upgrade is going on, we don't need to
+            // perform MaxLookBackAge check
+            return;
+        }
         Long scn = conn.getSCN();
         if (scn == null) {
             return;