sodonnel commented on a change in pull request #3194:
URL: https://github.com/apache/ozone/pull/3194#discussion_r826944617
##########
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:
For EC we are allocating in "ec block" chunks, which is always 256 * 5
(rs-3-2). We are not allocating in 256MB chunks. The code
`allocatedLocationInfoList.size()` should be returning the number of EC Block
groups allocated. Assuming it does, the calculation of pre-allocated size of
`allocatedLocationInfoList.size() * blockSize * 5` is correct I think?
In the table above, if the keysize is blockSize (256MB) then we should only
need to allocate a single EC block group - the client should never request
multiple blocks.
Assuming rs-3-2. The client requests an EC block, which on OM will
pre-allocate 256 * 5. The client fills this block with 256 * 3 MB of data + 2 *
256MB of parity. Then it requests another block. This block adds 256 * 5 to the
pre-allocated amount. In your table above, the current code should pre-allocate
only blockSize * 5 for all rows except the last, where it will allocate
`blockSize * 5 * 2`.
The change made, I don't think changes the original logic:
```
// New code
final long preAllocatedSpace = QuotaUtil.getReplicatedSize(
allocatedLocationInfoList.size() * ozoneManager.getScmBlockSize(),
omKeyInfo.getReplicationConfig());
omBucketInfo = getBucketInfo(omMetadataManager, volumeName,
bucketName);
long correctedSpace = omKeyInfo.getReplicatedSize() - preAllocatedSpace;
// Old Code
long correctedSpace = omKeyInfo.getReplicatedSize() -
allocatedLocationInfoList.size() * scmBlockSize * factor;
```
Inside quota Util, it will take the passed datasize and effectively multiple
by factor to get the replicated size, so it looks to me like the logic remains
the same?
--
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]