Copilot commented on code in PR #8757:
URL: https://github.com/apache/ozone/pull/8757#discussion_r2193342951
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -750,12 +752,23 @@ public PendingKeysDeletion getPendingDeletionKeys(
.map(b -> new BlockID(b.getContainerID(),
b.getLocalID()))).collect(Collectors.toList());
BlockGroup keyBlocks =
BlockGroup.newBuilder().setKeyName(kv.getKey())
.addAllBlockIDs(blockIDS).build();
+ serializedSize += keyBlocks.getProto().getSerializedSize();
Review Comment:
[nitpick] Calling `getProto().getSerializedSize()` repeatedly may allocate
temporary objects and impact performance. Consider computing or caching the
serialized size without creating new protobuf messages on each iteration.
```suggestion
int keyBlockSerializedSize =
keyBlocks.getProto().getSerializedSize();
serializedSize += keyBlockSerializedSize;
```
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyDeletingService.java:
##########
@@ -104,6 +106,12 @@ public KeyDeletingService(OzoneManager ozoneManager,
this.deepCleanSnapshots = deepCleanSnapshots;
this.snapshotChainManager =
((OmMetadataManagerImpl)ozoneManager.getMetadataManager()).getSnapshotChainManager();
this.scmClient = scmClient;
+ int limit = (int) ozoneManager.getConfiguration().getStorageSize(
+ OMConfigKeys.OZONE_OM_RATIS_LOG_APPENDER_QUEUE_BYTE_LIMIT,
+ OMConfigKeys.OZONE_OM_RATIS_LOG_APPENDER_QUEUE_BYTE_LIMIT_DEFAULT,
+ StorageUnit.BYTES);
+ // always go to 90% of max limit for request as other header will be added
+ this.ratisByteLimit = (int) (limit * 0.9);
Review Comment:
[nitpick] The literal `0.9` is a magic number. Consider extracting it to a
named constant (e.g., `RATIS_LIMIT_FACTOR`) for clarity and easier maintenance.
```suggestion
this.ratisByteLimit = (int) (limit * RATIS_LIMIT_FACTOR);
```
--
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]