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

Commit9fa9353

Browse files
committed
Don't allocate memory inside an Assert() iff in a critical section.
HeapTupleHeaderGetCmax() asserts that it is only used if the tuple hasbeen updated by the current transaction. That check is correct andsensible but requires allocating memory if xmax is a multixact. Whenwal_level is set to logical cmax needs to be included in a wal record, generated inside a critical section, which can trigger the assertionadded in4a170ee.Reported-By: Steve Singer
1 parent0564bbe commit9fa9353

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/utils/time/combocid.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#include"postgres.h"
4343

44+
#include"miscadmin.h"
4445
#include"access/htup_details.h"
4546
#include"access/xact.h"
4647
#include"utils/combocid.h"
@@ -119,7 +120,14 @@ HeapTupleHeaderGetCmax(HeapTupleHeader tup)
119120
CommandIdcid=HeapTupleHeaderGetRawCommandId(tup);
120121

121122
Assert(!(tup->t_infomask&HEAP_MOVED));
122-
Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tup)));
123+
/*
124+
* Because GetUpdateXid() performs memory allocations if xmax is a
125+
* multixact we can't Assert() if we're inside a critical section. This
126+
* weakens the check, but not using GetCmax() inside one would complicate
127+
* things too much.
128+
*/
129+
Assert(CritSectionCount>0||
130+
TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tup)));
123131

124132
if (tup->t_infomask&HEAP_COMBOCID)
125133
returnGetRealCmax(cid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp