anuragp010 commented on code in PR #12080:
URL: https://github.com/apache/ozone/pull/12080#discussion_r4662255776


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1262,6 +1269,9 @@ public void setBucketStoragePolicy(OmBucketArgs args) 
throws IOException {
     Objects.requireNonNull(args, "args == null");
     verifyVolumeName(args.getVolumeName());
     verifyBucketName(args.getBucketName());
+    if (!OzoneManagerVersion.STORAGE_POLICY_SUPPORT.isSupportedBy(omVersion)) {

Review Comment:
   Thanks for this suggestion. I kept it broad on purpose, and I'd like your 
view on whether that is right.
   
   `RpcClient.setBucketStoragePolicy(OmBucketArgs)` is a storage-policy API: 
its only caller is `OzoneBucket.setStoragePolicyProperty`, and the shell calls 
that only when `--storage-policy` or `--allow-fallback-storage-policy` is 
given. So I treated a call to this method as an intent to change storage 
policy, and wanted to fail fast on an old OM.
   
   I checked what the OM does with all-null args. The OM validator does not 
reject it (no policy field is set). In 
`OMBucketSetPropertyRequest.validateAndUpdateCache` no branch runs, but the 
request still takes the bucket write lock, bumps `updateID` and 
`modificationTime`, and returns OK. So a narrow check would let an empty 
`setBucketStoragePolicy` call turn into a silent no-op write on an old OM, 
while the method name says it sets a policy.
   
   Do you see a case where a caller reaches this method with no policy field 
and still expects it to succeed on an old OM? If so I will narrow the check as 
you suggest and keep a test for the empty-args case. If not, are you OK with 
keeping the check as is?



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

Reply via email to