Skip to content
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

Add support for WAN replication of IMap/ICache evictions [HZ-2619] #24941

Merged
merged 4 commits into from Jul 17, 2023

Conversation

JamesHazelcast
Copy link
Contributor

@JamesHazelcast JamesHazelcast commented Jul 3, 2023

In the current implementation of Hazelcast, evictions are not replicated over WAN to target clusters - this is done intentionally as evictions are purely local operations that usually occur as a last resort to free resources on demand. However, there are circumstances where some users may want to have evictions replicated over WAN to try and maintain more synchronization between 2 clusters (even though this does still not guarantee data consistency using WAN).

This commit introduces 2 new ClusterProperty entries that allow WAN replication of IMap and ICache eviction events respectively. This property is disabled by default and must be explicitly enabled as WAN replication of eviction events was purposefully omitted prior to this.

Code changes are simple, introducing publishWanRemove() calls within DefaultRecordStore (for IMap) and AbstractCacheRecordStore (for ICache) - I had originally trialed a solution that introduced these calls within operations (EvictOperation etc) to match existing WAN replication mechanics, but due to the mostly-local nature of eviction
that is often triggered as a result of other operations (not eviction operations directly), it made more sense to implement at the root of eviction calls, which resides in these record stores.

This solution, when enabled, fires WAN replication events for all evictions (expiration, resource constraints, user-invoked, etc) - the reason for this is the use-case for these config options is to attempt to keep data more consistent between 2 clusters over WAN, and so in this scenario (although still not bulletproof by any means), it makes sense to try and replicate all operations that result in mutation (as is the case with all evictions).

This commit also includes a regression test that confirms consistency between 2 clusters under ideal circumstances with evictions on the source cluster.

Fixes https://hazelcast.atlassian.net/browse/HZ-2619
EE PR: https://github.com/hazelcast/hazelcast-enterprise/pull/6201

This commit introduces 2 new `ClusterProperty` entries that allow WAN
replication of `IMap` and `ICache` eviction events respectively. This
property is disabled by default and must be explicitly enabled as WAN
replication of eviction events was purposefully omitted prior to this.

This commit also includes a regression test that confirms consistency
between 2 clusters under ideal circumstances with evictions on the
source cluster.

Full details regarding this PR can be found in HZ-2619

Fixes https://hazelcast.atlassian.net/browse/HZ-2619
Copy link
Collaborator

@vbekiaris vbekiaris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder to update documentation about the cluster properties and make sure it is clear all kinds of evictions (size- or expiration-driven and even manual evict operations) will be replicated when this property is enabled.

Include information about expected use-case and considerations before enabling these options.
@JamesHazelcast
Copy link
Contributor Author

run-lab-run

@JamesHazelcast JamesHazelcast marked this pull request as ready for review July 17, 2023 16:41
@JamesHazelcast JamesHazelcast merged commit c5f4a6f into hazelcast:master Jul 17, 2023
8 checks passed
JamesHazelcast added a commit to JamesHazelcast/hz-docs that referenced this pull request Jul 18, 2023
We recently added 2 new `ClusterProperty` entries for 5.4 related to the replication of eviction events with `IMap` and `ICache`.

Relevant PR: hazelcast/hazelcast#24941
JamesHazelcast added a commit to JamesHazelcast/hazelcast that referenced this pull request Jul 19, 2023
Backport of: hazelcast#24941

In the current implementation of Hazelcast, evictions are not replicated
over WAN to target clusters - this is done intentionally as evictions
are purely local operations that usually occur as a last resort to free
resources on demand. However, there are circumstances where some users
may want to have evictions replicated over WAN to try and maintain more
synchronization between 2 clusters (even though this does still not
guarantee data consistency using WAN).

This commit introduces 2 new `ClusterProperty` entries that allow WAN
replication of `IMap` and `ICache` eviction events respectively. This
property is disabled by default and must be explicitly enabled as WAN
replication of eviction events was purposefully omitted prior to this.

Code changes are simple, introducing `publishWanRemove()` calls within
`DefaultRecordStore` (for `IMap`) and `AbstractCacheRecordStore` (for
`ICache`) - I had originally trialed a solution that introduced these
calls within operations (`EvictOperation` etc) to match existing WAN
replication mechanics, but due to the mostly-local nature of eviction
that is often triggered as a result of other operations (not eviction
operations directly), it made more sense to implement at the root of
eviction calls, which resides in these record stores.

This solution, when enabled, fires WAN replication events for all
evictions (expiration, resource constraints, user-invoked, etc) - the
reason for this is the use-case for these config options is to attempt to
keep data more consistent between 2 clusters over WAN, and so in this
scenario (although still not bulletproof by any means), it makes sense to
try and replicate all operations that result in mutation (as is the case
with all evictions).

This commit also includes a regression test that confirms consistency
between 2 clusters under ideal circumstances with evictions on the source
cluster.

Fixes https://hazelcast.atlassian.net/browse/HZ-2619
JamesHazelcast added a commit that referenced this pull request Jul 21, 2023
…3.z] (#25039)

Backport of: #24941

In the current implementation of Hazelcast, evictions are not replicated
over WAN to target clusters - this is done intentionally as evictions
are purely local operations that usually occur as a last resort to free
resources on demand. However, there are circumstances where some users
may want to have evictions replicated over WAN to try and maintain more
synchronization between 2 clusters (even though this does still not
guarantee data consistency using WAN).

This commit introduces 2 new `ClusterProperty` entries that allow WAN
replication of `IMap` and `ICache` eviction events respectively. This
property is disabled by default and must be explicitly enabled as WAN
replication of eviction events was purposefully omitted prior to this.

Code changes are simple, introducing `publishWanRemove()` calls within
`DefaultRecordStore` (for `IMap`) and `AbstractCacheRecordStore` (for
`ICache`) - I had originally trialed a solution that introduced these
calls within operations (`EvictOperation` etc) to match existing WAN
replication mechanics, but due to the mostly-local nature of eviction
that is often triggered as a result of other operations (not eviction
operations directly), it made more sense to implement at the root of
eviction calls, which resides in these record stores.

This solution, when enabled, fires WAN replication events for all
evictions (expiration, resource constraints, user-invoked, etc) - the
reason for this is the use-case for these config options is to attempt
to keep data more consistent between 2 clusters over WAN, and so in this
scenario (although still not bulletproof by any means), it makes sense
to try and replicate all operations that result in mutation (as is the
case with all evictions).

This commit also includes a regression test that confirms consistency
between 2 clusters under ideal circumstances with evictions on the
source cluster.

Fixes https://hazelcast.atlassian.net/browse/HZ-2619
EE PR: hazelcast/hazelcast-enterprise#6260
Serdaro pushed a commit to hazelcast/hz-docs that referenced this pull request Aug 21, 2023
* Add WAN eviction cluster properties

We recently added 2 new `ClusterProperty` entries for 5.4 related to the replication of eviction events with `IMap` and `ICache`.

Relevant PR: hazelcast/hazelcast#24941

* Wording improvements

Co-authored-by: angelasimms <106963942+angelasimms@users.noreply.github.com>

* Add detailed docs for IMap/ICache eviction WAN replication

* Feedback updates

---------

Co-authored-by: angelasimms <106963942+angelasimms@users.noreply.github.com>
github-actions bot pushed a commit to hazelcast/hz-docs that referenced this pull request Aug 21, 2023
* Add WAN eviction cluster properties

We recently added 2 new `ClusterProperty` entries for 5.4 related to the replication of eviction events with `IMap` and `ICache`.

Relevant PR: hazelcast/hazelcast#24941

* Wording improvements

Co-authored-by: angelasimms <106963942+angelasimms@users.noreply.github.com>

* Add detailed docs for IMap/ICache eviction WAN replication

* Feedback updates

---------

Co-authored-by: angelasimms <106963942+angelasimms@users.noreply.github.com>
(cherry picked from commit aae86e2)
@JamesHazelcast JamesHazelcast deleted the fix/5.4/hz-2619 branch September 21, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants