christinefeng commented on a change in pull request #676: PHOENIX-5636: Improve
the error message when client connects to server with higher major version
URL: https://github.com/apache/phoenix/pull/676#discussion_r385445077
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
##########
@@ -132,12 +160,22 @@ public static boolean areClientAndServerCompatible(long
serverHBaseAndPhoenixVer
}
// Default scope for testing
- static boolean areClientAndServerCompatible(int serverVersion, int
clientMajorVersion, int clientMinorVersion) {
+ @VisibleForTesting
+ static ClientServerCompatibility areClientAndServerCompatible(int
serverVersion, int clientMajorVersion, int clientMinorVersion) {
// A server and client with the same major and minor version number
must be compatible.
// So it's important that we roll the PHOENIX_MAJOR_VERSION or
PHOENIX_MINOR_VERSION
// when we make an incompatible change.
- return VersionUtil.encodeMinPatchVersion(clientMajorVersion,
clientMinorVersion) <= serverVersion && // Minor major and minor cannot be
ahead of server
- VersionUtil.encodeMaxMinorVersion(clientMajorVersion) >=
serverVersion; // Major version must at least be up to server version
+ ClientServerCompatibility compatibility = new
ClientServerCompatibility();
+ if (VersionUtil.encodeMinPatchVersion(clientMajorVersion,
clientMinorVersion) > serverVersion) { // Client major and minor cannot be
ahead of server
+
compatibility.setErrorCode(SQLExceptionCode.OUTDATED_JARS.getErrorCode());
+ return compatibility;
+ } else if (VersionUtil.encodeMaxMinorVersion(clientMajorVersion) <
serverVersion) { // Client major version must at least be up to server major
version
+
compatibility.setErrorCode(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR.getErrorCode());
+ return compatibility;
Review comment:
makes sense !
----------------------------------------------------------------
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]
With regards,
Apache Git Services