From 2876e102a6ac68ce8d0f60c16ee33aeeed530a9e Mon Sep 17 00:00:00 2001 From: Yabin Meng Date: Sat, 9 Oct 2021 12:29:22 -0500 Subject: [PATCH] Remove namespace and topic level dedup setting check for each run, which is too much overhead. --- .../driver/pulsar/ops/ReadyPulsarOp.java | 38 +++---------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/driver-pulsar/src/main/java/io/nosqlbench/driver/pulsar/ops/ReadyPulsarOp.java b/driver-pulsar/src/main/java/io/nosqlbench/driver/pulsar/ops/ReadyPulsarOp.java index 03c5bbdd3..8a49170a4 100644 --- a/driver-pulsar/src/main/java/io/nosqlbench/driver/pulsar/ops/ReadyPulsarOp.java +++ b/driver-pulsar/src/main/java/io/nosqlbench/driver/pulsar/ops/ReadyPulsarOp.java @@ -452,39 +452,11 @@ public class ReadyPulsarOp implements OpDispenser { LongFunction> transactionSupplierFunc = (l) -> clientSpace.getTransactionSupplier(); //TODO make it dependant on current cycle? - LongFunction topicMsgDedupFunc = (l) -> { - String topicName = topic_uri_func.apply(l); - String nsName = PulsarActivityUtil.getFullNamespaceName(topicName); - PulsarAdmin pulsarAdmin = pulsarActivity.getPulsarAdmin(); - - // Check namespace-level deduplication setting - // - default to broker level deduplication setting - // (as expressed in NB yaml file) - boolean topicMsgDedup = brokerMsgDupFunc.apply(l); - try { - Namespaces namespaces = pulsarAdmin.namespaces(); - if (namespaces != null) { - Boolean dedupStatus = namespaces.getDeduplicationStatus(nsName); - if (dedupStatus != null) topicMsgDedup = dedupStatus; - } - } catch (PulsarAdminException e) { - // it is fine if we're unable to check namespace level setting; use default - } - - // Check topic-level deduplication setting - try { - Topics topics = pulsarAdmin.topics(); - if (topics != null) { - Boolean dedupStatus = pulsarAdmin.topics().getDeduplicationStatus(topicName); - if (dedupStatus != null) topicMsgDedup = dedupStatus; - } - } catch (PulsarAdminException e) { - // it is fine if we're unable to check topic level setting; use default - } - - return topicMsgDedup; - }; - + // TODO: Ignore namespace and topic level dedup check on the fly + // this will impact the consumer performance significantly + // Consider using caching or Memoizer in the future? + // (https://www.baeldung.com/guava-memoizer) + LongFunction topicMsgDedupFunc = brokerMsgDupFunc; LongFunction> consumerFunc = (l) -> clientSpace.getConsumer(