Skip to content

Commit

Permalink
revert print log issue code
Browse files Browse the repository at this point in the history
  • Loading branch information
m1a2st committed Oct 17, 2024
1 parent a03d614 commit 07a7a7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.utils.Utils;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
Expand All @@ -62,12 +61,7 @@ public class ConsumerConfig extends AbstractConfig {
// a list contains all the assignor names that only assign subscribed topics to consumer. Should be updated when new assignor added.
// This is to help optimize ConsumerCoordinator#performAssignment method
public static final List<String> ASSIGN_FROM_SUBSCRIBED_ASSIGNORS =
Collections.unmodifiableList(Arrays.asList(
RANGE_ASSIGNOR_NAME,
ROUNDROBIN_ASSIGNOR_NAME,
STICKY_ASSIGNOR_NAME,
COOPERATIVE_STICKY_ASSIGNOR_NAME
));
List.of(RANGE_ASSIGNOR_NAME, ROUNDROBIN_ASSIGNOR_NAME, STICKY_ASSIGNOR_NAME, COOPERATIVE_STICKY_ASSIGNOR_NAME);

/*
* NOTE: DO NOT CHANGE EITHER CONFIG STRINGS OR THEIR JAVA VARIABLE NAMES AS
Expand Down Expand Up @@ -381,7 +375,7 @@ public class ConsumerConfig extends AbstractConfig {

private static final AtomicInteger CONSUMER_CLIENT_ID_SEQUENCE = new AtomicInteger(1);
private static final List<Class<? extends AbstractPartitionAssignor>> PARTITION_ASSIGNOR_DEFAULT_VALUE =
Collections.unmodifiableList(Arrays.asList(RangeAssignor.class, CooperativeStickyAssignor.class));
List.of(RangeAssignor.class, CooperativeStickyAssignor.class);

/**
* A list of configuration keys for CLASSIC protocol not supported. we should check the input string and clean up the
Expand All @@ -395,11 +389,8 @@ public class ConsumerConfig extends AbstractConfig {
* A list of configuration keys for consumer protocol not supported. we should check the input string and clean up the
* default value.
*/
private static final List<String> CONSUMER_PROTOCOL_UNSUPPORTED_CONFIGS = Collections.unmodifiableList(Arrays.asList(
PARTITION_ASSIGNMENT_STRATEGY_CONFIG,
HEARTBEAT_INTERVAL_MS_CONFIG,
SESSION_TIMEOUT_MS_CONFIG
));
private static final List<String> CONSUMER_PROTOCOL_UNSUPPORTED_CONFIGS =
List.of(PARTITION_ASSIGNMENT_STRATEGY_CONFIG, HEARTBEAT_INTERVAL_MS_CONFIG, SESSION_TIMEOUT_MS_CONFIG);

static {
CONFIG = new ConfigDef().define(BOOTSTRAP_SERVERS_CONFIG,
Expand Down Expand Up @@ -739,13 +730,6 @@ private void checkUnsupportedConfigs(GroupProtocol groupProtocol, List<String> u
Object config = originals().get(configName);
if (config != null && !Utils.isBlank(config.toString())) {
throw new ConfigException(configName + " cannot be set when " + GROUP_PROTOCOL_CONFIG + "=" + groupProtocol.name());
} else {
/*
Some default values are not supported in the CONSUMER protocol or CLASSIC protocol. When these default
values are printed in the log, they can misdirect users. Therefore, in this case, the default values
should be cleared.
*/
super.clearConfig(configName);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,6 @@ public Map<String, Object> valuesWithPrefixAllOrNothing(String prefix) {
return nonInternalConfigs;
}

protected void clearConfig(String key) {
Object value = values.get(key);
if (value instanceof Number)
values.put(key, 0);
else
values.remove(key);
}

private void logAll() {
StringBuilder b = new StringBuilder();
b.append(getClass().getSimpleName());
Expand Down

0 comments on commit 07a7a7e

Please sign in to comment.