aboutsummaryrefslogtreecommitdiff
path: root/src
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
commitfd48e5f5d3a14dda804e7b74e16dac6f5ab1b781 (patch)
tree236d2ca3e57f625b53f00714b9bcab0d72de138b /src
parentb5f634116e8f3e264cc06c053bd7b4e25a615665 (diff)
downloadpostgresql-fd48e5f5d3a14dda804e7b74e16dac6f5ab1b781.tar.gz
postgresql-fd48e5f5d3a14dda804e7b74e16dac6f5ab1b781.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')
-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 56c61234bd2..39748bbd85b 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -1289,4 +1289,7 @@ CheckPointLogicalRewriteHeap(void)
}
}
FreeDir(mappings_dir);
+
+ /* persist directory entries to disk */
+ fsync_fname("pg_logical/mappings", true);
}