jojochuang commented on code in PR #9332:
URL: https://github.com/apache/ozone/pull/9332#discussion_r2898524041
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -677,7 +677,7 @@ public void createBucket(
builder.setDefaultReplicationConfig(defaultReplicationConfig);
}
- String replicationType = defaultReplicationConfig == null
Review Comment:
unrelated checkstyle updates. I don't like but fine.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java:
##########
@@ -616,14 +616,23 @@ protected void validateAtomicRewrite(OmKeyInfo existing,
OmKeyInfo toCommit, Map
if (toCommit.getExpectedDataGeneration() != null) {
// These values are not passed in the request keyArgs, so add them into
the auditMap if they are present
// in the open key entry.
- auditMap.put(OzoneConsts.REWRITE_GENERATION,
String.valueOf(toCommit.getExpectedDataGeneration()));
- if (existing == null) {
- throw new OMException("Atomic rewrite is not allowed for a new key",
KEY_NOT_FOUND);
- }
- if
(!toCommit.getExpectedDataGeneration().equals(existing.getUpdateID())) {
- throw new OMException("Cannot commit as current generation (" +
existing.getUpdateID() +
- ") does not match the expected generation to rewrite (" +
toCommit.getExpectedDataGeneration() + ")",
- KEY_NOT_FOUND);
+ Long expectedGen = toCommit.getExpectedDataGeneration();
Review Comment:
what is the original purpose of this field?
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConsts.java:
##########
@@ -315,6 +315,7 @@ public final class OzoneConsts {
public static final String TENANT = "tenant";
public static final String USER_PREFIX = "userPrefix";
public static final String REWRITE_GENERATION = "rewriteGeneration";
+ public static final long EXPECTED_GEN_CREATE_IF_NOT_EXISTS = -1L;
Review Comment:
Generally speaking I don't like magic numbers.
Can we add a Javadoc comment here to describe it's for create-if-not-exists
semantics.
--
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]