New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implicitly enable MerkleTreeConfig for persistent IMap/ICache #19502
Implicitly enable MerkleTreeConfig for persistent IMap/ICache #19502
Conversation
The job Click to expand the log file-------------------------- -------TEST FAILURE------- -------------------------- [INFO] Results: [INFO] [ERROR] Failures: [ERROR] ClientDynamicClusterConfigTest>DynamicConfigTest.testDefaultMapConfig:372->DynamicConfigTest.assertConfigurationsEqualOnAllMembers:742 expected: but was: [ERROR] ClientDynamicClusterConfigTest>DynamicConfigTest.testMapConfig_withEntryListenerClassName:390->DynamicConfigTest.assertConfigurationsEqualOnAllMembers:742 expected: but was: [ERROR] ClientDynamicClusterConfigTest>DynamicConfigTest.testMapConfig_withEntryListenerImplementation:381->DynamicConfigTest.assertConfigurationsEqualOnAllMembers:742 expected: but was: [ERROR] ClientDynamicClusterConfigTest>DynamicConfigTest.testMapConfig_withQueryCacheConfig:399->DynamicConfigTest.assertConfigurationsEqualOnAllMembers:742 expected: but was: [ERROR] ClientDynamicClusterConfigTest>DynamicConfigTest.testMapConfig_withQueryCacheConfig_andEntryListenerConfigByClassName:409->DynamicConfigTest.assertConfigurationsEqualOnAllMembers:742 expected: but was: [ERROR] ClientDynamicClusterConfigTest>DynamicConfigTest.testMapConfig_withQueryCacheConfig_andEntryListenerConfigByImplementation:419->DynamicConfigTest.assertConfigurationsEqualOnAllMembers:742 expected: but was: [ERROR] ConfigXmlGeneratorTest.testCacheAttributes:923 expected: but was: [ERROR] ConfigXmlGeneratorTest.testCacheFactoryAttributes:950 expected: but was: [ERROR] Errors: [ERROR] ClientDynamicConfigSmokeTest>DynamicConfigSmokeTest.map_testNonConflictingStaticConfig:242 ? InvalidConfiguration [INFO] [ERROR] Tests run: 42811, Failures: 8, Errors: 1, Skipped: 1001 [INFO] |
da7bddb
to
dc00684
Compare
hazelcast/src/main/java/com/hazelcast/client/impl/clientside/ClientDynamicClusterConfig.java
Show resolved
Hide resolved
appendEventJournalConfig(gen, m.getEventJournalConfig()); | ||
appendHotRestartConfig(gen, m.getHotRestartConfig()); | ||
appendDataPersistenceConfig(gen, m.getDataPersistenceConfig()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of deprecated hot-restart config, we should generate the current data-persistence config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we cover both configs to keep the generated configs equality? (Config1->XML->Config2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are merging HotRestartPersistenceConfig
and PersistenceConfig
during transformation from/to XML, a config with HotRestartPersistence
-> XML (output as the new persistence
element) -> parsed as config2 with PersistenceConfig
will be equal to the source config. See also #19004 (comment). Is my reasoning correct @fbarotov ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, yeah we merge both HotRestartPersistenceConfig
and PersistenceConfig
when reading from XML, but when writing to XML we should write only HotRestartPersistenceConfig
if the target can be HZ with version less than 5.0, otherwise just DataPersistenceConfig
would do, since as Vassilis mentioned we merge two configs every time one changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On equality before/after transformation to/from XML, I just pushed a commit to fix it. I thought HotRestartPersistence-Persistence configs merge was already there but it was actually missing in ConfigXmlGenerator#generate
method. Thanks for catching that @kwart .
On whether we should output hot-restart-persistence
or persistence
element: I suppose that starting with 5.0 we want people to migrate from the deprecated hot-restart-persistence
configuration elements to the new persistence
configuration. That's why I think we should output persistence
in the generated XML from 5.0.
If we were to output both elements, then hot-restart-persistence
would be a partial copy of the persistence
element, since any new config will be only added to persistence
config (eg see https://github.com/hazelcast/hazelcast/pull/19522/files#diff-ff0ffd59a12a51408de4fdac0b50ff4634ee86dad470c63d69a17359a815d16eR4049).
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed the issue with @fbarotov. In my opinion, we shouldn't proactively change the Config object. We should keep the config which user has configured. And the same config also store/generate to the XML. We should only resolve the proper persistence settings on places where we use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Faruk will work on a related issue hazelcast/hazelcast-enterprise#4281
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without doing a deep-dive on the consequences of this config merging, I'd say let's just keep it for now, unless there are severe correctness issues, rolling upgrade issues or something along those lines.
IMHO the conundrum of config equality when using ConfigXmlGenerator
is not something we should dwell on for too long, especially this close to the release.
In other words, let's keep the current mechanism of proactively changing the config, until someone starts complaining. Maybe nobody will complain, and we'll remove the HR config in (hopefully) 5.1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On whether we should output hot-restart-persistence or persistence element: I suppose that starting with 5.0 we want people to migrate from the deprecated hot-restart-persistence configuration elements to the new persistence configuration. That's why I think we should output persistence in the generated XML from 5.0.
Agree with this.
@vbekiaris Can you fetch the recent changes in the protocol repo and regenerate the binary compatibility files? We just merged a PR to that repo, so that's why the PR is showing conflicting files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some smaller comments were added. Otherwise LGTM.
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java
Show resolved
Hide resolved
appendEventJournalConfig(gen, m.getEventJournalConfig()); | ||
appendHotRestartConfig(gen, m.getHotRestartConfig()); | ||
appendDataPersistenceConfig(gen, m.getDataPersistenceConfig()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we cover both configs to keep the generated configs equality? (Config1->XML->Config2)
a9915b4
to
28a8f7e
Compare
thanks for the nudge, done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from the client's perspective. I just lefted a question and a minor comment.
@@ -134,6 +135,9 @@ public Config addMapConfig(MapConfig mapConfig) { | |||
Data partitioningStrategy = mapConfig.getPartitioningStrategyConfig() == null | |||
? null : serializationService.toData(mapConfig.getPartitioningStrategyConfig().getPartitioningStrategy()); | |||
|
|||
DataPersistenceAndHotRestartMerger | |||
.merge(mapConfig.getHotRestartConfig(), mapConfig.getDataPersistenceConfig()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Do we need to send the DataPersistenceConfig
element in the DynamicConfigAddMapConfigCodec
request below? I see that we only do it for HotRestartConfig
. Or, merging the configuration elements and then just sending the HotRestartConfig
is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is an issue, however unrelated to this PR. See also https://github.com/hazelcast/hazelcast-enterprise/issues/4282
hazelcast/src/test/java/com/hazelcast/config/ConfigXmlGeneratorTest.java
Show resolved
Hide resolved
You need to update the compatibility binary files one more time after fetching the recent changes in the protocol and regenerating them, as another PR is just merged with the protocol changes |
When persistence is enabled, merkle tree maintenance has a low memory overhead while improving the single member crash-recovery use case. When MerkleTreeConfig#enabled is not explicitly set to false by user, it is now implicitly turned on for persistent IMap & ICache data structures.
before generating XML to ensure equality of configs before/after transformation to/from XML
660561e
to
a2bd13c
Compare
The job Click to expand the log file-------------------------- -------TEST FAILURE------- -------------------------- [INFO] Results: [INFO] [ERROR] Errors: [ERROR] TestEmptyApplicationContext.testXmlWithoutConfig ? IllegalState Failed to load... [INFO] [ERROR] Tests run: 201, Failures: 0, Errors: 1, Skipped: 0 [INFO] |
PR builder failed with #19548 |
When persistence is enabled, merkle tree maintenance has a
low memory overhead while improving the single member
crash-recovery use case. When
MerkleTreeConfig#enabled
is not explicitly set to false by user, it is now implicitly
turned on for persistent
IMap
&ICache
data structures.Tests are in EE-side PR https://github.com/hazelcast/hazelcast-enterprise/pull/4283
Client protocol PR hazelcast/hazelcast-client-protocol#395