This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new c0f89dc981f [improve][broker] Use shrink map for trackerCache (#19534)
c0f89dc981f is described below
commit c0f89dc981fbe36be834303f13bd09f3b62b3d67
Author: xiaolong ran <[email protected]>
AuthorDate: Thu Feb 16 23:18:11 2023 +0800
[improve][broker] Use shrink map for trackerCache (#19534)
Signed-off-by: xiaolongran <[email protected]>
---
.../pulsar/broker/service/InMemoryRedeliveryTracker.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/InMemoryRedeliveryTracker.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/InMemoryRedeliveryTracker.java
index df999ab139d..8c992d2f7a9 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/InMemoryRedeliveryTracker.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/InMemoryRedeliveryTracker.java
@@ -21,12 +21,16 @@ package org.apache.pulsar.broker.service;
import java.util.List;
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.impl.PositionImpl;
-import org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap;
-import
org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap.LongPair;
+import org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap;
+import
org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap.LongPair;
public class InMemoryRedeliveryTracker implements RedeliveryTracker {
- private ConcurrentLongLongPairHashMap trackerCache = new
ConcurrentLongLongPairHashMap(256, 1);
+ private ConcurrentLongLongPairHashMap trackerCache =
ConcurrentLongLongPairHashMap.newBuilder()
+ .concurrencyLevel(1)
+ .expectedItems(256)
+ .autoShrink(true)
+ .build();
@Override
public int incrementAndGetRedeliveryCount(Position position) {