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

Commitc1dd3a9

Browse files
committed
Fix snapshot used in logical replication index lookup
The function calls GetLatestSnapshot() to acquire a fresh snapshot,makes it active, and was meant to pass it to table_tuple_lock(), butinstead called GetLatestSnapshot() again to acquire yet anothersnapshot. It was harmless because the heap AM and all other knowntable AMs ignore the 'snapshot' argument anyway, but let's be tidy.In the long run, this perhaps should be redesigned so that snapshotwas not needed in the first place. The table AM API uses TID +snapshot as the unique identifier for the row version, which isquestionable when the row came from an index scan with a Dirtysnapshot. You might lock a different row version when you use adifferent snapshot in the table_tuple_lock() call (a fresh MVCCsnapshot) than in the index scan (DirtySnapshot). However, in the heapAM and other AMs where the TID alone identifies the row version, itdoesn't matter. So for now, just fix the obvious albeit harmless bug.This has been wrong ever since the table AM API was introduced incommit5db6df0, so backpatch to all supported versions.Discussion:https://www.postgresql.org/message-id/83d243d6-ad8d-4307-8b51-2ee5844f6230@iki.fiBackpatch-through: 13
1 parent0f27bd1 commitc1dd3a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/backend/executor/execReplication.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
250250

251251
PushActiveSnapshot(GetLatestSnapshot());
252252

253-
res=table_tuple_lock(rel,&(outslot->tts_tid),GetLatestSnapshot(),
253+
res=table_tuple_lock(rel,&(outslot->tts_tid),GetActiveSnapshot(),
254254
outslot,
255255
GetCurrentCommandId(false),
256256
lockmode,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp