Closed stakach closed 4 years ago
Can you explain how this fixes the bug?
A race condition can occur when creating tables in rethinkdb. If you have two services sharing a database that create tables when they startup, a duplicate table might be created. Or if you have multiple instances of a single service.
If a duplicate table is created then this code removes the second table - allowing the services to continue to function, as rethink will not process any requests relating to the duplicate table.
We had this issue almost every time when launching a fresh cluster. Have been running this code in production since May without issues.
It's a workaround for this issue: rethinkdb/rethinkdb#4898 and the solution here is pulled from the comments there
Cool, thank you
This will prevent duplicate table errors where multiple services start up simultaneously.
nobrainers lock table for the most part prevents this issue however in a micro-service environment we find the lock table itself becomes a duplicate table.