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

Commit2d0475e

Browse files
committed
Convert Assert checking for empty page into a regular test and elog.
The consequences of overwriting a non-empty page are bad enough thatwe should not omit this test in production builds.
1 parent304160c commit2d0475e

File tree

1 file changed

+10
-3
lines changed
  • src/backend/access/heap

1 file changed

+10
-3
lines changed

‎src/backend/access/heap/hio.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.59 2005/11/22 18:17:06 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.60 2006/01/06 00:15:50 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -281,10 +281,17 @@ RelationGetBufferForTuple(Relation relation, Size len,
281281
UnlockRelationForExtension(relation,ExclusiveLock);
282282

283283
/*
284-
* We need to initialize the empty new page.
284+
* We need to initialize the empty new page. Double-check that it really
285+
* is empty (this should never happen, but if it does we don't want to
286+
* risk wiping out valid data).
285287
*/
286288
pageHeader= (Page)BufferGetPage(buffer);
287-
Assert(PageIsNew((PageHeader)pageHeader));
289+
290+
if (!PageIsNew((PageHeader)pageHeader))
291+
elog(ERROR,"page %u of relation \"%s\" should be empty but is not",
292+
BufferGetBlockNumber(buffer),
293+
RelationGetRelationName(relation));
294+
288295
PageInit(pageHeader,BufferGetPageSize(buffer),0);
289296

290297
if (len>PageGetFreeSpace(pageHeader))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp