[ 
https://issues.apache.org/jira/browse/PHOENIX-6500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17371916#comment-17371916
 ] 

ASF GitHub Bot commented on PHOENIX-6500:
-----------------------------------------

virajjasani commented on a change in pull request #1257:
URL: https://github.com/apache/phoenix/pull/1257#discussion_r661283739



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
##########
@@ -100,6 +101,11 @@
 
     public static final byte[] DATA_TABLE_NAME_PROP_BYTES = 
Bytes.toBytes(DATA_TABLE_NAME_PROP_NAME);
 
+    private static final Map<MajorMinorVersion, MajorMinorVersion> 
ALLOWED_SERVER_CLIENT_MAJOR_VERSION =
+            ImmutableMap.of(
+                    new MajorMinorVersion(5, 1), new MajorMinorVersion(4, 16)

Review comment:
       Basically we have these validations:
   1. Client major and minor cannot be ahead of server
   2. Client major version must at least be up to server major version
   
   What we are doing here is relaxing validation no 2. If we already know of 
client with old major version (4.x) being compatible to server with new major 
version (5.x), then we can relax major compatibility restriction (rule no 2) by 
adding such specific major/minor versions in this map.
   In future, if we release 4.17 and we are aware that 4.17 client is backward 
compatible with 5.1 and 5.2 servers, we can add new entires in this map:
   ```
   new MajorMinorVersion(5, 1), new MajorMinorVersion(4, 17)  => 4.17 client 
can connect to 5.1 server
   new MajorMinorVersion(5, 2), new MajorMinorVersion(4, 17)  => 4.17 client 
can connect to 5.2 server
   new MajorMinorVersion(5, 2), new MajorMinorVersion(4, 16)  => 4.16 client 
can connect to 5.2 server
   ```
   
   Without updating above entires, 4.17 client would not be able to connect to 
any 5.x server because rule no 2 (mentioned above) will fail this with:
   ```
   java.sql.SQLException: ERROR 2006 (INT08): Incompatible jars detected 
between client and server. Major version of client is less than that of the 
server. Client version: 4.17.0; Server version: 5.1.0
   ```
   
   > This 4.16 client might run against a 4.14 server before upgrade, or a 4.15 
server before upgrade?
   
   This might never need to be supported unless I am missing something. So 
let's say we are running 4.14 client and server, now we upgrade server to 4.15 
and client remains at 4.14, we are good. Instead of upgrading client, we again 
decide to upgrade server to 4.16, and we are still good because 4.14 client can 
connect to 4.16 server.
   Before we upgrade server to 5.1, we will want to bring client to 4.16 so 
that 4.16 client can connect to 5.1 server.
   However, in this entire case, we never need 4.16 client to run against 
4.14/4.15 server. Correct?




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Allow 4.16 client to connect to 5.1 server
> ------------------------------------------
>
>                 Key: PHOENIX-6500
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6500
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Viraj Jasani
>            Assignee: Viraj Jasani
>            Priority: Major
>             Fix For: 4.17.0, 5.2.0, 4.16.2, 5.1.3
>
>
> When 4.16 client tries to connect to 5.1 server, we disallow it based on our 
> major version validation b/ old client and new server:
> {code:java}
> Error: ERROR 2006 (INT08): Incompatible jars detected between client and 
> server. Major version of client is less than that of the server. Client 
> version: 4.16.0; Server version: 5.1.0 (state=INT08,code=2006)
> java.sql.SQLException: ERROR 2006 (INT08): Incompatible jars detected between 
> client and server. Major version of client is less than that of the server. 
> Client version: 4.16.0; Server version: 5.1.0
>         at 
> org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:608)
>         at 
> org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:217)
>         at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.checkClientServerCompatibility(ConnectionQueryServicesImpl.java:1686)
>         at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.ensureTableCreated(ConnectionQueryServicesImpl.java:1425)
>         at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.createTable(ConnectionQueryServicesImpl.java:1901)
>         at 
> org.apache.phoenix.schema.MetaDataClient.createTableInternal(MetaDataClient.java:3074)
>         at 
> org.apache.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:1105)
>         at 
> org.apache.phoenix.compile.CreateTableCompiler$CreateTableMutationPlan.execute(CreateTableCompiler.java:421)
>         at 
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:413)
>         at 
> org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:395)
>         at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
>         at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:394)
>         at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:382)
>         at 
> org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1865)
>         at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:3245)
>         at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:3208)
>         at 
> org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:76)
>         at 
> org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:3208)
>         at 
> org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:255)
>         at 
> org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.createConnection(PhoenixEmbeddedDriver.java:142)
>         at 
> org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:221)
>         at sqlline.DatabaseConnection.connect(DatabaseConnection.java:154)
>         at 
> sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:202)
>         at sqlline.Commands.connect(Commands.java:1165)
>         at sqlline.Commands.connect(Commands.java:1055)
>         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)
> {code}
> Until PHOENIX-6499 is implemented, we should create a map to whitelist 
> specific major/minor version of old client to connect with new server.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to