1
1
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
2
- index 367c30adb01..7ab806622fb 100644
2
+ index 863f89f19d2..8f3143758ab 100644
3
3
--- a/src/backend/commands/dbcommands.c
4
4
+++ b/src/backend/commands/dbcommands.c
5
- @@ -57 ,6 +57 ,7 @@
6
- #include "storage/lmgr .h"
5
+ @@ -56 ,6 +56 ,7 @@
6
+ #include "storage/ipc .h"
7
7
#include "storage/md.h"
8
8
#include "storage/procarray.h"
9
9
+ #include "storage/ptrack.h"
10
10
#include "storage/smgr.h"
11
11
#include "utils/acl.h"
12
12
#include "utils/builtins.h"
13
- @@ -659 ,6 +660 ,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
13
+ @@ -638 ,6 +639 ,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
14
14
* We don't need to copy subdirectories
15
15
*/
16
16
copydir(srcpath, dstpath, false);
17
17
+ ptrack_walkdir(dstpath, dboid, dsttablespace);
18
18
19
19
/* Record the filesystem change in XLOG */
20
20
{
21
- @@ -1305 ,6 +1307 ,7 @@ movedb(const char *dbname, const char *tblspcname)
21
+ @@ -1276 ,6 +1278 ,7 @@ movedb(const char *dbname, const char *tblspcname)
22
22
* Copy files from the old tablespace to the new one
23
23
*/
24
24
copydir(src_dbpath, dst_dbpath, false);
25
25
+ ptrack_walkdir(dst_dbpath, db_id, dst_tblspcoid);
26
26
27
27
/*
28
28
* Record the filesystem change in XLOG
29
- @@ -2216 ,6 +2219 ,7 @@ dbase_redo(XLogReaderState *record)
29
+ @@ -2139 ,6 +2142 ,7 @@ dbase_redo(XLogReaderState *record)
30
30
* We don't need to copy subdirectories
31
31
*/
32
32
copydir(src_path, dst_path, false);
@@ -35,7 +35,7 @@ index 367c30adb01..7ab806622fb 100644
35
35
else if (info == XLOG_DBASE_DROP)
36
36
{
37
37
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
38
- index 1423e6cd1f8..1c8de70c275 100644
38
+ index a73893237a4..2a2e17fb33e 100644
39
39
--- a/src/backend/replication/basebackup.c
40
40
+++ b/src/backend/replication/basebackup.c
41
41
@@ -36,6 +36,7 @@
@@ -46,7 +46,7 @@ index 1423e6cd1f8..1c8de70c275 100644
46
46
#include "storage/reinit.h"
47
47
#include "utils/builtins.h"
48
48
#include "utils/ps_status.h"
49
- @@ -193 ,6 +194 ,10 @@ static const char *const excludeFiles[] =
49
+ @@ -195 ,6 +196 ,10 @@ static const char *excludeFiles[] =
50
50
"postmaster.pid",
51
51
"postmaster.opts",
52
52
@@ -58,10 +58,10 @@ index 1423e6cd1f8..1c8de70c275 100644
58
58
NULL
59
59
};
60
60
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
61
- index aba39604811..be265e51c1c 100644
61
+ index 7332e6b5903..08693933e18 100644
62
62
--- a/src/backend/storage/buffer/bufmgr.c
63
63
+++ b/src/backend/storage/buffer/bufmgr.c
64
- @@ -689 ,7 +689 ,8 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
64
+ @@ -688 ,7 +688 ,8 @@ ReadBufferWithoutRelcache(RelFileNode rnode, ForkNumber forkNum,
65
65
66
66
SMgrRelation smgr = smgropen(rnode, InvalidBackendId);
67
67
@@ -72,31 +72,30 @@ index aba39604811..be265e51c1c 100644
72
72
return ReadBuffer_common(smgr, RELPERSISTENCE_PERMANENT, forkNum, blockNum,
73
73
mode, strategy, &hit);
74
74
diff --git a/src/backend/storage/smgr/Makefile b/src/backend/storage/smgr/Makefile
75
- index 596b564656f..56cb1df7fb4 100644
75
+ index e486b7c0d1c..3c8f15b1444 100644
76
76
--- a/src/backend/storage/smgr/Makefile
77
77
+++ b/src/backend/storage/smgr/Makefile
78
- @@ -14,6 +14,7 @@ include $(top_builddir)/src/Makefile.global
78
+ @@ -12,6 +12,6 @@ subdir = src/backend/storage/smgr
79
+ top_builddir = ../../../..
80
+ include $(top_builddir)/src/Makefile.global
79
81
80
- OBJS = \
81
- md.o \
82
- - smgr.o
83
- + smgr.o \
84
- + ptrack.o
82
+ - OBJS = md.o smgr.o
83
+ + OBJS = md.o smgr.o ptrack.o
85
84
86
85
include $(top_srcdir)/src/backend/common.mk
87
86
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
88
- index 85b71154006..b43fd32a549 100644
87
+ index 050cee5f9a9..94a7a1f7a1c 100644
89
88
--- a/src/backend/storage/smgr/md.c
90
89
+++ b/src/backend/storage/smgr/md.c
91
- @@ -35,6 +35,7 @@
92
- #include "storage/bufmgr.h"
90
+ @@ -33,6 +33,7 @@
93
91
#include "storage/fd.h"
92
+ #include "storage/bufmgr.h"
94
93
#include "storage/md.h"
95
94
+ #include "storage/ptrack.h"
96
95
#include "storage/relfilenode.h"
97
96
#include "storage/smgr.h"
98
97
#include "storage/sync.h"
99
- @@ -436 ,6 +437 ,8 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
98
+ @@ -422 ,6 +423 ,8 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
100
99
register_dirty_segment(reln, forknum, v);
101
100
102
101
Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
@@ -105,7 +104,7 @@ index 85b71154006..b43fd32a549 100644
105
104
}
106
105
107
106
/*
108
- @@ -717 ,6 +720 ,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
107
+ @@ -692 ,6 +695 ,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
109
108
110
109
if (!skipFsync && !SmgrIsTemp(reln))
111
110
register_dirty_segment(reln, forknum, v);
@@ -116,7 +115,7 @@ index 85b71154006..b43fd32a549 100644
116
115
/*
117
116
diff --git a/src/backend/storage/smgr/ptrack.c b/src/backend/storage/smgr/ptrack.c
118
117
new file mode 100644
119
- index 00000000000..d3b75dfcc21
118
+ index 00000000000..b4e731cf652
120
119
--- /dev/null
121
120
+++ b/src/backend/storage/smgr/ptrack.c
122
121
@@ -0,0 +1,655 @@
@@ -776,7 +775,7 @@ index 00000000000..d3b75dfcc21
776
775
+ }
777
776
+ }
778
777
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
779
- index 9cb7c650331..0d5840f09e1 100644
778
+ index 705f229b27f..87c5d4f965d 100644
780
779
--- a/src/backend/storage/sync/sync.c
781
780
+++ b/src/backend/storage/sync/sync.c
782
781
@@ -28,6 +28,7 @@
@@ -785,8 +784,8 @@ index 9cb7c650331..0d5840f09e1 100644
785
784
#include "storage/md.h"
786
785
+ #include "storage/ptrack.h"
787
786
#include "utils/hsearch.h"
788
- #include "utils/inval.h"
789
787
#include "utils/memutils.h"
788
+ #include "utils/inval.h"
790
789
@@ -418,6 +419,13 @@ ProcessSyncRequests(void)
791
790
CheckpointStats.ckpt_longest_sync = longest;
792
791
CheckpointStats.ckpt_agg_sync_time = total_elapsed;
@@ -802,26 +801,27 @@ index 9cb7c650331..0d5840f09e1 100644
802
801
sync_in_progress = false;
803
802
}
804
803
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
805
- index 62285792eca..a746dd03b51 100644
804
+ index dc8f910ea46..74bda8275cd 100644
806
805
--- a/src/backend/utils/misc/guc.c
807
806
+++ b/src/backend/utils/misc/guc.c
808
- @@ -78,6 +78,7 @@
807
+ @@ -78,6 +78,8 @@
809
808
#include "storage/pg_shmem.h"
810
- #include "storage/predicate.h"
811
809
#include "storage/proc.h"
810
+ #include "storage/predicate.h"
812
811
+ #include "storage/ptrack.h"
813
- #include "storage/standby.h"
812
+ + #include "storage/standby.h"
814
813
#include "tcop/tcopprot.h"
815
814
#include "tsearch/ts_cache.h"
816
- @@ -589,6 +590,7 @@ static char *recovery_target_xid_string;
815
+ #include "utils/builtins.h"
816
+ @@ -581,6 +583,7 @@ static char *recovery_target_xid_string;
817
817
static char *recovery_target_name_string;
818
818
static char *recovery_target_lsn_string;
819
819
820
820
+ static int ptrack_map_size_tmp;
821
821
822
822
/* should be static, but commands/variable.c needs to get at this */
823
823
char *role_string;
824
- @@ -1978 ,6 +1980 ,16 @@ static struct config_bool ConfigureNamesBool[] =
824
+ @@ -1961 ,6 +1964 ,16 @@ static struct config_bool ConfigureNamesBool[] =
825
825
826
826
static struct config_int ConfigureNamesInt[] =
827
827
{
@@ -839,10 +839,10 @@ index 62285792eca..a746dd03b51 100644
839
839
{"archive_timeout", PGC_SIGHUP, WAL_ARCHIVING,
840
840
gettext_noop("Forces a switch to the next WAL file if a "
841
841
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
842
- index fd14844eecf..e735932db8a 100644
842
+ index 601f7e9690e..f8bb8ff521f 100644
843
843
--- a/src/bin/pg_rewind/filemap.c
844
844
+++ b/src/bin/pg_rewind/filemap.c
845
- @@ -102 ,6 +102 ,9 @@ static const char *excludeFiles[] =
845
+ @@ -103 ,6 +103 ,9 @@ static const char *excludeFiles[] =
846
846
"postmaster.pid",
847
847
"postmaster.opts",
848
848
@@ -854,7 +854,7 @@ index fd14844eecf..e735932db8a 100644
854
854
};
855
855
diff --git a/src/include/storage/ptrack.h b/src/include/storage/ptrack.h
856
856
new file mode 100644
857
- index 00000000000..3dd504f1375
857
+ index 00000000000..67c66913479
858
858
--- /dev/null
859
859
+++ b/src/include/storage/ptrack.h
860
860
@@ -0,0 +1,129 @@
0 commit comments