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

Commit70b9adb

Browse files
Ensure we have a snapshot when updating pg_index in index_drop().
I assumed that all index_drop() callers set an active snapshotbeforehand, but that is evidently not true. One counterexample isautovacuum, which doesn't set an active snapshot when cleaning uporphan temp indexes. To fix, unconditionally push an activesnapshot before updating pg_index in index_drop().Oversight in commitb52adba.Reported-by: Masahiko SawadaReviewed-by: Stepan Neretin, Masahiko SawadaDiscussion:https://postgr.es/m/CAD21AoBgF9etQrXbN9or_YHsmBRJHHNUEkhHp9rGK9CyQv5aTQ%40mail.gmail.com
1 parent11b7de4 commit70b9adb

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

‎src/backend/catalog/index.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,13 +2336,9 @@ index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode)
23362336

23372337
/*
23382338
* Updating pg_index might involve TOAST table access, so ensure we have a
2339-
* valid snapshot. We only expect to get here without a snapshot in the
2340-
* concurrent path.
2339+
* valid snapshot.
23412340
*/
2342-
if (concurrent)
2343-
PushActiveSnapshot(GetTransactionSnapshot());
2344-
else
2345-
Assert(HaveRegisteredOrActiveSnapshot());
2341+
PushActiveSnapshot(GetTransactionSnapshot());
23462342

23472343
/*
23482344
* fix INDEX relation, and check for expressional index
@@ -2361,8 +2357,7 @@ index_drop(Oid indexId, bool concurrent, bool concurrent_lock_mode)
23612357
ReleaseSysCache(tuple);
23622358
table_close(indexRelation,RowExclusiveLock);
23632359

2364-
if (concurrent)
2365-
PopActiveSnapshot();
2360+
PopActiveSnapshot();
23662361

23672362
/*
23682363
* if it has any expression columns, we might have stored statistics about

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp