Content-Length: 269575 | pFad | http://github.com/postgrespro/postgres_cluster/commit/a32c3ec893cafbd3a4b42c34270a80198f28f123

29 Promote the assertion that XLogBeginInsert() is not called twice into… · postgrespro/postgres_cluster@a32c3ec · GitHub
Skip to content

Commit a32c3ec

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

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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/a32c3ec893cafbd3a4b42c34270a80198f28f123

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy