Skip to content
Open
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 @@ -227,16 +227,19 @@ public void addListener(final LocalTieredStorageListener listener) {
this.storageListeners.add(listener);
}

private Integer nodeId(final Map<String, ?> configs) {
private int nodeId(final Map<String, ?> configs) {
final Integer nodeId = (Integer) configs.get(NODE_ID);
if (nodeId != null) {
return nodeId;
}
final Integer brokerId = (Integer) configs.get(BROKER_ID);
if (brokerId != null) {
logger.warn("The '{}' config is deprecated and will no longer be read in Apache Kafka 5.0. Please use '{}' instead.",
BROKER_ID, NODE_ID);
if (brokerId == null) {
throw new InvalidConfigurationException(format(
"Both %s and %s configs are missing. Please configure %s to use the LocalTieredStorage manager.",
NODE_ID, BROKER_ID, NODE_ID));
}
logger.warn("The '{}' config is deprecated and will no longer be read in Apache Kafka 5.0. Please use '{}' instead.",
BROKER_ID, NODE_ID);
return brokerId;
}

Expand All @@ -252,15 +255,8 @@ public void configure(Map<String, ?> configs) {
final String shouldDeleteOnClose = (String) configs.get(DELETE_ON_CLOSE_CONFIG);
final String transfererClass = (String) configs.get(TRANSFERER_CLASS_CONFIG);
final String isDeleteEnabled = (String) configs.get(ENABLE_DELETE_API_CONFIG);
final Integer nodeIdInt = nodeId(configs);

if (nodeIdInt == null) {
throw new InvalidConfigurationException(format(
"Both %s and %s configs are missing. Please configure %s to use the LocalTieredStorage manager.",
NODE_ID, BROKER_ID, NODE_ID));
}

brokerId = nodeIdInt;
brokerId = nodeId(configs);
logger = new LogContext(format("[LocalTieredStorage Id=%d] ", brokerId)).logger(this.getClass());

if (shouldDeleteOnClose != null) {
Expand Down
Loading