[
https://issues.apache.org/jira/browse/PHOENIX-5940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17227668#comment-17227668
]
ASF GitHub Bot commented on PHOENIX-5940:
-----------------------------------------
yanxinyi commented on a change in pull request #950:
URL: https://github.com/apache/phoenix/pull/950#discussion_r519060613
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/BackwardCompatibilityTestUtil.java
##########
@@ -0,0 +1,301 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.end2end;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.curator.shaded.com.google.common.collect.Lists;
+import org.apache.hadoop.conf.Configuration;
+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;
+import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.util.PropertiesUtil;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assume.assumeFalse;
+
+public class BackwardCompatibilityTestUtil {
+ public static final String SQL_DIR = "sql_files/";
+ public static final String RESULTS_AND_GOLD_FILES_DIR = "gold_files/";
+ public static final String COMPATIBLE_CLIENTS_JSON =
+ "compatible_client_versions.json";
+ public static final String BASH = "/bin/bash";
+ public static final String EXECUTE_QUERY_SH = "scripts/execute_query.sh";
+ public static final String QUERY_PREFIX = "query_";
+ public static final String RESULT_PREFIX = "result_";
+ public static final String GOLD_PREFIX = "gold_";
+ public static final String SQL_EXTENSION = ".sql";
+ public static final String TEXT_EXTENSION = ".txt";
+ public static final String CREATE_ADD = "create_add";
+ public static final String CREATE_DIVERGED_VIEW = "create_diverged_view";
+ public static final String ADD_DATA = "add_data";
+ public static final String ADD_DELETE = "add_delete";
+ public static final String QUERY_CREATE_ADD = QUERY_PREFIX + CREATE_ADD;
+ public static final String QUERY_ADD_DATA = QUERY_PREFIX + ADD_DATA;
+ public static final String QUERY_ADD_DELETE = QUERY_PREFIX + ADD_DELETE;
+ public static final String QUERY_CREATE_DIVERGED_VIEW = QUERY_PREFIX +
CREATE_DIVERGED_VIEW;
+ public static final String MVN_HOME = "maven.home";
+ public static final String JAVA_TMP_DIR = "java.io.tmpdir";
+
+ public static List<String> computeClientVersions() throws Exception {
+ String hbaseVersion = VersionInfo.getVersion();
+ Pattern p = Pattern.compile("\\d+\\.\\d+");
+ Matcher m = p.matcher(hbaseVersion);
+ String hbaseProfile = null;
+ if (m.find()) {
+ hbaseProfile = m.group();
+ }
+ List<String> clientVersions = Lists.newArrayList();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+ try (InputStream inputStream = BackwardCompatibilityIT.class
+
.getClassLoader().getResourceAsStream(COMPATIBLE_CLIENTS_JSON)) {
+ assertNotNull(inputStream);
+ JsonNode jsonNode = mapper.readTree(inputStream);
+ JsonNode HBaseProfile = jsonNode.get(hbaseProfile);
+ for (final JsonNode clientVersion : HBaseProfile) {
+ clientVersions.add(clientVersion.textValue() + "-HBase-" +
hbaseProfile);
+ }
+ }
+ return clientVersions;
+ }
+
+ // Executes the queries listed in the operation file with a given client
version
+ public static void executeQueryWithClientVersion(String clientVersion,
String operation,
+ String zkQuorum) throws
Exception {
+ List<String> cmdParams = Lists.newArrayList();
+ cmdParams.add(BASH);
+ // Note that auto-commit is true for queries executed via SQLline
+ URL fileUrl =
BackwardCompatibilityIT.class.getClassLoader().getResource(EXECUTE_QUERY_SH);
+ assertNotNull(fileUrl);
+ cmdParams.add(new File(fileUrl.getFile()).getAbsolutePath());
+ cmdParams.add(zkQuorum);
+ cmdParams.add(clientVersion);
+
+ fileUrl = BackwardCompatibilityIT.class.getClassLoader()
+ .getResource(SQL_DIR + operation + SQL_EXTENSION);
+ assertNotNull(fileUrl);
+ cmdParams.add(new File(fileUrl.getFile()).getAbsolutePath());
+ fileUrl = BackwardCompatibilityIT.class.getClassLoader().getResource(
+ RESULTS_AND_GOLD_FILES_DIR);
+ assertNotNull(fileUrl);
+ String resultFilePath = new File(fileUrl.getFile()).getAbsolutePath()
+ "/" +
+ RESULT_PREFIX + operation + TEXT_EXTENSION;
+ cmdParams.add(resultFilePath);
+ cmdParams.add(System.getProperty(JAVA_TMP_DIR));
+
+ if (System.getProperty(MVN_HOME) != null) {
+ cmdParams.add(System.getProperty(MVN_HOME));
+ }
+
+ ProcessBuilder pb = new ProcessBuilder(cmdParams);
+ final Process p = pb.start();
+ final StringBuffer sb = new StringBuffer();
+ //Capture the output stream if any from the execution of the script
+ Thread outputStreamThread = new Thread() {
+ @Override
+ public void run() {
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(p.getInputStream()))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ sb.append(line);
+ }
+ } catch (final Exception e) {
+ sb.append(e.getMessage());
+ }
+ }
+ };
+ outputStreamThread.start();
+ //Capture the error stream if any from the execution of the script
+ Thread errorStreamThread = new Thread() {
+ @Override
+ public void run() {
+ try (BufferedReader reader = new BufferedReader(
+ new InputStreamReader(p.getErrorStream()))) {
+ String line;
+ while ((line = reader.readLine()) != null) {
+ sb.append(line);
+ }
+ } catch (final Exception e) {
+ sb.append(e.getMessage());
+ }
+ }
+ };
+ errorStreamThread.start();
+ p.waitFor();
+ assertEquals(String.format("Executing the query failed%s. Check the
result file: %s",
+ sb.length() > 0 ? sb.append(" with : ").toString() : "",
resultFilePath),
+ 0, p.exitValue());
+ }
+
+
+ public static void checkForPreConditions(String compatibleClientVersion,
Configuration conf) throws Exception {
+ // For the first code cut of any major version, there wouldn't be any
backward compatible
+ // clients. Hence the test wouldn't run and just return true when the
client
+ // version to be tested is same as current version
+
assumeFalse(compatibleClientVersion.contains(MetaDataProtocol.CURRENT_CLIENT_VERSION));
+ // Make sure that cluster is clean before test execution with no
system tables
+ try (org.apache.hadoop.hbase.client.Connection conn =
+ ConnectionFactory.createConnection(conf);
+ Admin admin = conn.getAdmin()) {
+
assertFalse(admin.tableExists(TableName.valueOf(QueryConstants.SYSTEM_SCHEMA_NAME,
+ PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE)));
+ }
+ }
+
+ // Saves the result set to a text file to be compared against the gold
file for difference
+ private static void saveResultSet(ResultSet rs, BufferedWriter br) throws
Exception {
+ ResultSetMetaData rsm = rs.getMetaData();
+ int columnCount = rsm.getColumnCount();
+ StringBuilder row = new
StringBuilder(formatStringWithQuotes(rsm.getColumnName(1)));
+ for (int i = 2; i <= columnCount; i++) {
+
row.append(",").append(formatStringWithQuotes(rsm.getColumnName(i)));
+ }
+ br.write(row.toString());
+ br.write("\n");
+ while (rs.next()) {
+ row = new StringBuilder(formatStringWithQuotes(rs.getString(1)));
+ for (int i = 2; i <= columnCount; i++) {
+
row.append(",").append(formatStringWithQuotes(rs.getString(i)));
+ }
+ br.write(row.toString());
+ br.write("\n");
+ }
+ }
+
+ private static String formatStringWithQuotes(String str) {
+ return (str != null) ? String.format("\'%s\'", str) : "\'\'";
+ }
+
+ private static BufferedReader getBufferedReaderForResource(String
relativePath)
+ throws FileNotFoundException {
+ URL fileUrl =
BackwardCompatibilityTestUtil.class.getClassLoader().getResource(relativePath);
+ assertNotNull(fileUrl);
+ return new BufferedReader(new FileReader(new File(fileUrl.getFile())));
+ }
+
+ // Compares the result file against the gold file to match for the
expected output
+ // for the given operation
+ public static void assertExpectedOutput(String result) throws Exception {
+ List<String> resultFile = Lists.newArrayList();
+ List<String> goldFile = Lists.newArrayList();
+ String line;
+ try (BufferedReader resultFileReader = getBufferedReaderForResource(
+ RESULTS_AND_GOLD_FILES_DIR + RESULT_PREFIX + result +
TEXT_EXTENSION)) {
+ while ((line = resultFileReader.readLine()) != null) {
+ resultFile.add(line.trim());
+ }
+ }
+ try (BufferedReader goldFileReader = getBufferedReaderForResource(
+ RESULTS_AND_GOLD_FILES_DIR + GOLD_PREFIX + result +
TEXT_EXTENSION)) {
+ while ((line = goldFileReader.readLine()) != null) {
+ line = line.trim();
+ if ( !(line.isEmpty() || line.startsWith("*") ||
line.startsWith("/"))) {
+ goldFile.add(line);
+ }
+ }
+ }
+
+ // We take the first line in gold file and match against the result
file to exclude any
+ // other WARNING messages that comes as a result of the query execution
+ int index = resultFile.indexOf(goldFile.get(0));
+ assertNotEquals("Mismatch found between gold file and result file",
-1, index);
+ resultFile = resultFile.subList(index, resultFile.size());
+ assertEquals(goldFile, resultFile);
+ }
+
+ // Executes the SQL commands listed in the given operation file from the
sql_files directory
+ public static void executeQueriesWithCurrentVersion(String operation,
String url,
+ boolean
setMaxLookBackAge) 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 =
+ getBufferedReaderForResource(SQL_DIR + operation +
SQL_EXTENSION)) {
+ String sqlCommand;
+ while ((sqlCommand = reader.readLine()) != null) {
+ sqlCommand = sqlCommand.trim();
+ if (sqlCommand.length() == 0 || sqlCommand.startsWith("/")
+ || sqlCommand.startsWith("*")) {
+ continue;
+ }
+ sb.append(sqlCommand);
+ }
+ }
+ ResultSet rs;
+ String[] sqlCommands = sb.toString().split(";");
+
+ URL fileUrl =
BackwardCompatibilityIT.class.getClassLoader().getResource(
+ RESULTS_AND_GOLD_FILES_DIR);
+ assertNotNull(fileUrl);
+ final String resultFile = new
File(fileUrl.getFile()).getAbsolutePath() + "/" +
+ RESULT_PREFIX + operation + TEXT_EXTENSION;
+ try (BufferedWriter br = new BufferedWriter(new
FileWriter(resultFile))) {
+ for (String command : sqlCommands) {
+ try (PreparedStatement stmt =
conn.prepareStatement(command)) {
+ stmt.execute();
+ rs = stmt.getResultSet();
+ if (rs != null) {
+ saveResultSet(rs, br);
+ }
+ }
+ conn.commit();
+ }
+ }
+ }
+ }
+}
Review comment:
Yes, no logic changes. The only diff is adding extra param for zkQuorm
or URL for the execute script.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Pre-4.15 client cannot connect to 4.15+ server after SYSTEM.CATALOG region
> has split
> ------------------------------------------------------------------------------------
>
> Key: PHOENIX-5940
> URL: https://issues.apache.org/jira/browse/PHOENIX-5940
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.14.3
> Reporter: Chinmay Kulkarni
> Assignee: Xinyi Yan
> Priority: Blocker
> Fix For: 4.16.0
>
>
> Steps to repro:
> # Start the server with 4.15 or 4.16-SNAPSHOT (head of 4.x) with the default
> setting for splitting SYSTEM.CATALOG i.e.
> _phoenix.system.catalog.splittable=true_
> # Connect with a 4.15+ client and create enough tables/views/indices to
> cause the SYSTEM.CATALOG region to split (you may want to set the following
> server-side configs for a quicker repro:
> ## _hbase.hregion.memstore.flush.size=1048576_ i.e. 1MB (to flush memstores
> quicker),
> ## _hbase.hregion.max.filesize=2097152_ i.e. 2MB (so we don've have to load
> too much data to cause a region split),
> ## _hbase.zookeeper.property.maxClientCnxns=-1_ (If we don’t set this, the
> default limit is easily hit when creating hundreds of views),
> ## _hbase.table.sanity.checks=false_ (otherwise HBase complains that the
> HRegion max file size config is too small).
> # With these configs, I've found that creating ~4000 views is sufficient to
> cause the SYSTEM.CATALOG region to split.
> # Now connect with any pre-4.15 client like 4.14.3. Getting a connection
> will fail with the following stack trace:
> {noformat}
> Caused by:
> org.apache.hadoop.hbase.ipc.RemoteWithExtrasException(org.apache.hadoop.hbase.DoNotRetryIOException):
> org.apache.hadoop.hbase.DoNotRetryIOException: ERROR 2013 (INT15): ERROR
> 2013 (INT15): MetadataEndpointImpl doGetTable called for table not present on
> region tableName=SYSTEM.CATALOG SYSTEM.CATALOG
> at
> org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:114)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3214)
> at
> org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:17268)
> at
> org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8338)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2170)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2152)
> at
> org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:35076)
> at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2394)
> at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)
> Caused by: java.sql.SQLException: ERROR 2013 (INT15): MetadataEndpointImpl
> doGetTable called for table not present on region tableName=SYSTEM.CATALOG
> at
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:575)
> at
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:195)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable(MetaDataEndpointImpl.java:2916)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3208)
> ... 9 more
> at
> org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1275)
> at
> org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:227)
> at
> org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336)
> at
> org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$BlockingStub.execService(ClientProtos.java:35542)
> at
> org.apache.hadoop.hbase.protobuf.ProtobufUtil.execService(ProtobufUtil.java:1702)
> ... 13 more
> 20/06/04 19:14:18 WARN client.HTable: Error calling coprocessor service
> org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService for
> row
> java.util.concurrent.ExecutionException:
> org.apache.hadoop.hbase.DoNotRetryIOException:
> org.apache.hadoop.hbase.DoNotRetryIOException: ERROR 2013 (INT15): ERROR 2013
> (INT15): MetadataEndpointImpl doGetTable called for table not present on
> region tableName=SYSTEM.CATALOG SYSTEM.CATALOG
> at
> org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:114)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3214)
> at
> org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:17268)
> at
> org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8338)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2170)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2152)
> at
> org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:35076)
> at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2394)
> at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)
> Caused by: java.sql.SQLException: ERROR 2013 (INT15): MetadataEndpointImpl
> doGetTable called for table not present on region tableName=SYSTEM.CATALOG
> at
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:575)
> at
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:195)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable(MetaDataEndpointImpl.java:2916)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3208)
> ... 9 more
> at java.util.concurrent.FutureTask.report(FutureTask.java:122)
> at java.util.concurrent.FutureTask.get(FutureTask.java:192)
> at
> org.apache.hadoop.hbase.client.HTable.coprocessorService(HTable.java:1775)
> at
> org.apache.hadoop.hbase.client.HTable.coprocessorService(HTable.java:1731)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.checkClientServerCompatibility(ConnectionQueryServicesImpl.java:1350)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:1239)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1576)
> at
> org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:2731)
> at
> org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1115)
> at
> org.apache.phoenix.compile.CreateTableCompiler$1.execute(CreateTableCompiler.java:192)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:410)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:393)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:392)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:380)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1810)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2623)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:2586)
> at
> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
> at
> org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:2586)
> at
> org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
> at
> org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:144)
> at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
> at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
> at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
> at sqlline.Commands.connect(Commands.java:1064)
> at sqlline.Commands.connect(Commands.java:996)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at
> sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
> at sqlline.SqlLine.dispatch(SqlLine.java:809)
> at sqlline.SqlLine.initArgs(SqlLine.java:588)
> at sqlline.SqlLine.begin(SqlLine.java:661)
> at sqlline.SqlLine.start(SqlLine.java:398)
> at sqlline.SqlLine.main(SqlLine.java:291)
> {noformat}
> RS logs for the region throwing the error:
> {noformat}
> 2020-06-04 19:14:18,655 ERROR
> [RpcServer.FifoWFPBQ.default.handler=29,queue=2,port=56704]
> coprocessor.MetaDataEndpointImpl: loading system catalog table inside
> getVersion failed
> java.sql.SQLException: ERROR 2013 (INT15): MetadataEndpointImpl doGetTable
> called for table not present on region tableName=SYSTEM.CATALOG
> at
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:575)
> at
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:195)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable(MetaDataEndpointImpl.java:2916)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3208)
> at
> org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:17268)
> at
> org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8338)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2170)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2152)
> at
> org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:35076)
> at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2394)
> at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)
> 2020-06-04 19:14:18,656 DEBUG
> [RpcServer.FifoWFPBQ.default.handler=29,queue=2,port=56704] ipc.RpcServer:
> RpcServer.FifoWFPBQ.default.handler=29,queue=2,port=56704: callId: 7 service:
> ClientService methodName: ExecService size: 131 connection: 10.3.4.181:57305
> org.apache.hadoop.hbase.DoNotRetryIOException: ERROR 2013 (INT15): ERROR 2013
> (INT15): MetadataEndpointImpl doGetTable called for table not present on
> region tableName=SYSTEM.CATALOG SYSTEM.CATALOG
> at
> org.apache.phoenix.util.ServerUtil.createIOException(ServerUtil.java:114)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3214)
> at
> org.apache.phoenix.coprocessor.generated.MetaDataProtos$MetaDataService.callMethod(MetaDataProtos.java:17268)
> at
> org.apache.hadoop.hbase.regionserver.HRegion.execService(HRegion.java:8338)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execServiceOnRegion(RSRpcServices.java:2170)
> at
> org.apache.hadoop.hbase.regionserver.RSRpcServices.execService(RSRpcServices.java:2152)
> at
> org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:35076)
> at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2394)
> at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:123)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:188)
> at
> org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:168)
> Caused by: java.sql.SQLException: ERROR 2013 (INT15): MetadataEndpointImpl
> doGetTable called for table not present on region tableName=SYSTEM.CATALOG
> at
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:575)
> at
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:195)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.doGetTable(MetaDataEndpointImpl.java:2916)
> at
> org.apache.phoenix.coprocessor.MetaDataEndpointImpl.getVersion(MetaDataEndpointImpl.java:3208)
> ... 9 more
> {noformat}
> The reason why this happens is that in a pre-4.15 client, inside
> CQSI.checkClientServerCompatibility, the getVersion method is invoked on
> MetaDataEndpointImpl over *all SYSTEM.CATALOG regions* (we pass in null for
> startKey and endKey), see
> [this|https://github.com/apache/phoenix/blob/e2993552dc88cb7fc59fc0dfdaa2876ac260886c/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java#L1350].
> Inside MetaDataEndpointImpl#getVersion, we [call
> doGetTable|https://github.com/apache/phoenix/blob/77c6cb32fce04b912b7c502dc170d86af8293fe6/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L3224]
> Now, if SYSTEM.CATALOG has split, this call will also be invoked on a region
> that does not contain the header row for SYSTEM.CATALOG causing it to fail in
> MetaDataEndpointImpl#doGetTable
> [here|https://github.com/apache/phoenix/blob/77c6cb32fce04b912b7c502dc170d86af8293fe6/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2928-L2933].
> This is avoided in 4.15+ clients since we have restricted the getVersion
> invocation to the region containing the header row for SYSTEM.CATALOG (see
> [this|https://github.com/apache/phoenix/blob/77c6cb32fce04b912b7c502dc170d86af8293fe6/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java#L1517]).
> We need to add a special condition to consider pre-4.15 clients before
> propagating the error back to clients inside MetaDataEndpointImpl.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)