11diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
2- index ee0fb0e28f..3c0060e233 100644
2+ index 22d0a2e8c3a..3f597e54c59 100644
33--- a/src/backend/access/transam/xlog.c
44+++ b/src/backend/access/transam/xlog.c
5- @@ -134 ,6 +134 ,7 @@ int wal_retrieve_retry_interval = 5000;
5+ @@ -137 ,6 +137 ,7 @@ int wal_retrieve_retry_interval = 5000;
66 int max_slot_wal_keep_size_mb = -1;
77 int wal_decode_buffer_size = 512 * 1024;
88 bool track_wal_io_timing = false;
99+ backup_checkpoint_request_hook_type backup_checkpoint_request_hook = NULL;
1010
1111 #ifdef WAL_DEBUG
1212 bool XLOG_DEBUG = false;
13- @@ -8851 ,6 +8852 ,12 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
13+ @@ -8945 ,6 +8946 ,12 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
1414 {
1515 bool checkpointfpw;
1616
@@ -24,37 +24,36 @@ index ee0fb0e28f..3c0060e233 100644
2424 * Force a CHECKPOINT. Aside from being necessary to prevent torn
2525 * page problems, this guarantees that two successive backup runs
2626diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c
27- index 01b35e26bd..cb1cf43434 100644
27+ index 2be4e069816..af00164b01d 100644
2828--- a/src/backend/backup/basebackup.c
2929+++ b/src/backend/backup/basebackup.c
30- @@ -220,6 +220,13 @@ static const struct exclude_list_item excludeFiles[] =
30+ @@ -219,6 +219,12 @@ static const struct exclude_list_item excludeFiles[] =
31+
3132 {"postmaster.pid", false},
3233 {"postmaster.opts", false},
33-
3434+ /*
3535+ * Skip all transient ptrack files, but do copy ptrack.map, since it may
3636+ * be successfully used immediately after backup. TODO: check, test?
3737+ */
3838+ {"ptrack.map.mmap", false},
3939+ {"ptrack.map.tmp", false},
40- +
40+
4141 /* end of list */
4242 {NULL, false}
43- };
4443diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
45- index d4fbe54207..b108416c70 100644
44+ index aa8c64a2c9e..56ed1b4df0a 100644
4645--- a/src/backend/storage/file/copydir.c
4746+++ b/src/backend/storage/file/copydir.c
48- @@ -27 ,6 +27 ,8 @@
47+ @@ -30 ,6 +30 ,8 @@
4948 #include "storage/copydir.h"
5049 #include "storage/fd.h"
5150
5251+ copydir_hook_type copydir_hook = NULL;
5352+
54- /*
55- * copydir: copy a directory
56- *
57- @@ -75 ,6 +77 ,9 @@ copydir(const char *fromdir, const char *todir, bool recurse)
53+ /* GUCs */
54+ int file_copy_method = FILE_COPY_METHOD_COPY;
55+
56+ @@ -91 ,6 +93 ,9 @@ copydir(const char *fromdir, const char *todir, bool recurse)
5857 }
5958 FreeDir(xldir);
6059
@@ -65,10 +64,10 @@ index d4fbe54207..b108416c70 100644
6564 * Be paranoid here and fsync all files to ensure the copy is really done.
6665 * But if fsync is disabled, we're done.
6766diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
68- index 6796756358..ab27356a5a 100644
67+ index e3f335a8340..aa36716d9fb 100644
6968--- a/src/backend/storage/smgr/md.c
7069+++ b/src/backend/storage/smgr/md.c
71- @@ -85 ,6 +85 ,8 @@ typedef struct _MdfdVec
70+ @@ -96 ,6 +96 ,8 @@ typedef struct _MdfdVec
7271
7372 static MemoryContext MdCxt; /* context for all MdfdVec objects */
7473
@@ -77,7 +76,7 @@ index 6796756358..ab27356a5a 100644
7776
7877 /* Populate a file tag describing an md.c segment file. */
7978 #define INIT_MD_FILETAG(a,xx_rlocator,xx_forknum,xx_segno) \
80- @@ -513 ,6 +515 ,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
79+ @@ -540 ,6 +542 ,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
8180 register_dirty_segment(reln, forknum, v);
8281
8382 Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
@@ -87,7 +86,7 @@ index 6796756358..ab27356a5a 100644
8786 }
8887
8988 /*
90- @@ -620 ,6 +625 ,12 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
89+ @@ -647 ,6 +652 ,12 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
9190
9291 remblocks -= numblocks;
9392 curblocknum += numblocks;
@@ -100,7 +99,7 @@ index 6796756358..ab27356a5a 100644
10099 }
101100 }
102101
103- @@ -1015 ,7 +1026 ,14 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
102+ @@ -1149 ,7 +1160 ,14 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
104103
105104 nblocks -= nblocks_this_segment;
106105 buffers += nblocks_this_segment;
@@ -117,7 +116,7 @@ index 6796756358..ab27356a5a 100644
117116 }
118117
119118diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
120- index ab7137d0ff..bc40a763c0 100644
119+ index fc16db90133..08cd553ad55 100644
121120--- a/src/backend/storage/sync/sync.c
122121+++ b/src/backend/storage/sync/sync.c
123122@@ -74,6 +74,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
@@ -140,10 +139,10 @@ index ab7137d0ff..bc40a763c0 100644
140139 sync_in_progress = false;
141140 }
142141diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
143- index 537d92c0cf..bac656021d 100644
142+ index fec79992c8d..3191c7998dd 100644
144143--- a/src/backend/utils/init/miscinit.c
145144+++ b/src/backend/utils/init/miscinit.c
146- @@ -79 ,6 +79 ,11 @@ static Latch LocalLatchData;
145+ @@ -80 ,6 +80 ,11 @@ static Latch LocalLatchData;
147146
148147 bool IgnoreSystemIndexes = false;
149148
@@ -155,7 +154,7 @@ index 537d92c0cf..bac656021d 100644
155154
156155 /* ----------------------------------------------------------------
157156 * common process startup code
158- @@ -1848 ,6 +1853 ,8 @@ process_shared_preload_libraries(void)
157+ @@ -1856 ,6 +1861 ,8 @@ process_shared_preload_libraries(void)
159158 false);
160159 process_shared_preload_libraries_in_progress = false;
161160 process_shared_preload_libraries_done = true;
@@ -164,7 +163,7 @@ index 537d92c0cf..bac656021d 100644
164163 }
165164
166165 /*
167- @@ -1890 ,3 +1897 ,71 @@ pg_bindtextdomain(const char *domain)
166+ @@ -1898 ,3 +1905 ,71 @@ pg_bindtextdomain(const char *domain)
168167 }
169168 #endif
170169 }
@@ -237,7 +236,7 @@ index 537d92c0cf..bac656021d 100644
237236+ #undef PTRACK_PATH
238237+ #undef PTRACK_PATH_TMP
239238diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
240- index b5bb0e7887..11611b15f8 100644
239+ index 46cb2f36efa..428ce4c5bfe 100644
241240--- a/src/bin/pg_checksums/pg_checksums.c
242241+++ b/src/bin/pg_checksums/pg_checksums.c
243242@@ -110,6 +110,11 @@ static const struct exclude_list_item skip[] = {
@@ -253,26 +252,26 @@ index b5bb0e7887..11611b15f8 100644
253252 {"config_exec_params", true},
254253 #endif
255254diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
256- index e9dcb5a6d8..844b04d5e1 100644
255+ index 8d5d9805279..4a95fabb076 100644
257256--- a/src/bin/pg_resetwal/pg_resetwal.c
258257+++ b/src/bin/pg_resetwal/pg_resetwal.c
259- @@ -86 ,6 +86 ,7 @@ static void FindEndOfXLOG(void);
258+ @@ -90 ,6 +90 ,7 @@ static void FindEndOfXLOG(void);
260259 static void KillExistingXLOG(void);
261260 static void KillExistingArchiveStatus(void);
262261 static void KillExistingWALSummaries(void);
263262+ static void KillExistingPtrack(void);
264263 static void WriteEmptyXLOG(void);
265264 static void usage(void);
266265
267- @@ -495 ,6 +496 ,7 @@ main(int argc, char *argv[])
266+ @@ -523 ,6 +524 ,7 @@ main(int argc, char *argv[])
268267 KillExistingXLOG();
269268 KillExistingArchiveStatus();
270269 KillExistingWALSummaries();
271270+ KillExistingPtrack();
272271 WriteEmptyXLOG();
273272
274273 printf(_("Write-ahead log reset\n"));
275- @@ -998 ,6 +1000,41 @@ KillExistingXLOG(void)
274+ @@ -1018 ,6 +1020,40 @@ KillExistingXLOG(void)
276275 pg_fatal("could not close directory \"%s\": %m", XLOGDIR);
277276 }
278277
@@ -310,15 +309,14 @@ index e9dcb5a6d8..844b04d5e1 100644
310309+ if (closedir(xldir))
311310+ pg_fatal("could not close directory \"%s\": %m", PTRACKDIR);
312311+ }
313- +
314312
315313 /*
316314 * Remove existing archive status files
317315diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
318- index 4458324c9d..7d857467f7 100644
316+ index 467fd97ebcf..af0a646b251 100644
319317--- a/src/bin/pg_rewind/filemap.c
320318+++ b/src/bin/pg_rewind/filemap.c
321- @@ -156 ,6 +156 ,10 @@ static const struct exclude_list_item excludeFiles[] =
319+ @@ -186 ,6 +186 ,10 @@ static const struct exclude_list_item excludeFiles[] =
322320 {"postmaster.pid", false},
323321 {"postmaster.opts", false},
324322
@@ -330,7 +328,7 @@ index 4458324c9d..7d857467f7 100644
330328 {NULL, false}
331329 };
332330diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
333- index 083810f5b4..51667297d5 100644
331+ index 605280ed8fb..f0f30cb6168 100644
334332--- a/src/include/access/xlog.h
335333+++ b/src/include/access/xlog.h
336334@@ -59,6 +59,9 @@ extern PGDLLIMPORT int wal_decode_buffer_size;
@@ -344,12 +342,12 @@ index 083810f5b4..51667297d5 100644
344342 typedef enum ArchiveMode
345343 {
346344diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h
347- index a25e258f47..b20b9c76e8 100644
345+ index f1d7beeed1a..f162c4405dc 100644
348346--- a/src/include/storage/copydir.h
349347+++ b/src/include/storage/copydir.h
350- @@ -13 ,6 +13 ,9 @@
351- #ifndef COPYDIR_H
352- #define COPYDIR_H
348+ @@ -22 ,6 +22 ,9 @@ typedef enum FileCopyMethod
349+ /* GUC parameters */
350+ extern PGDLLIMPORT int file_copy_method;
353351
354352+ typedef void (*copydir_hook_type) (const char *path);
355353+ extern PGDLLIMPORT copydir_hook_type copydir_hook;
@@ -358,12 +356,12 @@ index a25e258f47..b20b9c76e8 100644
358356 extern void copy_file(const char *fromfile, const char *tofile);
359357
360358diff --git a/src/include/storage/md.h b/src/include/storage/md.h
361- index 620f10abde..b36936871b 100644
359+ index b563c27abf0..29fbc1c80c3 100644
362360--- a/src/include/storage/md.h
363361+++ b/src/include/storage/md.h
364- @@ -19 ,6 +19 ,13 @@
365- #include "storage/smgr.h"
366- #include "storage/sync.h"
362+ @@ -22 ,6 +22 ,13 @@
363+
364+ extern PGDLLIMPORT const PgAioHandleCallbacks aio_md_readv_cb;
367365
368366+ typedef void (*mdextend_hook_type) (RelFileLocatorBackend smgr_rlocator,
369367+ ForkNumber forknum, BlockNumber blocknum);
@@ -376,7 +374,7 @@ index 620f10abde..b36936871b 100644
376374 extern void mdinit(void);
377375 extern void mdopen(SMgrRelation reln);
378376diff --git a/src/include/storage/sync.h b/src/include/storage/sync.h
379- index 9dee8fa6e5..348ed53e4e 100644
377+ index c2272d14175..4132cfd92c6 100644
380378--- a/src/include/storage/sync.h
381379+++ b/src/include/storage/sync.h
382380@@ -55,6 +55,9 @@ typedef struct FileTag
0 commit comments