kaijchen commented on a change in pull request #3194:
URL: https://github.com/apache/ozone/pull/3194#discussion_r826917339
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java
##########
@@ -234,15 +235,15 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
keysToDelete, trxnLogIndex);
}
- long scmBlockSize = ozoneManager.getScmBlockSize();
- int factor = omKeyInfo.getReplicationConfig().getRequiredNodes();
+ final long preAllocatedSpace = QuotaUtil.getReplicatedSize(
+ allocatedLocationInfoList.size() * ozoneManager.getScmBlockSize(),
+ omKeyInfo.getReplicationConfig());
omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
// Block was pre-requested and UsedBytes updated when createKey and
// AllocatedBlock. The space occupied by the Key shall be based on
// the actual Key size, and the total Block size applied before should
// be subtracted.
- long correctedSpace = omKeyInfo.getReplicatedSize() -
- allocatedLocationInfoList.size() * scmBlockSize * factor;
+ long correctedSpace = omKeyInfo.getReplicatedSize() - preAllocatedSpace;
Review comment:
> where for rs-3-2, the calculation is `1_block * 5 * 256mb` as that is
how much space we reserve assuming the blocks will be filled and including the
replication overhead.
OK, I got it. The minimum allocation unit in each container is `1_block`,
which is `256MB` by default.
The patch above is wrong. But there are still issues in the original code.
Assume the config is `rs-3-2-1024k` and `blockSize = 256 MB`.
| KeySize | PreAllocateSpace (Expected) | PreAllocateSpace (Current) |
| --- | --- | --- |
| 1 MB | 256 MB * 5 | 256 MB * 5 |
| 257 MB | 256 MB * 5 | 256 MB * 5 * 2 |
| 513 MB | 256 MB * 5 | 256 MB * 5 * 3 |
| 769 MB | 256 MB * 5 * 2 | 256 MB * 5 * 4 |
--
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]