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

Commit4ec157c

Browse files
author
Amit Kapila
committed
Fix uninitialized access to InitialRunningXacts during decoding.
In commit272248a, we introduced an InitialRunningXacts array toremember transactions and subtransactions that were running when thexl_running_xacts record that we decoded was written. This array wasallocated in the snapshot builder memory context after we restoreserialized snapshot but we forgot to reset the array while freeing thebuilder memory context. So, the next time when we start decoding in thesame session where we don't restore any serialized snapshot, we ended upusing the uninitialized array and that can lead to unpredictable behavior.This problem doesn't exist in HEAD as instead of usingInitialRunningXacts, we added the list of transaction IDs andsub-transaction IDs, that have modified catalogs and are running duringsnapshot serialization, to the serialized snapshot (see commit7f13ac8).Reported-by: Maxim OrlovAuthor: Masahiko SawadaReviewed-by: Amit Kapila, Maxim OrlovBackpatch-through: 11Discussion:https://postgr.es/m/CACG=ezZoz_KG+Ryh9MrU_g5e0HiVoHocEvqFF=NRrhrwKmEQJQ@mail.gmail.com
1 parent5a18524 commit4ec157c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎src/backend/replication/logical/snapbuild.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ AllocateSnapshotBuilder(ReorderBuffer *reorder,
371371

372372
MemoryContextSwitchTo(oldcontext);
373373

374+
/* The initial running transactions array must be empty. */
375+
Assert(NInitialRunningXacts==0&&InitialRunningXacts==NULL);
376+
374377
returnbuilder;
375378
}
376379

@@ -391,6 +394,10 @@ FreeSnapshotBuilder(SnapBuild *builder)
391394

392395
/* other resources are deallocated via memory context reset */
393396
MemoryContextDelete(context);
397+
398+
/* InitialRunningXacts is freed along with the context */
399+
NInitialRunningXacts=0;
400+
InitialRunningXacts=NULL;
394401
}
395402

396403
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp