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

Commit04fbe29

Browse files
committed
Fix WAL replay of truncate operations to cope with the possibility that the
truncated relation was deleted later in the WAL sequence. Since replaynormally auto-creates a relation upon its first reference by a WAL log entry,failure is seen only if the truncate entry happens to be the first referenceafter the checkpoint we're restarting from; which is a pretty unusual case butof course not impossible. Fix by making truncate entries auto-create likethe other ones do. Per report and test case from Dharmendra Goyal.
1 parentebb5436 commit04fbe29

File tree

1 file changed

+9
-1
lines changed
  • src/backend/storage/smgr

1 file changed

+9
-1
lines changed

‎src/backend/storage/smgr/smgr.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.104 2007/07/08 22:23:16 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.105 2007/07/20 16:29:53 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -811,6 +811,14 @@ smgr_redo(XLogRecPtr lsn, XLogRecord *record)
811811

812812
reln=smgropen(xlrec->rnode);
813813

814+
/*
815+
* Forcibly create relation if it doesn't exist (which suggests that
816+
* it was dropped somewhere later in the WAL sequence). As in
817+
* XLogOpenRelation, we prefer to recreate the rel and replay the
818+
* log as best we can until the drop is seen.
819+
*/
820+
smgrcreate(reln, false, true);
821+
814822
/* Can't use smgrtruncate because it would try to xlog */
815823

816824
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp