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

Commita32c3ec

Browse files
committed
Promote the assertion that XLogBeginInsert() is not called twice into ERROR.
Seems like cheap insurance for WAL bugs. A spurious call toXLogBeginInsert() in itself would be fairly harmless, but if there is anydata registered and the insertion is not completed/cancelled properly, thereis a risk that the data ends up in a wrong WAL record.Per Jeff Janes's suggestion.
1 parenta45c70a commita32c3ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/backend/access/transam/xloginsert.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,14 @@ XLogBeginInsert(void)
122122
Assert(max_registered_block_id==0);
123123
Assert(mainrdata_last== (XLogRecData*)&mainrdata_head);
124124
Assert(mainrdata_len==0);
125-
Assert(!begininsert_called);
126125

127126
/* cross-check on whether we should be here or not */
128127
if (!XLogInsertAllowed())
129128
elog(ERROR,"cannot make new WAL entries during recovery");
130129

130+
if (begininsert_called)
131+
elog(ERROR,"XLogBeginInsert was already called");
132+
131133
begininsert_called= true;
132134
}
133135

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp