Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BACKPORT pg15-cherrypicks][#18822] YSQL: Write out unmodified cols t…
…o main table when update optimizations are enabled Summary: **Conflict resolution for PG 15 cherrypick** - src/postgres/src/backend/executor/nodeModifyTable.c - Location: ExecUpdate —> around `else if (IsYBRelation(resultRelationDesc))` - YB master 8bae4881dc89205c53ee3c62668c41347394af37 updates the comment explaining what `cols_marked_for_update` does. - In YB pg15 be8504df264aff0472e7e91264b095a30d068bf2, this code has moved into the function YBExecUpdateAct. - Merge resolution: Keep changes from YB pg15, manually update the comment in YBExecUpdateAct. - Location: ExecUpdate —> around `if (updateCxt.crossPartUpdate)` - YB master 8bae4881dc89205c53ee3c62668c41347394af37 frees the bitmapset `cols_marked_for_update`. - In YB pg15 be8504df264aff0472e7e91264b095a30d068bf2, this code has moved into the function YBExecUpdateAct. - Merge resolution: Keep changes from YB pg15, manually free the bitmapset in YBExecUpdateAct. D34040 introduced a framework to skip redundant secondary index updates and foreign key checks. As a part of the implementation, this revision skipped writing out unmodified columns to the main table. For correctness reasons, skipping writes of specific columns to the main table requires the acquisition of row-level locks. (In the event that no columns are modified, one is still required to acquire a row lock on the affected row) This created a dependency between the update optimization and the row locking feature. The latter is controlled by the autoflag `ysql_skip_row_lock_for_update`. This revision seeks to remove this dependency by continuing to write out unmodified columns to the main table. There is one notable exception to this behavior: unmodified columns that are a part of the primary key. If the value of the primary key remains unmodified, its columns are not written out to the main table as this would require an extra round trip to the storage layer. Jira: DB-7701 Original commit: 8bae488 / D37545 Test Plan: Run the following tests and ensure that there are no regressions: ``` ./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressUpdateOptimized#schedule' ``` Reviewers: jason, tfoucher Reviewed By: jason Subscribers: yql, smishra Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D37812
- Loading branch information