2.25.0.0-b118
fizaaluthra
tagged this
10 Oct 14:35
Summary: We currently do not support table rewrite on system tables. Therefore, we should not perform `REINDEX` and `TRUNCATE` operations on system tables using the table rewrite framework. Additionally, we should not use the table rewrite framework when the GUC that guards the feature (`yb_enable_alter_table_rewrite`) is set to false. - Commit 2fb7ea649683574f7d6a62edaf0318166d5eb5a1 changes the implementation of `REINDEX` to use table rewrite. It blocks `REINDEX` with table rewrite for system relations, but does not block it when `yb_enable_alter_table_rewrite` is set to false. - Commit fad94f70b2f59003c5054240dd12d873e85fc67c changes the implementation of `TRUNCATE` to use table rewrite. It blocks `TRUNCATE` with table rewrite when `yb_enable_alter_table_rewrite` is false, but does not block it for system relations. This revision fixes both of the above conditions and introduces a new utility function `YbUseUnsafeTruncate` that is a wrapper for the complete condition: `IsYBRelation(rel) && (IsSystemRelation(rel) || !yb_enable_alter_table_rewrite);`. Additionally, it renames `YbTruncate` to `YbUnsafeTruncate` and includes some minor cleanup. Jira: DB-13268 Test Plan: Add tests for system tables and temp tables to `yb_truncate`. ./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressMisc' Reviewers: myang, tfoucher Reviewed By: tfoucher Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D38885