This is an automated email from the ASF dual-hosted git repository.
zhaocong pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new 4289cfc213c [improve][broker] Optimize high CPU usage when consuming
from topics with ongoing txn (#23189)
4289cfc213c is described below
commit 4289cfc213c1058e902f6678d90f73548c21be5c
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 a1dd1198edb..a8096a08e2f 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
@@ -950,7 +950,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);