-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24313] YSQL: fix index build corruption during concurrent updates
Summary: The new function YbExecUpdateIndexTuples introduced in f0a5db7 / D36588 was missing index status checks and therefore could cause corruption of indexes built concurrently with target table updates. The index status is represented by three boolean flags: idxislive, idxisready and idxisvalid. Those flags change their values from false to true as the index build process progresses through the stages. When idxislive is true, updates to the target table should attempt to delete old index records. When indisready is true, updates to the target table should insert new index records. When indisvalid is true, the index can be used for reads. Before YbExecUpdateIndexTuples was introduced the update deleted the old index record then inserted the new index record. Those routines respectively checked the indislive and indisready flags. YbExecUpdateIndexTuples may fallback to delete/insert if update in place is not possible. But first it checks the index status. If idxislive is false, the index is ignored. If idxislive true, but indisready is false, YbExecUpdateIndexTuples deletes the old record only. If indisready is true, YbExecUpdateIndexTuples proceeds to the choice between in-place update or delete/insert, as usual. The idxisvalid does not matter for the index update. Jira: DB-13202 Test Plan: ./yb_build.sh --cxx-test pgwrapper_pg_index_backfill-test --gtest_filter PgIndexBackfillTest.PhantomIdxEntry Reviewers: jason, kramanathan Reviewed By: jason Subscribers: smishra, yql Tags: #jenkins-ready Differential Revision: https://phorge.dev.yugabyte.com/D39430
- Loading branch information
1 parent
eb0c30c
commit 68f7de8
Showing
4 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters