queue
queue copied to clipboard
Master-master replication incompatibility.
Consider following case:
Few (let's say 3) nodes in a cluster, with master-master replication. Each node has it's own queue with name, unique in cluster. As each tube need to have its own space, these spaces will be created. But ID of each space may be not unique, as they created on each node separately at virtually the same time. As a result, there will be errors like
E> ER_TUPLE_FOUND: Duplicate key exists in unique index 'primary' in space '_space' E> ER_TUPLE_FOUND: Duplicate key exists in unique index 'primary' in space '_index'
in logs. These errors are fatal for replication. And therefore replication stops.
Following solutions could be proposed:
- Change in application: change cluster startup logic, so it'll create all necessary tubes in box.once(). Later each node can pick appropriate queue somehow, and use it.
- Change in tarantool-queue: Ensure space ID is globally-unique in cluster. (But how to ensure it?)
- Mixed change: tarantool-queue to provide interface to specify ID of a new tube space, so application can assign cluster-unique values for them.
3rd approach is seems to be is not enough. If I add an option to specify tube space ID, I got:
memtx_tree.cc:261 E> ER_TUPLE_FOUND: Duplicate key exists in unique index 'tube_id' in space '_queue'
during replication.