adoroszlai commented on a change in pull request #3031:
URL: https://github.com/apache/ozone/pull/3031#discussion_r807292085
##########
File path:
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/ClientVersions.java
##########
@@ -28,8 +28,27 @@
// DatanodeDetails#getFromProtobuf handles unknown types of ports
public static final int VERSION_HANDLES_UNKNOWN_DN_PORTS = 1;
+ // TODO: Change the version of FSO/EC if one is released before the other.
+ // Client supports EC objects
+ public static final int CLIENT_EC_CAPABLE = 2;
+ // Client supports FSO buckets
+ public static final int CLIENT_FSO_CAPABLE = CLIENT_EC_CAPABLE;
+
// this should always point to the latest version
- public static final int CURRENT_VERSION = VERSION_HANDLES_UNKNOWN_DN_PORTS;
+ public static final int CURRENT_VERSION = CLIENT_EC_CAPABLE;
+
+ /**
+ * Validates if the client version is equal to or newer than the expected
+ * version supported. Client are expected to be backward compatible if it
+ * is sending a request.
+ * @param desiredClientVersion Minimum version of the client expected.
+ * @param actualClientVersion Version of the client witnessed.
+ * @return true if client is at or newer than the desired version.
+ */
+ public static boolean isClientCompatible(int desiredClientVersion,
+ int actualClientVersion) {
+ return desiredClientVersion >= actualClientVersion;
Review comment:
To confirm this problem, try:
1. Increase `CURRENT_VERSION` to 4 (i.e. simulate the situation where we add
a new feature and increment current version)
2. Set log level of `OMManagerClientVersionValidations` to DEBUG
```
om_1 | 2022-02-10 19:03:36,205 [IPC Server handler 0 on default port
9862] DEBUG protocolPB.OMManagerClientVersionValidations: Request rejected as
client version is not EC Compatible: cmdType: InfoBucket
om_1 | traceID: ""
om_1 | clientId: "client-585C0CCB3EA6"
om_1 | version: 4
om_1 | infoBucketRequest {
om_1 | volumeName: "vol1"
om_1 | bucketName: "bucket1"
om_1 | }
om_1 |
...
om_1 | 2022-02-10 19:04:11,472 [IPC Server handler 5 on default port
9862] DEBUG protocolPB.OMManagerClientVersionValidations: Request rejected as
client version is not FSO Compatible: cmdType: LookupKey
om_1 | traceID: ""
om_1 | clientId: "client-55BD1FDBB8B5"
om_1 | version: 4
om_1 | lookupKeyRequest {
om_1 | keyArgs {
om_1 | volumeName: "vol1"
om_1 | bucketName: "bucket1"
om_1 | keyName: "etc/passwd"
om_1 | dataSize: 0
om_1 | sortDatanodes: false
om_1 | latestVersionLocation: true
om_1 | headOp: false
om_1 | }
om_1 | }
```
Notice that client is `version: 4`, but is "rejected".
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]