This is an automated email from the ASF dual-hosted git repository.
zhaocong pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new b7ffa73f2d8 [improve][broker] Optimize high CPU usage when consuming
from topics with ongoing txn (#23189)
b7ffa73f2d8 is described below
commit b7ffa73f2d8a528e956f5ba685dd5685545c6e91
Author: Cong Zhao <[email protected]>
AuthorDate: Tue Aug 20 23:32:22 2024 +0800
[improve][broker] Optimize high CPU usage when consuming from topics with
ongoing txn (#23189)
(cherry picked from commit 94e1341d1e299bc93b809fc3046b70390de43592)
---
.../main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
index 5d9e8da37b2..9fc69924242 100644
---
a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
+++
b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
@@ -942,7 +942,7 @@ public class ManagedCursorImpl implements ManagedCursor {
int numberOfEntriesToRead = applyMaxSizeCap(maxEntries, maxSizeBytes);
- if (hasMoreEntries()) {
+ if (hasMoreEntries() && maxPosition.compareTo(readPosition) >= 0) {
// If we have available entries, we can read them immediately
if (log.isDebugEnabled()) {
log.debug("[{}] [{}] Read entries immediately",
ledger.getName(), name);