peterxcli commented on code in PR #10023:
URL: https://github.com/apache/ozone/pull/10023#discussion_r3032120657


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCreateRequest.java:
##########
@@ -497,20 +498,34 @@ protected void validateAtomicRewrite(OmKeyInfo dbKeyInfo, 
KeyArgs keyArgs)
       }
     }
 
-    if (keyArgs.hasExpectedETag()) {
-      String expectedETag = keyArgs.getExpectedETag();
-      if (dbKeyInfo == null) {
-        throw new OMException("Key not found for If-Match",
-            OMException.ResultCodes.KEY_NOT_FOUND);
-      }
-      if (!dbKeyInfo.hasEtag()) {
-        throw new OMException("Key does not have an ETag",
-            OMException.ResultCodes.ETAG_NOT_AVAILABLE);
-      }
-      if (!dbKeyInfo.isEtagEquals(expectedETag)) {
-        throw new OMException("ETag mismatch",
-            OMException.ResultCodes.ETAG_MISMATCH);
-      }
+  }

Review Comment:
   @ivandika3 The only affection I can come up is: the AWS one would have ABA 
problem(if they don't reject the duplicate conditional put), but our version is 
more like [Tagged 
Pointers](https://en.wikipedia.org/wiki/ABA_problem#Workarounds), which can 
prevent the ABA scenario to happen. So, others unchanged, only concurrent and 
duplicate or ABA type request gain safer guarantee.
   
   @ivandika3 The only thing I can think of is that the AWS behavior can suffer 
from the ABA problem if duplicate conditional PutObject requests are not 
rejected. In contrast, our version behaves more like a [tagged 
pointer](https://en.wikipedia.org/wiki/ABA_problem#Workarounds), which prevents 
the ABA scenario. So everything else stays the same; only concurrent duplicate 
or ABA-style requests gain a stronger safety guarantee.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCreateRequest.java:
##########
@@ -497,20 +498,34 @@ protected void validateAtomicRewrite(OmKeyInfo dbKeyInfo, 
KeyArgs keyArgs)
       }
     }
 
-    if (keyArgs.hasExpectedETag()) {
-      String expectedETag = keyArgs.getExpectedETag();
-      if (dbKeyInfo == null) {
-        throw new OMException("Key not found for If-Match",
-            OMException.ResultCodes.KEY_NOT_FOUND);
-      }
-      if (!dbKeyInfo.hasEtag()) {
-        throw new OMException("Key does not have an ETag",
-            OMException.ResultCodes.ETAG_NOT_AVAILABLE);
-      }
-      if (!dbKeyInfo.isEtagEquals(expectedETag)) {
-        throw new OMException("ETag mismatch",
-            OMException.ResultCodes.ETAG_MISMATCH);
-      }
+  }

Review Comment:
   @ivandika3 The only thing I can think of is that the AWS behavior can suffer 
from the ABA problem if duplicate conditional PutObject requests are not 
rejected. In contrast, our version behaves more like a [tagged 
pointer](https://en.wikipedia.org/wiki/ABA_problem#Workarounds), which prevents 
the ABA scenario. So everything else stays the same; only concurrent duplicate 
or ABA-style requests gain a stronger safety guarantee.



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