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:05 UTC
[phoenix] 01/02: Revert "PHOENIX-6179 : Relax maxLookBackAge check
during an upgrade"
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;