mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Address Shooky's comment in PR#364.
This commit is contained in:
parent
cdfb7c3224
commit
11073cf0aa
@ -11,7 +11,10 @@ import org.apache.commons.lang3.BooleanUtils;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.pulsar.client.admin.Namespaces;
|
||||||
import org.apache.pulsar.client.admin.PulsarAdmin;
|
import org.apache.pulsar.client.admin.PulsarAdmin;
|
||||||
|
import org.apache.pulsar.client.admin.PulsarAdminException;
|
||||||
|
import org.apache.pulsar.client.admin.Topics;
|
||||||
import org.apache.pulsar.client.api.Producer;
|
import org.apache.pulsar.client.api.Producer;
|
||||||
import org.apache.pulsar.client.api.Consumer;
|
import org.apache.pulsar.client.api.Consumer;
|
||||||
import org.apache.pulsar.client.api.Reader;
|
import org.apache.pulsar.client.api.Reader;
|
||||||
@ -450,29 +453,32 @@ public class ReadyPulsarOp implements OpDispenser<PulsarOp> {
|
|||||||
(l) -> clientSpace.getTransactionSupplier(); //TODO make it dependant on current cycle?
|
(l) -> clientSpace.getTransactionSupplier(); //TODO make it dependant on current cycle?
|
||||||
|
|
||||||
LongFunction<Boolean> topicMsgDedupFunc = (l) -> {
|
LongFunction<Boolean> topicMsgDedupFunc = (l) -> {
|
||||||
String topic = topic_uri_func.apply(l);
|
String topicName = topic_uri_func.apply(l);
|
||||||
String namespace = PulsarActivityUtil.getFullNamespaceName(topic);
|
String nsName = PulsarActivityUtil.getFullNamespaceName(topicName);
|
||||||
PulsarAdmin pulsarAdmin = pulsarActivity.getPulsarAdmin();
|
PulsarAdmin pulsarAdmin = pulsarActivity.getPulsarAdmin();
|
||||||
|
|
||||||
// Check namespace-level deduplication setting
|
// Check namespace-level deduplication setting
|
||||||
// - default to broker level deduplication setting
|
// - default to broker level deduplication setting
|
||||||
boolean nsMsgDedup = brokerMsgDupFunc.apply(l);
|
// (as expressed in NB yaml file)
|
||||||
|
boolean topicMsgDedup = brokerMsgDupFunc.apply(l);
|
||||||
try {
|
try {
|
||||||
Boolean dedupStatus = pulsarAdmin.namespaces().getDeduplicationStatus(namespace);
|
Namespaces namespaces = pulsarAdmin.namespaces();
|
||||||
if (dedupStatus != null) nsMsgDedup = dedupStatus;
|
if (namespaces != null) {
|
||||||
}
|
Boolean dedupStatus = namespaces.getDeduplicationStatus(nsName);
|
||||||
catch (Exception e) {
|
if (dedupStatus != null) topicMsgDedup = dedupStatus;
|
||||||
|
}
|
||||||
|
} catch (PulsarAdminException e) {
|
||||||
// it is fine if we're unable to check namespace level setting; use default
|
// it is fine if we're unable to check namespace level setting; use default
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check topic-level deduplication setting
|
// Check topic-level deduplication setting
|
||||||
// - default to namespace level deduplication setting
|
|
||||||
boolean topicMsgDedup = nsMsgDedup;
|
|
||||||
try {
|
try {
|
||||||
Boolean dedupStatus = pulsarAdmin.topics().getDeduplicationStatus(namespace);
|
Topics topics = pulsarAdmin.topics();
|
||||||
if (dedupStatus != null) topicMsgDedup = dedupStatus;
|
if (topics != null) {
|
||||||
}
|
Boolean dedupStatus = pulsarAdmin.topics().getDeduplicationStatus(topicName);
|
||||||
catch (Exception e) {
|
if (dedupStatus != null) topicMsgDedup = dedupStatus;
|
||||||
|
}
|
||||||
|
} catch (PulsarAdminException e) {
|
||||||
// it is fine if we're unable to check topic level setting; use default
|
// it is fine if we're unable to check topic level setting; use default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user