rakeshadr commented on a change in pull request #3031: URL: https://github.com/apache/ozone/pull/3031#discussion_r797234348
########## File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OMProtocolVersion.java ########## @@ -0,0 +1,64 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.hadoop.ozone; + +import org.apache.hadoop.util.ComparableVersion; + +/** + * Versioning for OM's APIs used by ozone clients. + */ +public final class OMProtocolVersion { + + // OM Authenticates the user using the S3 Auth info embedded in request proto. + public static final String OM_SUPPORTS_S3AUTH_VIA_PROTO = "2.0.0"; + public static final String OM_SUPPORTS_EC = "2.1.0"; + public static final String OM_SUPPORTS_OFS = "2.1.0"; Review comment: Typo: `OM_SUPPORTS_OFS` -> `OM_SUPPORTS_FSO` ########## 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 EC objects Review comment: Typo: `Client supports EC objects` -> `Client supports FSO buckets` ########## File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OMManagerClientVersionValidations.java ########## @@ -0,0 +1,60 @@ +/* + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.hadoop.ozone.protocolPB; + +import org.apache.hadoop.ozone.ClientVersions; +import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos; + +/** + * OMManagerClientVersionValidations is a collection of validations to run for + * OM RPC calls and Client version compatibility. + */ +public final class OMManagerClientVersionValidations { + private OMManagerClientVersionValidations() { + + } + + public static void validateClientVersionPostProcess( + OzoneManagerProtocolProtos.Type lookupKey, + OzoneManagerProtocolProtos.OMRequest request, + OzoneManagerProtocolProtos.InfoBucketResponse infoBucketResponse) { + // ToDo: Add EC specific rejection of request based on key info. + if (request.hasVersion() + && + ClientVersions.isClientCompatible( + ClientVersions.CLIENT_EC_CAPABLE, + request.getVersion())){ + return; + } + } + public static void validateClientVersionPostProcess( + OzoneManagerProtocolProtos.Type lookupKey, + OzoneManagerProtocolProtos.OMRequest request, + OzoneManagerProtocolProtos.LookupKeyResponse lookupKeyResponse) { + // ToDo: Add FSO specific rejection of request based on bucket info. Review comment: FSO client version validation is required during pre-process stage of request handling. **Expected behavior of pre-FSO client** : Only a new client can talk to FSO bucket. The proposed idea is to to disallow any operations(read/list/delete/rename/update) on a FILE_SYSTEM_OPTIMIZED("FSO") bucket by a pre-FSO client(old version client). Need to add logic to throw exception when a pre-FSO client tries to access FSO bucket. Can we add `validateClientVersionPreProcess()` function and invoke it in a single place(common) instead of repeating for each request type inside switch case, where it can do client version matching ? -- 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]
