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

Commit1d919de

Browse files
committed
Remove unnecessary call to ReadCheckpointRecord().
It should always be the case that the last checkpoint record is stillreadable, because otherwise, a crash would leave us in a situationfrom which we can't recover. Therefore the test removed by this patchshould always succeed. For it to fail, either there has to be a seriousbug in the code someplace, or the user has to be manually modifyingpg_wal while crash recovery is running. If it's the first one, weshould fix the bug. If it's the second one, they should stop, oranyway they're doing so at their own risk. In neither case doesa full checkpoint instead of an end-of-recovery record seem like aclear winner. Furthermore, rarely-taken code paths are particularlyvulnerable to bugs, so let's simplify by getting rid of this one.Discussion:http://postgr.es/m/CA+TgmoYmw==TOJ6EzYb_vcjyS09NkzrVKSyBKUUyo1zBEaJASA@mail.gmail.com
1 parent3df93a6 commit1d919de

File tree

1 file changed

+11
-23
lines changed
  • src/backend/access/transam

1 file changed

+11
-23
lines changed

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

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7917,33 +7917,21 @@ StartupXLOG(void)
79177917
{
79187918
if (LocalPromoteIsTriggered)
79197919
{
7920-
checkPointLoc=ControlFile->checkPoint;
7920+
promoted=true;
79217921

79227922
/*
7923-
* Confirm the last checkpoint is available for us to recover
7924-
* from if we fail.
7923+
* Insert a special WAL record to mark the end of recovery,
7924+
* since we aren't doing a checkpoint. That means that the
7925+
* checkpointer process may likely be in the middle of a
7926+
* time-smoothed restartpoint and could continue to be for
7927+
* minutes after this. That sounds strange, but the effect is
7928+
* roughly the same and it would be stranger to try to come
7929+
* out of the restartpoint and then checkpoint. We request a
7930+
* checkpoint later anyway, just for safety.
79257931
*/
7926-
record=ReadCheckpointRecord(xlogreader,checkPointLoc,1, false);
7927-
if (record!=NULL)
7928-
{
7929-
promoted= true;
7930-
7931-
/*
7932-
* Insert a special WAL record to mark the end of
7933-
* recovery, since we aren't doing a checkpoint. That
7934-
* means that the checkpointer process may likely be in
7935-
* the middle of a time-smoothed restartpoint and could
7936-
* continue to be for minutes after this. That sounds
7937-
* strange, but the effect is roughly the same and it
7938-
* would be stranger to try to come out of the
7939-
* restartpoint and then checkpoint. We request a
7940-
* checkpoint later anyway, just for safety.
7941-
*/
7942-
CreateEndOfRecoveryRecord();
7943-
}
7932+
CreateEndOfRecoveryRecord();
79447933
}
7945-
7946-
if (!promoted)
7934+
else
79477935
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
79487936
CHECKPOINT_IMMEDIATE |
79497937
CHECKPOINT_WAIT);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp