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

Commit1a2cb1e

Browse files
committed
Ensure unlogged tables are reset even if crash recovery errors out.
Unlogged relations are reset at the end of crash recovery as they'reonly synced to disk during a proper shutdown. Unfortunately that andlater steps can fail, e.g. due to running out of space. This resetwas, up to now performed after marking the database as having finishedcrash recovery successfully. As out of space errors trigger a crashrestart that could lead to the situation that not all unloggedrelations are reset.Once that happend usage of unlogged relations could yield errors like"could not open file "...": No such file or directory". Luckilyclusters that show the problem can be fixed by performing a immediateshutdown, and starting the database again.To fix, just call ResetUnloggedRelations(UNLOGGED_RELATION_INIT)earlier, before marking the database as having successfully recovered.Discussion: 20140912112246.GA4984@alap3.anarazel.deBackpatch to 9.1 where unlogged tables were introduced.Abhijit Menon-Sen and Andres Freund
1 parentdf3e23e commit1a2cb1e

File tree

1 file changed

+10
-8
lines changed
  • src/backend/access/transam

1 file changed

+10
-8
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6897,6 +6897,16 @@ StartupXLOG(void)
68976897
*/
68986898
ShutdownWalRcv();
68996899

6900+
/*
6901+
* Reset unlogged relations to the contents of their INIT fork. This is
6902+
* done AFTER recovery is complete so as to include any unlogged relations
6903+
* created during recovery, but BEFORE recovery is marked as having
6904+
* completed successfully. Otherwise we'd not retry if any of the post
6905+
* end-of-recovery steps fail.
6906+
*/
6907+
if (InRecovery)
6908+
ResetUnloggedRelations(UNLOGGED_RELATION_INIT);
6909+
69006910
/*
69016911
* We don't need the latch anymore. It's not strictly necessary to disown
69026912
* it, but let's do it for the sake of tidiness.
@@ -7164,14 +7174,6 @@ StartupXLOG(void)
71647174
*/
71657175
PreallocXlogFiles(EndOfLog);
71667176

7167-
/*
7168-
* Reset initial contents of unlogged relations. This has to be done
7169-
* AFTER recovery is complete so that any unlogged relations created
7170-
* during recovery also get picked up.
7171-
*/
7172-
if (InRecovery)
7173-
ResetUnloggedRelations(UNLOGGED_RELATION_INIT);
7174-
71757177
/*
71767178
* Okay, we're officially UP.
71777179
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp