Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
IndexSet default setting #3209
An index set can be marked as
Since we are using MongoDB, there are no cross-document atomic operations or transactions so we have to take care of that ourselves.
Idea 1: Use a timestamp
We are currently using a boolean
As an alternative to the boolean flag we could use a timestamp field like
Idea 2: Coordinate on master
Another idea was to publish an event on the cluster event bus to set the default index set. All nodes subscribe to the event but only the master node will actually handle it. Since only one node should be master and the events are not processed in parallel, this should avoid interleaving writes to the index sets collection. It doesn't guarantee any order though.
This is more complicated than the timestamp idea beacuse it involves the cluster event bus and needs an event handler. It also makes the request to set the default index set async so we have to deal with that in the UI. It also fails when there is more than one active master node.
Please let me know if you have different, better ideas. Let's discuss!