mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Add infrastructure for sharing temporary files between backends.
SharedFileSet allows temporary files to be created by one backend and
then exported for read-only access by other backends, with clean-up
managed by reference counting associated with a DSM segment. This
includes changes to fd.c and buffile.c to support the new kind of
temporary file.
This will be used by an upcoming patch adding support for parallel
hash joins.
Author: Thomas Munro
Reviewed-By: Peter Geoghegan, Andres Freund, Robert Haas, Rushabh Lathia
Discussion:
https://postgr.es/m/CAEepm=2W=cOkiZxcg6qiFQP-dHUe09aqTrEMM7yJDrHMhDv_RA@mail.gmail.com
https://postgr.es/m/CAH2-WznJ_UgLux=_jTgCQ4yFz0iBntudsNKa1we3kN1BAG=88w@mail.gmail.com
This commit is contained in:
@@ -79,6 +79,14 @@ extern int FileGetRawDesc(File file);
|
||||
extern int FileGetRawFlags(File file);
|
||||
extern mode_t FileGetRawMode(File file);
|
||||
|
||||
/* Operations used for sharing named temporary files */
|
||||
extern File PathNameCreateTemporaryFile(const char *name, bool error_on_failure);
|
||||
extern File PathNameOpenTemporaryFile(const char *name);
|
||||
extern bool PathNameDeleteTemporaryFile(const char *name, bool error_on_failure);
|
||||
extern void PathNameCreateTemporaryDir(const char *base, const char *name);
|
||||
extern void PathNameDeleteTemporaryDir(const char *name);
|
||||
extern void TempTablespacePath(char *path, Oid tablespace);
|
||||
|
||||
/* Operations that allow use of regular stdio --- USE WITH CAUTION */
|
||||
extern FILE *AllocateFile(const char *name, const char *mode);
|
||||
extern int FreeFile(FILE *file);
|
||||
@@ -107,6 +115,7 @@ extern void set_max_safe_fds(void);
|
||||
extern void closeAllVfds(void);
|
||||
extern void SetTempTablespaces(Oid *tableSpaces, int numSpaces);
|
||||
extern bool TempTablespacesAreSet(void);
|
||||
extern int GetTempTablespaces(Oid *tableSpaces, int numSpaces);
|
||||
extern Oid GetNextTempTableSpace(void);
|
||||
extern void AtEOXact_Files(void);
|
||||
extern void AtEOSubXact_Files(bool isCommit, SubTransactionId mySubid,
|
||||
@@ -124,7 +133,7 @@ extern int durable_unlink(const char *fname, int loglevel);
|
||||
extern int durable_link_or_rename(const char *oldfile, const char *newfile, int loglevel);
|
||||
extern void SyncDataDirectory(void);
|
||||
|
||||
/* Filename components for OpenTemporaryFile */
|
||||
/* Filename components */
|
||||
#define PG_TEMP_FILES_DIR "pgsql_tmp"
|
||||
#define PG_TEMP_FILE_PREFIX "pgsql_tmp"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user