1
- commit a14ac459d71528c64df00c693e9c71ac70d3ba29
2
- Author: anastasia <a.lubennikova @postgrespro.ru>
3
- Date: Mon Oct 19 14:53:06 2020 +0300
1
+ commit 98d98792c0dbe589e8baee4c4100e0dc174ccacb
2
+ Author: Anton A. Melnikov <a.melnikov @postgrespro.ru>
3
+ Date: Wed Apr 13 09:49:33 2022 +0300
4
4
5
- add ptrack 2.0
5
+ Apply core patch on PG master
6
6
7
7
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
8
- index 50ae1f16d0..721b926ad2 100644
8
+ index 67489192a2..5e22017bd1 100644
9
9
--- a/src/backend/replication/basebackup.c
10
10
+++ b/src/backend/replication/basebackup.c
11
- @@ -233 ,6 +233 ,13 @@ static const struct exclude_list_item excludeFiles[] =
11
+ @@ -197 ,6 +197 ,13 @@ static const struct exclude_list_item excludeFiles[] =
12
12
{"postmaster.pid", false},
13
13
{"postmaster.opts", false},
14
14
@@ -22,7 +22,7 @@ index 50ae1f16d0..721b926ad2 100644
22
22
/* end of list */
23
23
{NULL, false}
24
24
};
25
- @@ -248 ,6 +255 ,11 @@ static const struct exclude_list_item noChecksumFiles[] = {
25
+ @@ -212 ,6 +219 ,11 @@ static const struct exclude_list_item noChecksumFiles[] = {
26
26
{"pg_filenode.map", false},
27
27
{"pg_internal.init", true},
28
28
{"PG_VERSION", false},
@@ -35,7 +35,7 @@ index 50ae1f16d0..721b926ad2 100644
35
35
{"config_exec_params", true},
36
36
#endif
37
37
diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
38
- index 0cf598dd0c..c9c44a4ae7 100644
38
+ index 658fd95ba9..eee38eba17 100644
39
39
--- a/src/backend/storage/file/copydir.c
40
40
+++ b/src/backend/storage/file/copydir.c
41
41
@@ -27,6 +27,8 @@
@@ -58,7 +58,7 @@ index 0cf598dd0c..c9c44a4ae7 100644
58
58
* Be paranoid here and fsync all files to ensure the copy is really done.
59
59
* But if fsync is disabled, we're done.
60
60
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
61
- index 0eacd461cd..c2ef404a1a 100644
61
+ index 286dd3f755..2c496b3a6d 100644
62
62
--- a/src/backend/storage/smgr/md.c
63
63
+++ b/src/backend/storage/smgr/md.c
64
64
@@ -87,6 +87,8 @@ typedef struct _MdfdVec
@@ -70,7 +70,7 @@ index 0eacd461cd..c2ef404a1a 100644
70
70
71
71
/* Populate a file tag describing an md.c segment file. */
72
72
#define INIT_MD_FILETAG(a,xx_rnode,xx_forknum,xx_segno) \
73
- @@ -435 ,6 +437 ,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
73
+ @@ -465 ,6 +467 ,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
74
74
register_dirty_segment(reln, forknum, v);
75
75
76
76
Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
@@ -80,7 +80,7 @@ index 0eacd461cd..c2ef404a1a 100644
80
80
}
81
81
82
82
/*
83
- @@ -721 ,6 +726 ,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
83
+ @@ -757 ,6 +762 ,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
84
84
85
85
if (!skipFsync && !SmgrIsTemp(reln))
86
86
register_dirty_segment(reln, forknum, v);
@@ -91,10 +91,10 @@ index 0eacd461cd..c2ef404a1a 100644
91
91
92
92
/*
93
93
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
94
- index 3ded2cdd71..3a596a59f7 100644
94
+ index c695d816fc..77e2ab1996 100644
95
95
--- a/src/backend/storage/sync/sync.c
96
96
+++ b/src/backend/storage/sync/sync.c
97
- @@ -75 ,6 +75 ,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
97
+ @@ -81 ,6 +81 ,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
98
98
static CycleCtr sync_cycle_ctr = 0;
99
99
static CycleCtr checkpoint_cycle_ctr = 0;
100
100
@@ -103,7 +103,7 @@ index 3ded2cdd71..3a596a59f7 100644
103
103
/* Intervals for calling AbsorbSyncRequests */
104
104
#define FSYNCS_PER_ABSORB 10
105
105
#define UNLINKS_PER_ABSORB 10
106
- @@ -420 ,6 +422 ,9 @@ ProcessSyncRequests(void)
106
+ @@ -478 ,6 +480 ,9 @@ ProcessSyncRequests(void)
107
107
CheckpointStats.ckpt_longest_sync = longest;
108
108
CheckpointStats.ckpt_agg_sync_time = total_elapsed;
109
109
@@ -113,23 +113,11 @@ index 3ded2cdd71..3a596a59f7 100644
113
113
/* Flag successful completion of ProcessSyncRequests */
114
114
sync_in_progress = false;
115
115
}
116
- diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
117
- index 1683629ee3..d2fc154576 100644
118
- --- a/src/backend/utils/misc/guc.c
119
- +++ b/src/backend/utils/misc/guc.c
120
- @@ -620,7 +620,6 @@ static char *recovery_target_xid_string;
121
- static char *recovery_target_name_string;
122
- static char *recovery_target_lsn_string;
123
-
124
- -
125
- /* should be static, but commands/variable.c needs to get at this */
126
- char *role_string;
127
-
128
116
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
129
- index ffdc23945c..7ae95866ce 100644
117
+ index 21dfe1b6ee..266ac1ef40 100644
130
118
--- a/src/bin/pg_checksums/pg_checksums.c
131
119
+++ b/src/bin/pg_checksums/pg_checksums.c
132
- @@ -114 ,6 +114 ,11 @@ static const struct exclude_list_item skip[] = {
120
+ @@ -118 ,6 +118 ,11 @@ static const struct exclude_list_item skip[] = {
133
121
{"pg_filenode.map", false},
134
122
{"pg_internal.init", true},
135
123
{"PG_VERSION", false},
@@ -142,27 +130,27 @@ index ffdc23945c..7ae95866ce 100644
142
130
{"config_exec_params", true},
143
131
#endif
144
132
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
145
- index 233441837f..cf7bd073bf 100644
133
+ index d4772a2965..66456f7e44 100644
146
134
--- a/src/bin/pg_resetwal/pg_resetwal.c
147
135
+++ b/src/bin/pg_resetwal/pg_resetwal.c
148
- @@ -84 ,6 +84 ,7 @@ static void RewriteControlFile(void);
136
+ @@ -85 ,6 +85 ,7 @@ static void RewriteControlFile(void);
149
137
static void FindEndOfXLOG(void);
150
138
static void KillExistingXLOG(void);
151
139
static void KillExistingArchiveStatus(void);
152
140
+ static void KillExistingPtrack(void);
153
141
static void WriteEmptyXLOG(void);
154
142
static void usage(void);
155
143
156
- @@ -513 ,6 +514 ,7 @@ main(int argc, char *argv[])
144
+ @@ -488 ,6 +489 ,7 @@ main(int argc, char *argv[])
157
145
RewriteControlFile();
158
146
KillExistingXLOG();
159
147
KillExistingArchiveStatus();
160
148
+ KillExistingPtrack();
161
149
WriteEmptyXLOG();
162
150
163
151
printf(_("Write-ahead log reset\n"));
164
- @@ -1102 ,6 +1104 ,53 @@ KillExistingArchiveStatus(void)
165
- }
152
+ @@ -1036 ,6 +1038 ,53 @@ KillExistingArchiveStatus(void)
153
+ pg_fatal("could not close directory \"%s\": %m", ARCHSTATDIR);
166
154
}
167
155
168
156
+ /*
@@ -216,10 +204,10 @@ index 233441837f..cf7bd073bf 100644
216
204
/*
217
205
* Write an empty XLOG file, containing only the checkpoint record
218
206
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
219
- index fbb97b5cf1..6cd7f2ae3e 100644
207
+ index d61067f6b2..27ec23137d 100644
220
208
--- a/src/bin/pg_rewind/filemap.c
221
209
+++ b/src/bin/pg_rewind/filemap.c
222
- @@ -124 ,6 +124 ,10 @@ static const struct exclude_list_item excludeFiles[] =
210
+ @@ -157 ,6 +157 ,10 @@ static const struct exclude_list_item excludeFiles[] =
223
211
{"postmaster.pid", false},
224
212
{"postmaster.opts", false},
225
213
@@ -230,39 +218,55 @@ index fbb97b5cf1..6cd7f2ae3e 100644
230
218
/* end of list */
231
219
{NULL, false}
232
220
};
233
- diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
234
- index 72e3352398..5c2e016501 100644
235
- --- a/src/include/miscadmin.h
236
- +++ b/src/include/miscadmin.h
237
- @@ -388,7 +388,7 @@ typedef enum ProcessingMode
238
- NormalProcessing /* normal processing */
239
- } ProcessingMode;
221
+ diff --git a/src/include/storage/checksum.h b/src/include/storage/checksum.h
222
+ index 1904fabd5a..f9306a6d01 100644
223
+ --- a/src/include/storage/checksum.h
224
+ +++ b/src/include/storage/checksum.h
225
+ @@ -14,6 +14,7 @@
226
+ #define CHECKSUM_H
240
227
241
- - extern ProcessingMode Mode;
242
- + extern PGDLLIMPORT ProcessingMode Mode;
228
+ #include "storage/block.h"
229
+ + #include "port/pg_crc32c.h"
243
230
244
- #define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
245
- #define IsInitProcessingMode() (Mode == InitProcessing)
246
- diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h
247
- index 3c6f906683..a7355f7ad1 100644
248
- --- a/src/include/port/pg_crc32c.h
249
- +++ b/src/include/port/pg_crc32c.h
250
- @@ -69,8 +69,11 @@ extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t le
251
- #define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
231
+ /*
232
+ * Compute the checksum for a Postgres page. The page must be aligned on a
233
+ @@ -21,4 +22,18 @@
234
+ */
235
+ extern uint16 pg_checksum_page(char *page, BlockNumber blkno);
252
236
253
- extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
254
- - extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
255
- -
256
- + extern
257
- + #ifndef FRONTEND
258
- + PGDLLIMPORT
237
+ + #ifdef WIN32
238
+ + /*
239
+ + * Wrapper function for COMP_CRC32C macro. Was added to avoid
240
+ + * FRONTEND macro use for pg_comp_crc32c pointer in windows build.
241
+ + */
242
+ + extern void
243
+ + comp_crc32c(pg_crc32c *crc, const void *data, size_t len);
244
+ +
245
+ + #define COMP_CRC32C_COMMON(crc, data, len) \
246
+ + comp_crc32c(&(crc), data, len)
247
+ + #else
248
+ + #define COMP_CRC32C_COMMON COMP_CRC32C
249
+ + #endif /* WIN32 */
250
+ +
251
+ #endif /* CHECKSUM_H */
252
+ diff --git a/src/include/storage/checksum_impl.h b/src/include/storage/checksum_impl.h
253
+ index 015f0f1f83..1c5a0ba351 100644
254
+ --- a/src/include/storage/checksum_impl.h
255
+ +++ b/src/include/storage/checksum_impl.h
256
+ @@ -213,3 +213,11 @@ pg_checksum_page(char *page, BlockNumber blkno)
257
+ */
258
+ return (uint16) ((checksum % 65535) + 1);
259
+ }
260
+ +
261
+ + #ifdef WIN32
262
+ + void
263
+ + comp_crc32c(pg_crc32c *crc, const void *data, size_t len)
264
+ + {
265
+ + COMP_CRC32C(*crc, data, len);
266
+ + }
259
267
+ #endif
260
- + pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
261
- #ifdef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK
262
- extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
263
- #endif
264
268
diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h
265
- index 5d28f59c1d..0d3f04d8af 100644
269
+ index 50a26edeb0..af1602f515 100644
266
270
--- a/src/include/storage/copydir.h
267
271
+++ b/src/include/storage/copydir.h
268
272
@@ -13,6 +13,9 @@
@@ -276,7 +280,7 @@ index 5d28f59c1d..0d3f04d8af 100644
276
280
extern void copy_file(char *fromfile, char *tofile);
277
281
278
282
diff --git a/src/include/storage/md.h b/src/include/storage/md.h
279
- index 07fd1bb7d0..5294811bc8 100644
283
+ index 6e46d8d96a..f0967ef484 100644
280
284
--- a/src/include/storage/md.h
281
285
+++ b/src/include/storage/md.h
282
286
@@ -19,6 +19,13 @@
@@ -294,10 +298,10 @@ index 07fd1bb7d0..5294811bc8 100644
294
298
extern void mdinit(void);
295
299
extern void mdopen(SMgrRelation reln);
296
300
diff --git a/src/include/storage/sync.h b/src/include/storage/sync.h
297
- index e16ab8e711..88da9686eb 100644
301
+ index 9737e1eb67..914ad86328 100644
298
302
--- a/src/include/storage/sync.h
299
303
+++ b/src/include/storage/sync.h
300
- @@ -50 ,6 +50 ,9 @@ typedef struct FileTag
304
+ @@ -55 ,6 +55 ,9 @@ typedef struct FileTag
301
305
uint32 segno;
302
306
} FileTag;
303
307
0 commit comments