diff --git a/patches/master-ptrack-core.diff b/patches/master-ptrack-core.diff index 2835453..80c8654 100644 --- a/patches/master-ptrack-core.diff +++ b/patches/master-ptrack-core.diff @@ -1,8 +1,8 @@ diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c -index ee0fb0e28f..3c0060e233 100644 +index 22d0a2e8c3a..3f597e54c59 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c -@@ -134,6 +134,7 @@ int wal_retrieve_retry_interval = 5000; +@@ -137,6 +137,7 @@ int wal_retrieve_retry_interval = 5000; int max_slot_wal_keep_size_mb = -1; int wal_decode_buffer_size = 512 * 1024; bool track_wal_io_timing = false; @@ -10,7 +10,7 @@ index ee0fb0e28f..3c0060e233 100644 #ifdef WAL_DEBUG bool XLOG_DEBUG = false; -@@ -8851,6 +8852,12 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces, +@@ -8945,6 +8946,12 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces, { bool checkpointfpw; @@ -24,37 +24,36 @@ index ee0fb0e28f..3c0060e233 100644 * Force a CHECKPOINT. Aside from being necessary to prevent torn * page problems, this guarantees that two successive backup runs diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c -index 01b35e26bd..cb1cf43434 100644 +index 2be4e069816..af00164b01d 100644 --- a/src/backend/backup/basebackup.c +++ b/src/backend/backup/basebackup.c -@@ -220,6 +220,13 @@ static const struct exclude_list_item excludeFiles[] = +@@ -219,6 +219,12 @@ static const struct exclude_list_item excludeFiles[] = + {"postmaster.pid", false}, {"postmaster.opts", false}, - + /* + * Skip all transient ptrack files, but do copy ptrack.map, since it may + * be successfully used immediately after backup. TODO: check, test? + */ + {"ptrack.map.mmap", false}, + {"ptrack.map.tmp", false}, -+ + /* end of list */ {NULL, false} - }; diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c -index d4fbe54207..b108416c70 100644 +index aa8c64a2c9e..56ed1b4df0a 100644 --- a/src/backend/storage/file/copydir.c +++ b/src/backend/storage/file/copydir.c -@@ -27,6 +27,8 @@ +@@ -30,6 +30,8 @@ #include "storage/copydir.h" #include "storage/fd.h" +copydir_hook_type copydir_hook = NULL; + - /* - * copydir: copy a directory - * -@@ -75,6 +77,9 @@ copydir(const char *fromdir, const char *todir, bool recurse) + /* GUCs */ + int file_copy_method = FILE_COPY_METHOD_COPY; + +@@ -91,6 +93,9 @@ copydir(const char *fromdir, const char *todir, bool recurse) } FreeDir(xldir); @@ -65,10 +64,10 @@ index d4fbe54207..b108416c70 100644 * Be paranoid here and fsync all files to ensure the copy is really done. * But if fsync is disabled, we're done. diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c -index 6796756358..ab27356a5a 100644 +index e3f335a8340..aa36716d9fb 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c -@@ -85,6 +85,8 @@ typedef struct _MdfdVec +@@ -96,6 +96,8 @@ typedef struct _MdfdVec static MemoryContext MdCxt; /* context for all MdfdVec objects */ @@ -77,7 +76,7 @@ index 6796756358..ab27356a5a 100644 /* Populate a file tag describing an md.c segment file. */ #define INIT_MD_FILETAG(a,xx_rlocator,xx_forknum,xx_segno) \ -@@ -513,6 +515,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, +@@ -540,6 +542,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, register_dirty_segment(reln, forknum, v); Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE)); @@ -87,7 +86,7 @@ index 6796756358..ab27356a5a 100644 } /* -@@ -620,6 +625,12 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum, +@@ -647,6 +652,12 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum, remblocks -= numblocks; curblocknum += numblocks; @@ -100,7 +99,7 @@ index 6796756358..ab27356a5a 100644 } } -@@ -1015,7 +1026,14 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, +@@ -1149,7 +1160,14 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, nblocks -= nblocks_this_segment; buffers += nblocks_this_segment; @@ -117,7 +116,7 @@ index 6796756358..ab27356a5a 100644 } diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c -index ab7137d0ff..bc40a763c0 100644 +index fc16db90133..08cd553ad55 100644 --- a/src/backend/storage/sync/sync.c +++ b/src/backend/storage/sync/sync.c @@ -74,6 +74,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */ @@ -140,10 +139,10 @@ index ab7137d0ff..bc40a763c0 100644 sync_in_progress = false; } diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c -index 537d92c0cf..bac656021d 100644 +index fec79992c8d..3191c7998dd 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c -@@ -79,6 +79,11 @@ static Latch LocalLatchData; +@@ -80,6 +80,11 @@ static Latch LocalLatchData; bool IgnoreSystemIndexes = false; @@ -155,7 +154,7 @@ index 537d92c0cf..bac656021d 100644 /* ---------------------------------------------------------------- * common process startup code -@@ -1848,6 +1853,8 @@ process_shared_preload_libraries(void) +@@ -1856,6 +1861,8 @@ process_shared_preload_libraries(void) false); process_shared_preload_libraries_in_progress = false; process_shared_preload_libraries_done = true; @@ -164,7 +163,7 @@ index 537d92c0cf..bac656021d 100644 } /* -@@ -1890,3 +1897,71 @@ pg_bindtextdomain(const char *domain) +@@ -1898,3 +1905,71 @@ pg_bindtextdomain(const char *domain) } #endif } @@ -237,7 +236,7 @@ index 537d92c0cf..bac656021d 100644 +#undef PTRACK_PATH +#undef PTRACK_PATH_TMP diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c -index b5bb0e7887..11611b15f8 100644 +index 46cb2f36efa..428ce4c5bfe 100644 --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -110,6 +110,11 @@ static const struct exclude_list_item skip[] = { @@ -253,10 +252,10 @@ index b5bb0e7887..11611b15f8 100644 {"config_exec_params", true}, #endif diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c -index e9dcb5a6d8..844b04d5e1 100644 +index 8d5d9805279..4a95fabb076 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c -@@ -86,6 +86,7 @@ static void FindEndOfXLOG(void); +@@ -90,6 +90,7 @@ static void FindEndOfXLOG(void); static void KillExistingXLOG(void); static void KillExistingArchiveStatus(void); static void KillExistingWALSummaries(void); @@ -264,7 +263,7 @@ index e9dcb5a6d8..844b04d5e1 100644 static void WriteEmptyXLOG(void); static void usage(void); -@@ -495,6 +496,7 @@ main(int argc, char *argv[]) +@@ -523,6 +524,7 @@ main(int argc, char *argv[]) KillExistingXLOG(); KillExistingArchiveStatus(); KillExistingWALSummaries(); @@ -272,7 +271,7 @@ index e9dcb5a6d8..844b04d5e1 100644 WriteEmptyXLOG(); printf(_("Write-ahead log reset\n")); -@@ -998,6 +1000,41 @@ KillExistingXLOG(void) +@@ -1018,6 +1020,40 @@ KillExistingXLOG(void) pg_fatal("could not close directory \"%s\": %m", XLOGDIR); } @@ -310,15 +309,14 @@ index e9dcb5a6d8..844b04d5e1 100644 + if (closedir(xldir)) + pg_fatal("could not close directory \"%s\": %m", PTRACKDIR); +} -+ /* * Remove existing archive status files diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c -index 4458324c9d..7d857467f7 100644 +index 467fd97ebcf..af0a646b251 100644 --- a/src/bin/pg_rewind/filemap.c +++ b/src/bin/pg_rewind/filemap.c -@@ -156,6 +156,10 @@ static const struct exclude_list_item excludeFiles[] = +@@ -186,6 +186,10 @@ static const struct exclude_list_item excludeFiles[] = {"postmaster.pid", false}, {"postmaster.opts", false}, @@ -330,7 +328,7 @@ index 4458324c9d..7d857467f7 100644 {NULL, false} }; diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h -index 083810f5b4..51667297d5 100644 +index 605280ed8fb..f0f30cb6168 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -59,6 +59,9 @@ extern PGDLLIMPORT int wal_decode_buffer_size; @@ -344,12 +342,12 @@ index 083810f5b4..51667297d5 100644 typedef enum ArchiveMode { diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h -index a25e258f47..b20b9c76e8 100644 +index f1d7beeed1a..f162c4405dc 100644 --- a/src/include/storage/copydir.h +++ b/src/include/storage/copydir.h -@@ -13,6 +13,9 @@ - #ifndef COPYDIR_H - #define COPYDIR_H +@@ -22,6 +22,9 @@ typedef enum FileCopyMethod + /* GUC parameters */ + extern PGDLLIMPORT int file_copy_method; +typedef void (*copydir_hook_type) (const char *path); +extern PGDLLIMPORT copydir_hook_type copydir_hook; @@ -358,12 +356,12 @@ index a25e258f47..b20b9c76e8 100644 extern void copy_file(const char *fromfile, const char *tofile); diff --git a/src/include/storage/md.h b/src/include/storage/md.h -index 620f10abde..b36936871b 100644 +index b563c27abf0..29fbc1c80c3 100644 --- a/src/include/storage/md.h +++ b/src/include/storage/md.h -@@ -19,6 +19,13 @@ - #include "storage/smgr.h" - #include "storage/sync.h" +@@ -22,6 +22,13 @@ + + extern PGDLLIMPORT const PgAioHandleCallbacks aio_md_readv_cb; +typedef void (*mdextend_hook_type) (RelFileLocatorBackend smgr_rlocator, + ForkNumber forknum, BlockNumber blocknum); @@ -376,7 +374,7 @@ index 620f10abde..b36936871b 100644 extern void mdinit(void); extern void mdopen(SMgrRelation reln); diff --git a/src/include/storage/sync.h b/src/include/storage/sync.h -index 9dee8fa6e5..348ed53e4e 100644 +index c2272d14175..4132cfd92c6 100644 --- a/src/include/storage/sync.h +++ b/src/include/storage/sync.h @@ -55,6 +55,9 @@ typedef struct FileTag diff --git a/ptrack.c b/ptrack.c index f5accd3..014eaaa 100644 --- a/ptrack.c +++ b/ptrack.c @@ -28,7 +28,7 @@ #include #include -#if PG_VERSION_NUM < 120000 +#if PG_VERSION_NUM < 120000 || PG_VERSION_NUM >= 190000 #include "access/htup_details.h" #endif #include "catalog/pg_tablespace.h"