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

Commit1b4f1c6

Browse files
committed
Ensure that creation of an empty relfile is fsync'd at checkpoint.
If you create a table and don't insert any data into it, the relation fileis never fsync'd. You don't lose data, because an empty table doesn't haveany data to begin with, but if you crash and lose the file, subsequentoperations on the table will fail with "could not open file" error.To fix, register an fsync request in mdcreate(), like we do for mdwrite().Per discussion, we probably should also fsync the containing directoryafter creating a new file. But that's a separate and much wider issue.Backpatch to all supported versions.Reviewed-by: Andres Freund, Thomas MunroDiscussion:https://www.postgresql.org/message-id/d47d8122-415e-425c-d0a2-e0160829702d%40iki.fi
1 parent3bba0f9 commit1b4f1c6

File tree

1 file changed

+3
-0
lines changed
  • src/backend/storage/smgr

1 file changed

+3
-0
lines changed

‎src/backend/storage/smgr/md.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
211211
mdfd=&reln->md_seg_fds[forkNum][0];
212212
mdfd->mdfd_vfd=fd;
213213
mdfd->mdfd_segno=0;
214+
215+
if (!SmgrIsTemp(reln))
216+
register_dirty_segment(reln,forkNum,mdfd);
214217
}
215218

216219
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp