zzzming commented on a change in pull request #6052: [PIP-54] Acknowledgement
for batch message local index
URL: https://github.com/apache/pulsar/pull/6052#discussion_r378891133
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
##########
@@ -2246,11 +2317,44 @@ public void deleteComplete(int rc, Object ctx) {
}
}
+ private List<MLDataFormats.BatchDeletedIndexInfo>
buildBatchDeletedIndexInfoList() {
+ lock.readLock().lock();
+ try {
+ if (!config.isBatchIndexDeleteEnabled() ||
batchDeletedIndexes.isEmpty()) {
+ return Collections.emptyList();
+ }
+ MLDataFormats.NestedPositionInfo.Builder nestedPositionBuilder =
MLDataFormats.NestedPositionInfo
+ .newBuilder();
+ MLDataFormats.BatchDeletedIndexInfo.Builder
batchDeletedIndexInfoBuilder = MLDataFormats.BatchDeletedIndexInfo
+ .newBuilder();
+ List<MLDataFormats.BatchDeletedIndexInfo> result =
Lists.newArrayList();
Review comment:
It seems that a large code section has been locked/unlocked. You might want
to consider to move these initialization outside of protect section.
Isn't ConcurrentSkipListMap already thread safe when you read? Probably only
the iteration should be protected. I think the goal is avoid lock a large
section of code not to let another thread to wait on.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services