pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[fix][client] Fix ConfigurationDataUtils loadConf strategy

Open mgrenonville opened this issue 3 years ago • 19 comments

Motivation

When using loadConf, ConfigurationDataUtils was loading existing values in a Map using Jackson mapper. If there is a @JsonIgnore, Jackson ignores theses fields, but there will be forgotten in the new instance.

Modifications

Using readerForUpdating(existingData).readValue(configJson) will refresh only overriden values in config map.

Verifying this change

  • [x] Make sure that the change passes the CI checks.

This change is already covered by existing tests, such as org.apache.pulsar.client.impl.conf.ConfigurationDataUtilsTest.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): no
  • The public API: no
  • The schema: no
  • The default values of configurations: no
  • The wire protocol: no
  • The rest endpoints: no
  • The admin cli options: no
  • Anything that affects deployment: no (at least, it will no longer fails silently on @JsonIgnore properties)

Documentation

Check the box below and label this PR (if you have committer privilege).

Need to update docs?

  • [x] no-need-doc This was a bug in loadConf code, it is intended to work as follow (I think)

  • [x] doc-not-needed

mgrenonville avatar Dec 14 '21 14:12 mgrenonville

Hi @codelipenghui ! It's strange, I see that CI test are failing however, when executing these tests on my computer, they work. Are they known to be flaky ?

mgrenonville avatar Jan 05 '22 20:01 mgrenonville

@mgrenonville You can left a comment with content /pulsarbot run-failure-checks to trigger to rerun the failed tests.

codelipenghui avatar Jan 07 '22 05:01 codelipenghui

Maybe we could add a construct method for DeadLetterPolicy, then we could use the conf to set DeadLetterPolicy.

gaoran10 avatar Jan 09 '22 16:01 gaoran10

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar Mar 19 '22 01:03 github-actions[bot]

The pr had no activity for 30 days, mark with Stale label.

github-actions[bot] avatar May 30 '22 02:05 github-actions[bot]

Could you continue this work?

BewareMyPower avatar Jul 28 '22 17:07 BewareMyPower

@mgrenonville ping

Jason918 avatar Aug 27 '22 08:08 Jason918

Although I think the DeadLetterPolicy crash is solved by https://github.com/apache/pulsar/issues/16487, we still have the issue that loadConf resets non-serializable fields to null. This PR prevents that. Also it should be documented that loadConf only loads fields that are serializable. For instance, loadConf(Map.of("messageListener", messageListener)) does nothing.

cbornet avatar Nov 04 '22 10:11 cbornet

Should we allow loadConf to set non-serializable fields ? It's possible to do it by saving the non-serializable field in a var before calling ConfigurationDataUtils::loadData and apply it after. I'll do a PR for discussion.

cbornet avatar Nov 04 '22 10:11 cbornet

@Jason918 we should add this in 2.11 before the release

eolivelli avatar Nov 04 '22 13:11 eolivelli

@mgrenonville would you have to address the comments ? This patch is really valuable

eolivelli avatar Nov 04 '22 13:11 eolivelli

@cbornet - is it possible to add a new method that does not require serializability? That would let us avoid a change in the implicit method contract.

michaeljmarshall avatar Nov 04 '22 15:11 michaeljmarshall

@michaeljmarshall We could add loadConfig and deprecate loadConf. WDYT ?

cbornet avatar Nov 05 '22 09:11 cbornet

We can add a new method and deprecate the other. A deprecation would make it very clear that the semantics changed and we could document the change.

michaeljmarshall avatar Nov 08 '22 06:11 michaeljmarshall

@mgrenonville hi, I move this PR to release/2.9.5, if you have any questions, please ping me. thanks.

congbobo184 avatar Nov 17 '22 12:11 congbobo184

https://github.com/apache/pulsar/issues/11646#issuecomment-1303738507

tisonkun avatar Dec 06 '22 10:12 tisonkun

I don't think #11646 is related to this

cbornet avatar Dec 06 '22 10:12 cbornet

Since we will start the RC version of 3.0.0 on 2023-04-11, I will change the label/milestone of PR who have not been merged.

  • The PR of type feature is deferred to 3.1.0
  • The PR of type fix is deferred to 3.0.1

So drag this PR to 3.0.1

poorbarcode avatar Apr 10 '23 08:04 poorbarcode

As discussed on the mailing list https://lists.apache.org/thread/w4jzk27qhtosgsz7l9bmhf1t7o9mxjhp, there is no plan to release 2.9.6, so I am going to remove the release/2.9.6 label

michaeljmarshall avatar Jun 27 '23 21:06 michaeljmarshall