Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

fix incorrect method getUseEarliestWhenDataLossAndRemoveKey #473

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public class PulsarOptions {
public static final String KEY_DISABLED_METRICS = "key-disable-metrics";
public static final String OLD_STATE_VERSION = "old-state-version";
public static final String FAIL_ON_DATA_LOSS_OPTION_KEY = "failOnDataLoss";
public static final String USE_EARLIEST_WHEN_DATA_LOSS_OPTION_KEY =
"use-earliest-when-data-loss";
public static final String USE_EARLIEST_WHEN_DATA_LOSS_OPTION_KEY = "useEarliestWhenDataLoss";
public static final String SEND_DELAY_MILLISECONDS = "send-delay-millisecond";

public static final String INSTRUCTION_FOR_FAIL_ON_DATA_LOSS_FALSE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,13 @@ public static boolean getFailOnDataLossAndRemoveKey(Map<String, Object> readerCo
}

public static boolean getUseEarliestWhenDataLossAndRemoveKey(Map<String, Object> readerConf) {
String failOnDataLossVal =
readerConf
.getOrDefault(PulsarOptions.USE_EARLIEST_WHEN_DATA_LOSS_OPTION_KEY, "false")
.toString();
String key = PulsarOptions.USE_EARLIEST_WHEN_DATA_LOSS_OPTION_KEY;
if (!readerConf.containsKey(key)) {
key = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, key);
}
String failOnDataLossVal = readerConf.getOrDefault(key, "false").toString();
final boolean value = Boolean.parseBoolean(failOnDataLossVal);
readerConf.remove(PulsarOptions.USE_EARLIEST_WHEN_DATA_LOSS_OPTION_KEY);
readerConf.remove(key);
return value;
}
}