ChinmaySKulkarni 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_r385404067
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java
##########
@@ -132,12 +163,21 @@ 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(serverVersion);
+ if (VersionUtil.encodeMinPatchVersion(clientMajorVersion,
clientMinorVersion) > serverVersion) {
+ compatibility.setCompatible(false);
+
compatibility.setErrorCode(SQLExceptionCode.OUTDATED_JARS.getErrorCode());
+ } else if (VersionUtil.encodeMaxMinorVersion(clientMajorVersion) <
serverVersion) {
+ compatibility.setCompatible(false);
+
compatibility.setErrorCode(SQLExceptionCode.INCOMPATIBLE_CLIENT_SERVER_JAR.getErrorCode());
+ }
+ return compatibility; // Major version must at least be up to server
version
Review comment:
nit: Move this comment back to where it was near the if condition
----------------------------------------------------------------
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