KAFKA-16976: Update the current/dynamic config inside RemoteLogManagerConfig#16394
KAFKA-16976: Update the current/dynamic config inside RemoteLogManagerConfig#16394chia7712 merged 5 commits intoapache:trunkfrom
Conversation
|
Call for review. PTAL. |
| * @param props | ||
| */ | ||
| public void updateCurrentConfig(Map<?, ?> props) { | ||
| if (props.containsKey(REMOTE_LOG_INDEX_FILE_CACHE_TOTAL_SIZE_BYTES_PROP)) { |
There was a problem hiding this comment.
It seems to me this way has following disadvantages.
- it is not thread-safe
- those configs must be equal to
DynamicRemoteLogConfig#ReconfigurableConfigs, and it could be easy to forget to make them consistency - there are two sources of those configs -
propsand inner variable - that is a bit chaos
If we want to make all "created" RemoteLogManagerConfig can see "latest" configs and fix above disadvantages, a simple solution is RemoteLogManagerConfig can keep a reference of KafkaConfig instead of having KafkaConfig snapshot.
WDYT?
There was a problem hiding this comment.
Agreed with @chia7712 ,
we should keep the consistency along with thread-safty.
There was a problem hiding this comment.
We cannot add the 'core' module dependency to the 'storage' module. So, kafka.core.KafkaConfig can't be referenced in RemoteLogManagerConfig.
There was a problem hiding this comment.
- there are two sources of those configs - props and inner variable - that is a bit chaos
One option is to follow the approach that you have suggested in this comment to avoid exposing the unrelated/unexpected methods.
There was a problem hiding this comment.
We cannot add the 'core' module dependency to the 'storage' module. So, kafka.core.KafkaConfig can't be referenced in RemoteLogManagerConfig.
My point was to use KafkaConfig to create RemoteLogManagerConfig, and so RemoteLogManagerConfig will have a reference to AbstractConfig ( and its point is KafkaConfig). For example:
public RemoteLogManagerConfig(AbstractConfig configs)Also, my another concern is - how we handle other similar configs in the future? add all of them to updateCurrentConfig (it means they have two kinds of configs sources - props and individual dynamic volatile fields) ? or make them reuse a class which can reflect the latest configs?
There was a problem hiding this comment.
Small suggestions (I am thinking out loud here) KafkaConfig in server is now inheriting AbstractKafkaConfig and am already working on moving most getters into AbstractKafkaConfig here #16307 so maybe we can refer to AbstractKafkaConfig instead of AbstractConfig and any getters you need define it in AbstractKafkaConfig. Specially that AbstractKafkaConfig is going to replace KafkaConfig at some point.
There was a problem hiding this comment.
@OmniaGM that will go back to face the issue - AbstractKafkaConfig is in server module :(
There was a problem hiding this comment.
any getters you need define it in AbstractKafkaConfig
that is another design we need to discuss. If we will have different config class (for example:RemoteLogManagerConfig) for each component, do we need to add all getters to KafkaConfig/AbstractKafkaConfig? Or we can follow the pattern of RemoteLogManagerConfig that KafkaConfig can create every config class to get related config? That is a trade-off, and currently I prefer the later as it avoids a huge KafkaConfig and KafkaConfig is still a center that we can get all configs from it.
There was a problem hiding this comment.
@OmniaGM that will go back to face the issue - AbstractKafkaConfig is in server module :(
:/ yeah this is getting more complicated. I just feel using a very generic AbstractConfig instead of KafkaConfig make the code bit unreadable as you need to really to follow what config is passed.
any getters you need define it in AbstractKafkaConfig
We don't need to keep the getters there for ever however until we move everything out we need a place for KafkaConfig that not core as this is the hard no module to depend on in all the other modules.
There was a problem hiding this comment.
:/ yeah this is getting more complicated. I just feel using a very generic AbstractConfig instead of KafkaConfig make the code bit unreadable as you need to really to follow what config is passed.
agree as we leverage KafkaConfig to see "latest" configs, and that is something behind the AbstractConfig.
We don't need to keep the getters there for ever however until we move everything out we need a place for KafkaConfig that not core as this is the hard no module to depend on in all the other modules.
it seems eventually we need a module to run server with all required code, and so I assume server module is the one (but it will get smaller than core module).
Also, AbstractKafkaConfig does a great job that it does not declare all ConfigDef by itself. Instead, it collect all ConfigDef from each config class. That is why I feel we can follow the pattern to deal with other config classes.
chia7712
left a comment
There was a problem hiding this comment.
@kamalcph thanks for adopting the approach. This will be the good reference for other similar issues (#16388, and https://issues.apache.org/jira/browse/KAFKA-16909).
|
I'm going to merge this PR. It seems to me the style brought by this PR includes two benefits
A comment raised by @OmniaGM (#16394 (comment)) is not addressed and I open https://issues.apache.org/jira/browse/KAFKA-17001 for it |
…Config (apache#16394) Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
Reverted the some of the changes that was done in #16353
Committer Checklist (excluded from commit message)