Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9945ad6

Browse files
Justify nbtree page split locking in code comment.
Delaying unlocking the right child page until after the point that theleft child's parent page has been refound is no longer truly necessary.Commit40dae7e made nbtree tolerant of interrupted page splits. VACUUMwas taught to avoid deleting a page that happens to be the right half ofan incomplete split. As long as page splits don't unlock the left childpage until the end of the second/final phase, it should be safe tounlock the right child page earlier (at the end of the first phase).It probably isn't actually useful to release the right child's lockearlier like this (it probably won't improve performance). Even still,pointing out that it ought to be safe to do so should make it easier tounderstand the overall design.
1 parent1e61480 commit9945ad6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎src/backend/access/nbtree/nbtinsert.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,8 +2128,17 @@ _bt_insert_parent(Relation rel,
21282128
pbuf=_bt_getstackbuf(rel,stack,bknum);
21292129

21302130
/*
2131-
* Now we can unlock the right child. The left child will be unlocked
2132-
* by _bt_insertonpg().
2131+
* Unlock the right child. The left child will be unlocked in
2132+
* _bt_insertonpg().
2133+
*
2134+
* Unlocking the right child must be delayed until here to ensure that
2135+
* no concurrent VACUUM operation can become confused. Page deletion
2136+
* cannot be allowed to fail to re-find a downlink for the rbuf page.
2137+
* (Actually, this is just a vestige of how things used to work. The
2138+
* page deletion code is expected to check for the INCOMPLETE_SPLIT
2139+
* flag on the left child. It won't attempt deletion of the right
2140+
* child until the split is complete. Despite all this, we opt to
2141+
* conservatively delay unlocking the right child until here.)
21332142
*/
21342143
_bt_relbuf(rel,rbuf);
21352144

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp