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

Commit88b3a6c

Browse files
committed
During heap rebuild, lock any TOAST index until end of transaction.
swap_relation_files() calls toast_get_valid_index() to find and lockthis index, just before swapping with the rebuilt TOAST index. Thelatter function releases the lock before returning. Potential formischief is low; a concurrent session can issue ALTER INDEX ... SET(fillfactor = ...), which is not alarming. Nonetheless, changingpg_class.relfilenode without a lock is unconventional. Back-patch to9.5 (all supported versions), because another fix needs this.Discussion:https://postgr.es/m/20191226001521.GA1772687@rfd.leadboat.com
1 parentb350175 commit88b3a6c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/backend/access/heap/tuptoaster.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,8 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
14361436
validIndexOid=RelationGetRelid(toastidxs[validIndex]);
14371437

14381438
/* Close the toast relation and all its indexes */
1439-
toast_close_indexes(toastidxs,num_indexes,lock);
1440-
table_close(toastrel,lock);
1439+
toast_close_indexes(toastidxs,num_indexes,NoLock);
1440+
table_close(toastrel,NoLock);
14411441

14421442
returnvalidIndexOid;
14431443
}

‎src/backend/commands/cluster.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
14901490

14911491
/* Get the associated valid index to be renamed */
14921492
toastidx=toast_get_valid_index(newrel->rd_rel->reltoastrelid,
1493-
AccessShareLock);
1493+
NoLock);
14941494

14951495
/* rename the toast table ... */
14961496
snprintf(NewToastName,NAMEDATALEN,"pg_toast_%u",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp