-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Please describe the problem you are trying to solve
When leveraging ZookeeperDiscoveryStrategy for Hazelcast node auto discovery, it is in short of the implementation to define the partition group with this SPI. When reading the codes, I believe there are two ways to achieve this:
-
Implement the getPartitionGroupStrategy in AbstractDiscoveryStrategy which ZookeeperDiscoveryStrategy extends. This is the way suggested in Hazelcast document: https://docs.hazelcast.com/imdg/4.1.2/clusters/partition-group-configuration.html for SPI. But one of the challenge here is that there is no allMembers information passed to the getPartitionGroupStrategy callback method: https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/internal/partition/membergroup/SPIAwareMemberGroupFactory.java#L66. We could pass allMembers information as the arguments of getPartitionGroupStrategy, for the existing clients who have implement getPartitionGroupStrategy, they could ignore this information. And for the specific node, we need to label the node with overwriting https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/spi/discovery/AbstractDiscoveryStrategy.java#L60 for ZookeeperDiscoveryStrategy to pass the label to https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/cluster/impl/MemberImpl.java#L125 and used as the indicator in getPartitionGroupStrategy
-
instead of use SPI member group factory mechanism, we could use PLACEMENT_AWARE: https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/internal/partition/membergroup/MemberGroupFactoryFactory.java#L48. This also requires us to provide PartitionGroupMetaData.PARTITION_GROUP_PLACEMENT attribute during discovery, which could be done as described in (1)
Please describe the desired behavior
I expect client could define the partition group based on user level attribute, e.g. data center, region, e.t.c
Describe alternatives you've considered
...