I am trying to use the jgroups backend for having one node write changes to indexes obtained from multiple nodes. However, after debugging through the Hibernate search and jgroups backend code, I see that there could be a potential problem in how Jgroups can simply ignore the messages received from slave nodes. Here is the scenario
Nodes A and B form a cluster with Node B as the Jgroups coordinator. Looking at the JGroups (AutoNodeSelector) code, it would pick Node A (non coordinator) as the master for index writes. Suppose Node A started because of some operation (read/write) for an index named X, index X would be stored as the key in NodeSelectorStrategyHolder. However say Node B started because of a write operation for an index named Y, then since Node A was selected as the master (based on AutoNodeSelector logic), it would send the write operation to Node A. But as mentioned earlier Node A started because of operation on index X and since index named Y is not present in NodeSelectorStrategyHolder, the JGroupsMasterMessageListener receive method silently drops the message it received from slave.
I am running into this issue where all nodes are not up with all the indexes instantiated (they are lazy created). As a result index write operations started on non-master nodes are being silently dropped. To complicate the setup, I am using dynamic sharding strategy.
Is there a way to fix this? Again looking at the code the simple fix would be to override NodeSelectorStrategyHolder implementation. However, this seems to be a ServiceProvider and there does not seem to be an easy way to override this. Any ideas on how to solve this problem.
I using Hibernate Search 4.5.3
|