Skip to content

Commit

Permalink
HDDS-10719. Avoid empty ETag for key created outside of S3 (apache#6563)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Apr 21, 2024
1 parent bf1f644 commit 96fc70e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import java.util.Objects;

import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hdds.client.ECReplicationConfig;
import org.apache.hadoop.hdds.client.ReplicationConfig;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.BasicKeyInfo;
Expand Down Expand Up @@ -51,7 +52,7 @@ private BasicOmKeyInfo(Builder b) {
this.modificationTime = b.modificationTime;
this.replicationConfig = b.replicationConfig;
this.isFile = b.isFile;
this.eTag = b.eTag;
this.eTag = StringUtils.isNotEmpty(b.eTag) ? b.eTag : null;
}

private BasicOmKeyInfo(OmKeyInfo b) {
Expand Down Expand Up @@ -179,7 +180,7 @@ public BasicKeyInfo getProtobuf() {
} else {
builder.setFactor(ReplicationConfig.getLegacyFactor(replicationConfig));
}
if (eTag != null) {
if (StringUtils.isNotEmpty(eTag)) {
builder.setETag(eTag);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ Test key handling
Should Not Contain ${result} NOTICE.txt.1 exists
${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | jq -r '. | select(.name=="key1")'
Should contain ${result} creationTime
Should not contain ${result} ETag
${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | jq -r '.[] | select(.name=="key1") | .name'
Should Be Equal ${result} key1
Execute ozone sh key rename ${protocol}${server}/${volume}/bb1 key1 key2
Expand Down

0 comments on commit 96fc70e

Please sign in to comment.