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

Commitb8b69d8

Browse files
committed
Revert "Reduce checkpoints and WAL traffic on low activity database server"
This reverts commit18fb9d8. Perdiscussion, it does not seem like a good idea to allow committed changes togo un-checkpointed indefinitely, as could happen in a low-traffic server;that makes us entirely reliant on the WAL stream with no redundancy thatmight aid data recovery in case of disk failure.This re-introduces the original problem of hot-standby setups generating asmall continuing stream of WAL traffic even when idle, but there are otherways to address that without compromising crash recovery, so we'll revisitthat issue in a future release cycle.
1 parent8b23db9 commitb8b69d8

File tree

1 file changed

+13
-15
lines changed
  • src/backend/access/transam

1 file changed

+13
-15
lines changed

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7646,10 +7646,6 @@ CreateCheckPoint(int flags)
76467646
uint32freespace;
76477647
uint32_logId;
76487648
uint32_logSeg;
7649-
uint32redo_logId;
7650-
uint32redo_logSeg;
7651-
uint32insert_logId;
7652-
uint32insert_logSeg;
76537649
TransactionId*inCommitXids;
76547650
intnInCommit;
76557651

@@ -7726,31 +7722,33 @@ CreateCheckPoint(int flags)
77267722
LWLockAcquire(WALInsertLock,LW_EXCLUSIVE);
77277723

77287724
/*
7729-
* If this isn't a shutdown or forced checkpoint, and we have notswitched
7730-
*to the next WAL file since the start of the last checkpoint, skip the
7725+
* If this isn't a shutdown or forced checkpoint, and we have notinserted
7726+
*any XLOG records since the start of the last checkpoint, skip the
77317727
* checkpoint.The idea here is to avoid inserting duplicate checkpoints
77327728
* when the system is idle. That wastes log space, and more importantly it
77337729
* exposes us to possible loss of both current and previous checkpoint
77347730
* records if the machine crashes just as we're writing the update.
77357731
* (Perhaps it'd make even more sense to checkpoint only when the previous
77367732
* checkpoint record is in a different xlog page?)
77377733
*
7738-
* While holding the WALInsertLock we find the current WAL insertion point
7739-
* and compare that with the starting point of the last checkpoint, which
7740-
* is the redo pointer. We use the redo pointer because the start and end
7741-
* points of a checkpoint can be hundreds of files apart on large systems
7742-
* when checkpoint writes are spread out over time.
7734+
* We have to make two tests to determine that nothing has happened since
7735+
* the start of the last checkpoint: current insertion point must match
7736+
* the end of the last checkpoint record, and its redo pointer must point
7737+
* to itself.
77437738
*/
77447739
if ((flags& (CHECKPOINT_IS_SHUTDOWN |CHECKPOINT_END_OF_RECOVERY |
77457740
CHECKPOINT_FORCE))==0)
77467741
{
77477742
XLogRecPtrcurInsert;
77487743

77497744
INSERT_RECPTR(curInsert,Insert,Insert->curridx);
7750-
XLByteToSeg(curInsert,insert_logId,insert_logSeg);
7751-
XLByteToSeg(ControlFile->checkPointCopy.redo,redo_logId,redo_logSeg);
7752-
if (insert_logId==redo_logId&&
7753-
insert_logSeg==redo_logSeg)
7745+
if (curInsert.xlogid==ControlFile->checkPoint.xlogid&&
7746+
curInsert.xrecoff==ControlFile->checkPoint.xrecoff+
7747+
MAXALIGN(SizeOfXLogRecord+sizeof(CheckPoint))&&
7748+
ControlFile->checkPoint.xlogid==
7749+
ControlFile->checkPointCopy.redo.xlogid&&
7750+
ControlFile->checkPoint.xrecoff==
7751+
ControlFile->checkPointCopy.redo.xrecoff)
77547752
{
77557753
LWLockRelease(WALInsertLock);
77567754
LWLockRelease(CheckpointLock);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp