You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#28877] YSQL: (Auto) ANALYZE will be aborted when a global DDL runs on a different DB
Summary:
9e1c574 and f66094f previous implemented a way for DDLs concurrent with (auto) ANALYZE to be aborted. This approach does not work for the following case
1. Global DDL run against db1 - takes a for share lock on pg_yb_catalog_version row for db1
2. ANALYZE run against db2 - takes a for update lock on pg_yb_catalog_version row for db2
To solve, this auto ANALYZE is being changed to a take a lock on all rows of pg_yb_catalog_version. This solves the case above and is verified with a unit test. Auto analyze currently does not run ANALYZE on different DBs concurrently so there is no effect on it due to this.
New approach
1. Global/Regular DDL run against db1 - takes a for share lock on pg_yb_catalog_version row for db1
2. ANALYZE run against db2 - takes a for update lock on all rows in pg_yb_catalog_version.
The other possible way to solve this is to have a global DDL lock all rows of pg_yb_catalog_version - however global DDL are not always easy to identify at the start of a DDL, which is when this lock needs to be taken.
Jira: DB-18598
Test Plan: Added new test cases.
Reviewers: pjain, yguan
Reviewed By: yguan
Subscribers: yql
Differential Revision: https://phorge.dev.yugabyte.com/D47347
0 commit comments