Skip to content

Commit

Permalink
Revert accidental commit of isPreviousCommitHsync from Sumit's patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
smengcl committed Aug 10, 2023
1 parent ba12c68 commit f365093
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.WithMetadata;
import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerDoubleBufferHelper;
import org.apache.hadoop.ozone.om.request.util.OmResponseUtil;
import org.apache.hadoop.ozone.om.request.validation.RequestFeatureValidator;
Expand Down Expand Up @@ -221,18 +220,9 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
throw new OMException("Failed to " + action + " key, as " + dbOpenKey +
"entry is not found in the OpenKey table", KEY_NOT_FOUND);
}
boolean isPreviousCommitHsync = false;
if (isHSync) {
omKeyInfo.getMetadata().put(OzoneConsts.HSYNC_CLIENT_ID,
String.valueOf(commitKeyRequest.getClientID()));
} else {
final String clientIdString
= String.valueOf(commitKeyRequest.getClientID());
isPreviousCommitHsync = java.util.Optional.ofNullable(omKeyInfo)
.map(WithMetadata::getMetadata)
.map(meta -> meta.get(OzoneConsts.HSYNC_CLIENT_ID))
.filter(id -> id.equals(clientIdString))
.isPresent();
}
omKeyInfo.setDataSize(commitKeyArgs.getDataSize());
omKeyInfo.setModificationTime(commitKeyArgs.getModificationTime());
Expand All @@ -247,7 +237,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
long correctedSpace = omKeyInfo.getReplicatedSize();
// if keyToDelete isn't null, usedNamespace needn't check and
// increase.
if (keyToDelete != null && (isHSync || isPreviousCommitHsync)) {
if (keyToDelete != null && isHSync) {
correctedSpace -= keyToDelete.getReplicatedSize();
checkBucketQuotaInBytes(omMetadataManager, omBucketInfo,
correctedSpace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.apache.hadoop.ozone.om.helpers.OmKeyLocationInfo;
import org.apache.hadoop.ozone.om.helpers.OzoneFSUtils;
import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.WithMetadata;
import org.apache.hadoop.ozone.om.ratis.utils.OzoneManagerDoubleBufferHelper;
import org.apache.hadoop.ozone.om.request.file.OMFileRequest;
import org.apache.hadoop.ozone.om.request.util.OmResponseUtil;
Expand Down Expand Up @@ -162,18 +161,9 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
dbOpenFileKey + "entry is not found in the OpenKey table",
KEY_NOT_FOUND);
}
boolean isPreviousCommitHsync = false;
if (isHSync) {
omKeyInfo.getMetadata().put(OzoneConsts.HSYNC_CLIENT_ID,
String.valueOf(commitKeyRequest.getClientID()));
} else {
final String clientIdString
= String.valueOf(commitKeyRequest.getClientID());
isPreviousCommitHsync = java.util.Optional.ofNullable(omKeyInfo)
.map(WithMetadata::getMetadata)
.map(meta -> meta.get(OzoneConsts.HSYNC_CLIENT_ID))
.filter(id -> id.equals(clientIdString))
.isPresent();
}

omKeyInfo.setDataSize(commitKeyArgs.getDataSize());
Expand All @@ -198,7 +188,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,

// if keyToDelete isn't null, usedNamespace shouldn't check and
// increase.
if (keyToDelete != null && (isHSync || isPreviousCommitHsync)) {
if (keyToDelete != null && isHSync) {
correctedSpace -= keyToDelete.getReplicatedSize();
checkBucketQuotaInBytes(omMetadataManager, omBucketInfo,
correctedSpace);
Expand Down

0 comments on commit f365093

Please sign in to comment.