mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Refactor the fsync queue for wider use.
Previously, md.c and checkpointer.c were tightly integrated so that fsync calls could be handed off and processed in the background. Introduce a system of callbacks and file tags, so that other modules can hand off fsync work in the same way. For now only md.c uses the new interface, but other users are being proposed. Since there may be use cases that are not strictly SMGR implementations, use a new function table for sync handlers rather than extending the traditional SMGR one. Instead of using a bitmapset of segment numbers for each RelFileNode in the checkpointer's hash table, make the segment number part of the key. This requires sending explicit "forget" requests for every segment individually when relations are dropped, but suits the file layout schemes of proposed future users better (ie sparse or high segment numbers). Author: Shawn Debnath and Thomas Munro Reviewed-by: Thomas Munro, Andres Freund Discussion: https://postgr.es/m/CAEepm=2gTANm=e3ARnJT=n0h8hf88wqmaZxk0JYkxw+b21fNrw@mail.gmail.com
This commit is contained in:
@@ -54,6 +54,18 @@ extern PGDLLIMPORT bool data_sync_retry;
|
||||
*/
|
||||
extern int max_safe_fds;
|
||||
|
||||
/*
|
||||
* On Windows, we have to interpret EACCES as possibly meaning the same as
|
||||
* ENOENT, because if a file is unlinked-but-not-yet-gone on that platform,
|
||||
* that's what you get. Ugh. This code is designed so that we don't
|
||||
* actually believe these cases are okay without further evidence (namely,
|
||||
* a pending fsync request getting canceled ... see ProcessSyncRequests).
|
||||
*/
|
||||
#ifndef WIN32
|
||||
#define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT)
|
||||
#else
|
||||
#define FILE_POSSIBLY_DELETED(err) ((err) == ENOENT || (err) == EACCES)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* prototypes for functions in fd.c
|
||||
|
||||
Reference in New Issue
Block a user