Skip to content

Commit 2c15b29

Browse files
committed
fsync pg_logical/mappings in CheckPointLogicalRewriteHeap().
While individual logical rewrite files were synced to disk, the directory was not. On some filesystems that could lead to loosing directory entries after a crash. Reported-By: Tom Lane <tgl@sss.pgh.pa.us> Author: Nathan Bossart <bossartn@amazon.com> Discussion: https://postgr.es/m/867F2E29-2782-4869-970E-B984C6D35A8F@amazon.com Backpatch: 10-
1 parent 0ffe297 commit 2c15b29

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/access/heap/rewriteheap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,4 +1306,7 @@ CheckPointLogicalRewriteHeap(void)
13061306
}
13071307
}
13081308
FreeDir(mappings_dir);
1309+
1310+
/* persist directory entries to disk */
1311+
fsync_fname("pg_logical/mappings", true);
13091312
}

0 commit comments

Comments
 (0)