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

Commite002836

Browse files
committed
Make recovery from WAL be restartable, by executing a checkpoint-like
operation every so often. This improves the usefulness of PITR logshipping for hot standby: formerly, if the standby server crashed, itwas necessary to restart it from the last base backup and replay allthe WAL since then. Now it will only need to reread about the sameamount of WAL as the master server would. The behavior might alsocome in handy during a long PITR replay sequence. Simon Riggs,with some editorialization by Tom Lane.
1 parent977ac90 commite002836

File tree

12 files changed

+273
-115
lines changed

12 files changed

+273
-115
lines changed

‎src/backend/access/gin/ginxlog.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.3 2006/07/14 14:52:16 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.4 2006/08/07 16:57:56 tgl Exp $
1212
*-------------------------------------------------------------------------
1313
*/
1414
#include"postgres.h"
@@ -528,7 +528,8 @@ gin_xlog_cleanup(void) {
528528

529529
topCtx=MemoryContextSwitchTo(opCtx);
530530

531-
foreach(l,incomplete_splits) {
531+
foreach(l,incomplete_splits)
532+
{
532533
ginIncompleteSplit*split= (ginIncompleteSplit*)lfirst(l);
533534
ginContinueSplit(split );
534535
MemoryContextReset(opCtx );
@@ -538,3 +539,10 @@ gin_xlog_cleanup(void) {
538539
MemoryContextDelete(opCtx);
539540
}
540541

542+
bool
543+
gin_safe_restartpoint(void)
544+
{
545+
if (incomplete_splits)
546+
return false;
547+
return true;
548+
}

‎src/backend/access/gist/gistxlog.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.22 2006/07/14 14:52:16 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/gist/gistxlog.c,v 1.23 2006/08/07 16:57:56 tgl Exp $
1212
*-------------------------------------------------------------------------
1313
*/
1414
#include"postgres.h"
@@ -818,6 +818,14 @@ gist_xlog_cleanup(void)
818818
MemoryContextDelete(insertCtx);
819819
}
820820

821+
bool
822+
gist_safe_restartpoint(void)
823+
{
824+
if (incomplete_inserts)
825+
return false;
826+
return true;
827+
}
828+
821829

822830
XLogRecData*
823831
formSplitRdata(RelFileNodenode,BlockNumberblkno,boolpage_is_leaf,

‎src/backend/access/nbtree/nbtxlog.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.36 2006/07/25 19:13:00 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.37 2006/08/07 16:57:56 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -794,3 +794,11 @@ btree_xlog_cleanup(void)
794794
}
795795
incomplete_splits=NIL;
796796
}
797+
798+
bool
799+
btree_safe_restartpoint(void)
800+
{
801+
if (incomplete_splits)
802+
return false;
803+
return true;
804+
}

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Resource managers definition
55
*
6-
* $PostgreSQL: pgsql/src/backend/access/transam/rmgr.c,v 1.23 2006/07/11 17:26:58 momjian Exp $
6+
* $PostgreSQL: pgsql/src/backend/access/transam/rmgr.c,v 1.24 2006/08/07 16:57:56 tgl Exp $
77
*/
88
#include"postgres.h"
99

@@ -23,20 +23,20 @@
2323

2424

2525
constRmgrDataRmgrTable[RM_MAX_ID+1]= {
26-
{"XLOG",xlog_redo,xlog_desc,NULL,NULL},
27-
{"Transaction",xact_redo,xact_desc,NULL,NULL},
28-
{"Storage",smgr_redo,smgr_desc,NULL,NULL},
29-
{"CLOG",clog_redo,clog_desc,NULL,NULL},
30-
{"Database",dbase_redo,dbase_desc,NULL,NULL},
31-
{"Tablespace",tblspc_redo,tblspc_desc,NULL,NULL},
32-
{"MultiXact",multixact_redo,multixact_desc,NULL,NULL},
33-
{"Reserved 7",NULL,NULL,NULL,NULL},
34-
{"Reserved 8",NULL,NULL,NULL,NULL},
35-
{"Reserved 9",NULL,NULL,NULL,NULL},
36-
{"Heap",heap_redo,heap_desc,NULL,NULL},
37-
{"Btree",btree_redo,btree_desc,btree_xlog_startup,btree_xlog_cleanup},
38-
{"Hash",hash_redo,hash_desc,NULL,NULL},
39-
{"Gin",gin_redo,gin_desc,gin_xlog_startup,gin_xlog_cleanup},
40-
{"Gist",gist_redo,gist_desc,gist_xlog_startup,gist_xlog_cleanup},
41-
{"Sequence",seq_redo,seq_desc,NULL,NULL}
26+
{"XLOG",xlog_redo,xlog_desc,NULL,NULL,NULL},
27+
{"Transaction",xact_redo,xact_desc,NULL,NULL,NULL},
28+
{"Storage",smgr_redo,smgr_desc,NULL,NULL,NULL},
29+
{"CLOG",clog_redo,clog_desc,NULL,NULL,NULL},
30+
{"Database",dbase_redo,dbase_desc,NULL,NULL,NULL},
31+
{"Tablespace",tblspc_redo,tblspc_desc,NULL,NULL,NULL},
32+
{"MultiXact",multixact_redo,multixact_desc,NULL,NULL,NULL},
33+
{"Reserved 7",NULL,NULL,NULL,NULL,NULL},
34+
{"Reserved 8",NULL,NULL,NULL,NULL,NULL},
35+
{"Reserved 9",NULL,NULL,NULL,NULL,NULL},
36+
{"Heap",heap_redo,heap_desc,NULL,NULL,NULL},
37+
{"Btree",btree_redo,btree_desc,btree_xlog_startup,btree_xlog_cleanup,btree_safe_restartpoint},
38+
{"Hash",hash_redo,hash_desc,NULL,NULL,NULL},
39+
{"Gin",gin_redo,gin_desc,gin_xlog_startup,gin_xlog_cleanup,gin_safe_restartpoint},
40+
{"Gist",gist_redo,gist_desc,gist_xlog_startup,gist_xlog_cleanup,gist_safe_restartpoint},
41+
{"Sequence",seq_redo,seq_desc,NULL,NULL,NULL}
4242
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp