aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/rewriteheap.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-01-21 11:22:55 -0800
committerAndres Freund <andres@anarazel.de>2022-01-21 11:24:12 -0800
commit1c6d055ba77a5b600496a81bbaafaeb064d1cf2d (patch)
tree6e9b9cb42c340d179f4c945caba5b65bd4a1cb94 /src/backend/access/heap/rewriteheap.c
parent1c0452c48ca4e5fcdc56808a2f475bbf6b546b86 (diff)
downloadpostgresql-1c6d055ba77a5b600496a81bbaafaeb064d1cf2d.tar.gz
postgresql-1c6d055ba77a5b600496a81bbaafaeb064d1cf2d.zip
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-
Diffstat (limited to 'src/backend/access/heap/rewriteheap.c')
-rw-r--r--src/backend/access/heap/rewriteheap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index 335e29f8fa9..489c72582d3 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -1312,4 +1312,7 @@ CheckPointLogicalRewriteHeap(void)
}
}
FreeDir(mappings_dir);
+
+ /* persist directory entries to disk */
+ fsync_fname("pg_logical/mappings", true);
}