On Fri, Jul 13, 2018, at 23:20, Dong Lin wrote:
> Hey Colin,
> 
> Thanks for the KIP!
> 
> It seems that the AlterConfigsResult is pretty much the same as
> ModifyConfigsResult. Instead of adding ModifyConfigs API and deprecating
> AlterConfigs API, would it be simpler to just add API alterConfigs(
> Map<ConfigResource, Config> changes, Set<ConfigResource> removals, final
> ModifyConfigsOptions options)?
> 
> Currently we use the word "alter" in method names such as
> "alterReplicaLogDirs" and "alterCheckpointDir". So it is probably more
> preferred to keep using the word "alter" instead of "modify" if posssible.
> And if we can overload the alterConfigs(...) API to allow incremental
> change, it might make sense to keep the existing
> alterConfigs(Map<ConfigResource,
> Config> configs) for users who simply want to overwrite the entire configs.

If we have two functions with these type signatures:

> AlterConfigsResult alterConfigs(Map<ConfigResource, Config> changes);
> AlterConfigsResult alterConfigs(Map<ConfigResource, Config> changes, 
> Set<ConfigResource> removals);

It will be extremely surprising, even baffling, to users  that the second 
function overload makes incremental changes, whereas the first function 
overload clears the entire configuration before applying changes.  Just looking 
at the type signatures (which is all most developers will look at, especially 
if they're using IDE autocomplete), you would not expect such a radical 
difference between them.  You would expect the second one to work just like the 
first, except maybe it would also perform some removals.

Calling the two functions different names is good because it reflects the fact 
that they are very different.

> And those user would not have to make code change due to API deprecation.
> What do you think?

alterConfigs needs to be deprecated, though.  Code using alterConfigs is almost 
certainly buggy because of the possibility of simultaneous read-modify-write 
cycles, and the fact that some configs can't be read.

best,
Colin

> 
> Thanks,
> Dong
> 
> On Wed, Jul 11, 2018 at 10:54 AM, Colin McCabe <cmcc...@apache.org> wrote:
> 
> > Hi all,
> >
> > Previously, we discussed some issues with alterConfigs here on the mailing
> > list, and eventually came to the conclusion that the RPC as implemented
> > can't be used for a shell command modifying configurations.
> >
> > I wrote up a small KIP to fix the issues with the RP  Please take a look
> > at https://cwiki.apache.org/confluence/display/KAFKA/KIP-
> > 339%3A+Create+a+new+ModifyConfigs+API
> >
> > best,
> > Colin
> >

Reply via email to