yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.02k stars 1.08k forks source link

[DocDB] Improve lock safety with sys catalog writes #24983

Open hari90 opened 2 days ago

hari90 commented 2 days ago

Jira Link: DB-14128

Description

Related to https://github.com/yugabyte/yugabyte-db/issues/24929

We send COW pointers to sys catalog write (Mutate) and expect the caller to hold the write lock. This is not enforced at build time there are cases where we will miss it and not catch it in any tests. A cleaner option is to pass the WriteLock to Mutate, and also make sure the lock holds a ref to the COW object itself. This will require a big refactor of master code.

Deletes do not require a lock today, which can also cause unexpected behavior. Once deleted the COW should prevent a write lock, but this mechanism does not exist today. See how to improve this as well.

Issue Type

kind/enhancement

Warning: Please confirm that this issue does not contain any sensitive information