Skip to content

Commit 1b517ac

Browse files
committed
update master's patch due to changes in md.c and basebackup.c
- basebaskup now relies on file being relation file to check its checksum. - vectored mdwritev were made instead of single-buffer mdwrite
1 parent 107b2d0 commit 1b517ac

File tree

1 file changed

+37
-43
lines changed

1 file changed

+37
-43
lines changed

patches/master-ptrack-core.diff

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c
2-
index 45be21131c5..134e677f9d1 100644
2+
index 5fbbe5ffd20..3c9b99f851d 100644
33
--- a/src/backend/backup/basebackup.c
44
+++ b/src/backend/backup/basebackup.c
5-
@@ -199,6 +199,13 @@ static const struct exclude_list_item excludeFiles[] =
5+
@@ -220,6 +220,13 @@ static const struct exclude_list_item excludeFiles[] =
66
{"postmaster.pid", false},
77
{"postmaster.opts", false},
88

@@ -16,20 +16,8 @@ index 45be21131c5..134e677f9d1 100644
1616
/* end of list */
1717
{NULL, false}
1818
};
19-
@@ -214,6 +221,11 @@ static const struct exclude_list_item noChecksumFiles[] = {
20-
{"pg_filenode.map", false},
21-
{"pg_internal.init", true},
22-
{"PG_VERSION", false},
23-
+
24-
+ {"ptrack.map.mmap", false},
25-
+ {"ptrack.map", false},
26-
+ {"ptrack.map.tmp", false},
27-
+
28-
#ifdef EXEC_BACKEND
29-
{"config_exec_params", true},
30-
#endif
3119
diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
32-
index e04bc3941ae..996b5de6169 100644
20+
index d4fbe542077..b108416c708 100644
3321
--- a/src/backend/storage/file/copydir.c
3422
+++ b/src/backend/storage/file/copydir.c
3523
@@ -27,6 +27,8 @@
@@ -52,10 +40,10 @@ index e04bc3941ae..996b5de6169 100644
5240
* Be paranoid here and fsync all files to ensure the copy is really done.
5341
* But if fsync is disabled, we're done.
5442
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
55-
index fdecbad1709..f849d00161e 100644
43+
index bf0f3ca76d1..7d9833a3604 100644
5644
--- a/src/backend/storage/smgr/md.c
5745
+++ b/src/backend/storage/smgr/md.c
58-
@@ -87,6 +87,8 @@ typedef struct _MdfdVec
46+
@@ -85,6 +85,8 @@ typedef struct _MdfdVec
5947

6048
static MemoryContext MdCxt; /* context for all MdfdVec objects */
6149

@@ -64,7 +52,7 @@ index fdecbad1709..f849d00161e 100644
6452

6553
/* Populate a file tag describing an md.c segment file. */
6654
#define INIT_MD_FILETAG(a,xx_rlocator,xx_forknum,xx_segno) \
67-
@@ -515,6 +517,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
55+
@@ -513,6 +515,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
6856
register_dirty_segment(reln, forknum, v);
6957

7058
Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
@@ -74,7 +62,7 @@ index fdecbad1709..f849d00161e 100644
7462
}
7563

7664
/*
77-
@@ -622,6 +627,12 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
65+
@@ -620,6 +625,12 @@ mdzeroextend(SMgrRelation reln, ForkNumber forknum,
7866

7967
remblocks -= numblocks;
8068
curblocknum += numblocks;
@@ -87,21 +75,27 @@ index fdecbad1709..f849d00161e 100644
8775
}
8876
}
8977

90-
@@ -867,6 +878,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
78+
@@ -1015,7 +1026,14 @@ mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
9179

92-
if (!skipFsync && !SmgrIsTemp(reln))
93-
register_dirty_segment(reln, forknum, v);
80+
nblocks -= nblocks_this_segment;
81+
buffers += nblocks_this_segment;
82+
- blocknum += nblocks_this_segment;
9483
+
95-
+ if (mdwrite_hook)
96-
+ mdwrite_hook(reln->smgr_rlocator, forknum, blocknum);
84+
+ if (mdwrite_hook)
85+
+ {
86+
+ for (; nblocks_this_segment--; blocknum++)
87+
+ mdwrite_hook(reln->smgr_rlocator, forknum, blocknum);
88+
+ }
89+
+ else
90+
+ blocknum += nblocks_this_segment;
91+
}
9792
}
9893

99-
/*
10094
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
101-
index 04fcb06056d..22bf179f560 100644
95+
index ab7137d0fff..bc40a763c05 100644
10296
--- a/src/backend/storage/sync/sync.c
10397
+++ b/src/backend/storage/sync/sync.c
104-
@@ -79,6 +79,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
98+
@@ -74,6 +74,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
10599
static CycleCtr sync_cycle_ctr = 0;
106100
static CycleCtr checkpoint_cycle_ctr = 0;
107101

@@ -110,7 +104,7 @@ index 04fcb06056d..22bf179f560 100644
110104
/* Intervals for calling AbsorbSyncRequests */
111105
#define FSYNCS_PER_ABSORB 10
112106
#define UNLINKS_PER_ABSORB 10
113-
@@ -475,6 +477,9 @@ ProcessSyncRequests(void)
107+
@@ -470,6 +472,9 @@ ProcessSyncRequests(void)
114108
CheckpointStats.ckpt_longest_sync = longest;
115109
CheckpointStats.ckpt_agg_sync_time = total_elapsed;
116110

@@ -121,10 +115,10 @@ index 04fcb06056d..22bf179f560 100644
121115
sync_in_progress = false;
122116
}
123117
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
124-
index 19eb67e4854..008a7acc9f0 100644
118+
index 9e6fd435f60..f2180b9f6de 100644
125119
--- a/src/bin/pg_checksums/pg_checksums.c
126120
+++ b/src/bin/pg_checksums/pg_checksums.c
127-
@@ -118,6 +118,11 @@ static const struct exclude_list_item skip[] = {
121+
@@ -110,6 +110,11 @@ static const struct exclude_list_item skip[] = {
128122
{"pg_filenode.map", false},
129123
{"pg_internal.init", true},
130124
{"PG_VERSION", false},
@@ -137,27 +131,27 @@ index 19eb67e4854..008a7acc9f0 100644
137131
{"config_exec_params", true},
138132
#endif
139133
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
140-
index e7ef2b8bd0c..ca7f8cdbc2f 100644
134+
index e9dcb5a6d89..844b04d5e12 100644
141135
--- a/src/bin/pg_resetwal/pg_resetwal.c
142136
+++ b/src/bin/pg_resetwal/pg_resetwal.c
143-
@@ -85,6 +85,7 @@ static void RewriteControlFile(void);
144-
static void FindEndOfXLOG(void);
137+
@@ -86,6 +86,7 @@ static void FindEndOfXLOG(void);
145138
static void KillExistingXLOG(void);
146139
static void KillExistingArchiveStatus(void);
140+
static void KillExistingWALSummaries(void);
147141
+static void KillExistingPtrack(void);
148142
static void WriteEmptyXLOG(void);
149143
static void usage(void);
150144

151-
@@ -488,6 +489,7 @@ main(int argc, char *argv[])
152-
RewriteControlFile();
145+
@@ -495,6 +496,7 @@ main(int argc, char *argv[])
153146
KillExistingXLOG();
154147
KillExistingArchiveStatus();
148+
KillExistingWALSummaries();
155149
+ KillExistingPtrack();
156150
WriteEmptyXLOG();
157151

158152
printf(_("Write-ahead log reset\n"));
159-
@@ -1029,6 +1031,41 @@ KillExistingArchiveStatus(void)
160-
pg_fatal("could not close directory \"%s\": %m", ARCHSTATDIR);
153+
@@ -998,6 +1000,41 @@ KillExistingXLOG(void)
154+
pg_fatal("could not close directory \"%s\": %m", XLOGDIR);
161155
}
162156

163157
+/*
@@ -197,9 +191,9 @@ index e7ef2b8bd0c..ca7f8cdbc2f 100644
197191
+
198192

199193
/*
200-
* Write an empty XLOG file, containing only the checkpoint record
194+
* Remove existing archive status files
201195
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
202-
index bd5c598e200..a568156c5fb 100644
196+
index 255ddf2ffaf..1142c244926 100644
203197
--- a/src/bin/pg_rewind/filemap.c
204198
+++ b/src/bin/pg_rewind/filemap.c
205199
@@ -157,6 +157,10 @@ static const struct exclude_list_item excludeFiles[] =
@@ -214,7 +208,7 @@ index bd5c598e200..a568156c5fb 100644
214208
{NULL, false}
215209
};
216210
diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h
217-
index a8be5b21e0b..020874f96cd 100644
211+
index a25e258f479..b20b9c76e8d 100644
218212
--- a/src/include/storage/copydir.h
219213
+++ b/src/include/storage/copydir.h
220214
@@ -13,6 +13,9 @@
@@ -228,7 +222,7 @@ index a8be5b21e0b..020874f96cd 100644
228222
extern void copy_file(const char *fromfile, const char *tofile);
229223

230224
diff --git a/src/include/storage/md.h b/src/include/storage/md.h
231-
index 941879ee6a8..24738aeecd0 100644
225+
index 620f10abdeb..b36936871bd 100644
232226
--- a/src/include/storage/md.h
233227
+++ b/src/include/storage/md.h
234228
@@ -19,6 +19,13 @@
@@ -246,11 +240,11 @@ index 941879ee6a8..24738aeecd0 100644
246240
extern void mdinit(void);
247241
extern void mdopen(SMgrRelation reln);
248242
diff --git a/src/include/storage/sync.h b/src/include/storage/sync.h
249-
index cfbcfa6797d..2a432440db9 100644
243+
index 9dee8fa6e5b..348ed53e4e2 100644
250244
--- a/src/include/storage/sync.h
251245
+++ b/src/include/storage/sync.h
252246
@@ -55,6 +55,9 @@ typedef struct FileTag
253-
uint32 segno;
247+
uint64 segno;
254248
} FileTag;
255249

256250
+typedef void (*ProcessSyncRequests_hook_type) (void);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy