tarantool / vshard

The new generation of sharding based on virtual buckets
Other
100 stars 31 forks source link

vshard.storage.cfg fails if replica calls it before master #237

Closed rosik closed 4 years ago

rosik commented 4 years ago

In cartridge we've encountered the following case:

We've got two instances, m-m replication is already set up. One is leader (rw), the other one is read-only. We enable vshard-storage role, and both instances call vshard.storage.cfg almost simultaneously.

If replica calls vshard.storage.cfg before master, it fails.

In v0.1.15 it results in error vshard/storage/init.lua:2389: attempt to index field '_bucket' (a nil value).

In earlier versions it resulted in cfg hanging forever, because of box.once which in turn calls wait_rw which never ends on replica.