Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit099b0b0

Browse files
committed
[PGPRO-5771] Update core patches for REL_11_STABLE, REL_12_STABLE, REL_13_STABLE and REL_14_STABLE.
Tags: ptrack
1 parent06b27cf commit099b0b0

File tree

4 files changed

+321
-252
lines changed

4 files changed

+321
-252
lines changed

‎patches/REL_11_STABLE-ptrack-core.diff‎

Lines changed: 82 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
commit 5255ff7a6051f56689e0db2a0fa7e9a6e4086d66
2+
Author: Anton A. Melnikov <a.melnikov@postgrespro.ru>
3+
Date: Mon Nov 8 11:11:45 2021 +0300
4+
5+
[PGPRO-5771] Add handler for COMP_CRC32C and restore pg_comp_crc32c pointer definition.
6+
17
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
2-
index3e53b3df6fb..f76bfc2a646 100644
8+
index3e53b3df6f..f76bfc2a64 100644
39
--- a/src/backend/replication/basebackup.c
410
+++ b/src/backend/replication/basebackup.c
511
@@ -209,6 +209,13 @@ static const struct exclude_list_item excludeFiles[] =
612
{"postmaster.pid", false},
713
{"postmaster.opts", false},
8-
14+
915
+/*
1016
+ * Skip all transient ptrack files, but do copy ptrack.map, since it may
1117
+ * be successfully used immediately after backup. TODO: check, test?
@@ -28,13 +34,13 @@ index 3e53b3df6fb..f76bfc2a646 100644
2834
{"config_exec_params", true},
2935
#endif
3036
diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
31-
index4a0d23b11e3..d59009a4c8c 100644
37+
index4a0d23b11e..d59009a4c8 100644
3238
--- a/src/backend/storage/file/copydir.c
3339
+++ b/src/backend/storage/file/copydir.c
3440
@@ -27,6 +27,8 @@
3541
#include "miscadmin.h"
3642
#include "pgstat.h"
37-
43+
3844
+copydir_hook_type copydir_hook = NULL;
3945
+
4046
/*
@@ -43,88 +49,88 @@ index 4a0d23b11e3..d59009a4c8c 100644
4349
@@ -78,6 +80,9 @@ copydir(char *fromdir, char *todir, bool recurse)
4450
}
4551
FreeDir(xldir);
46-
52+
4753
+if (copydir_hook)
4854
+copydir_hook(todir);
4955
+
5056
/*
5157
* Be paranoid here and fsync all files to ensure the copy is really done.
5258
* But if fsync is disabled, we're done.
5359
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
54-
index200cc7f657a..d0dcb5c0287 100644
60+
indexfa29e7041f..8bda639eda 100644
5561
--- a/src/backend/storage/smgr/md.c
5662
+++ b/src/backend/storage/smgr/md.c
5763
@@ -39,6 +39,7 @@
5864
#include "utils/memutils.h"
5965
#include "pg_trace.h"
60-
66+
6167
+ProcessSyncRequests_hook_type ProcessSyncRequests_hook = NULL;
62-
68+
6369
/* intervals for calling AbsorbFsyncRequests in mdsync and mdpostckpt */
6470
#define FSYNCS_PER_ABSORB10
6571
@@ -114,6 +115,8 @@ typedef struct _MdfdVec
66-
72+
6773
static MemoryContext MdCxt;/* context for all MdfdVec objects */
68-
74+
6975
+mdextend_hook_type mdextend_hook = NULL;
7076
+mdwrite_hook_type mdwrite_hook = NULL;
71-
77+
7278
/*
7379
* In some contexts (currently, standalone backends and the checkpointer)
74-
@@ -558,6 +561,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
80+
@@ -600,6 +603,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
7581
register_dirty_segment(reln, forknum, v);
76-
82+
7783
Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
7884
+
7985
+if (mdextend_hook)
8086
+mdextend_hook(reln->smgr_rnode, forknum, blocknum);
8187
}
82-
88+
8389
/*
84-
@@ -851,6 +857,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
85-
90+
@@ -893,6 +899,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
91+
8692
if (!skipFsync && !SmgrIsTemp(reln))
8793
register_dirty_segment(reln, forknum, v);
8894
+
8995
+if (mdwrite_hook)
9096
+mdwrite_hook(reln->smgr_rnode, forknum, blocknum);
9197
}
92-
98+
9399
/*
94-
@@ -1329,6 +1338,9 @@ mdsync(void)
100+
@@ -1371,6 +1380,9 @@ mdsync(void)
95101
CheckpointStats.ckpt_longest_sync = longest;
96102
CheckpointStats.ckpt_agg_sync_time = total_elapsed;
97-
103+
98104
+if (ProcessSyncRequests_hook)
99105
+ProcessSyncRequests_hook();
100106
+
101107
/* Flag successful completion of mdsync */
102108
mdsync_in_progress = false;
103109
}
104110
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
105-
index6fb403a5a8a..6e31ccb3e0f 100644
111+
index611edf6ade..ec1c1212bd 100644
106112
--- a/src/bin/pg_resetwal/pg_resetwal.c
107113
+++ b/src/bin/pg_resetwal/pg_resetwal.c
108-
@@ -84,6 +84,7 @@ static void RewriteControlFile(void);
114+
@@ -85,6 +85,7 @@ static void RewriteControlFile(void);
109115
static void FindEndOfXLOG(void);
110116
static void KillExistingXLOG(void);
111117
static void KillExistingArchiveStatus(void);
112118
+static void KillExistingPtrack(void);
113119
static void WriteEmptyXLOG(void);
114120
static void usage(void);
115-
116-
@@ -516,6 +517,7 @@ main(int argc, char *argv[])
121+
122+
@@ -525,6 +526,7 @@ main(int argc, char *argv[])
117123
RewriteControlFile();
118124
KillExistingXLOG();
119125
KillExistingArchiveStatus();
120126
+KillExistingPtrack();
121127
WriteEmptyXLOG();
122-
128+
123129
printf(_("Write-ahead log reset\n"));
124-
@@ -1201,6 +1203,57 @@ KillExistingArchiveStatus(void)
130+
@@ -1210,6 +1212,57 @@ KillExistingArchiveStatus(void)
125131
}
126132
}
127-
133+
128134
+/*
129135
+ * Remove existing ptrack files
130136
+ */
@@ -176,17 +182,17 @@ index 6fb403a5a8a..6e31ccb3e0f 100644
176182
+}
177183
+}
178184
+
179-
185+
180186
/*
181187
* Write an empty XLOG file, containing only the checkpoint record
182188
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
183-
index197163d5544..fc846e78175 100644
189+
index8ea7fafa27..997168fcac 100644
184190
--- a/src/bin/pg_rewind/filemap.c
185191
+++ b/src/bin/pg_rewind/filemap.c
186192
@@ -118,6 +118,10 @@ static const struct exclude_list_item excludeFiles[] =
187193
{"postmaster.pid", false},
188194
{"postmaster.opts", false},
189-
195+
190196
+{"ptrack.map.mmap", false},
191197
+{"ptrack.map", false},
192198
+{"ptrack.map.tmp", false},
@@ -195,57 +201,77 @@ index 197163d5544..fc846e78175 100644
195201
{NULL, false}
196202
};
197203
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
198-
index80241455357..50dca7bf6f4 100644
204+
index7c9f319b67..1e29827030 100644
199205
--- a/src/include/miscadmin.h
200206
+++ b/src/include/miscadmin.h
201-
@@ -367,7 +367,7 @@ typedef enum ProcessingMode
207+
@@ -379,7 +379,7 @@ typedef enum ProcessingMode
202208
NormalProcessing/* normal processing */
203209
} ProcessingMode;
204-
210+
205211
-extern ProcessingMode Mode;
206212
+extern PGDLLIMPORT ProcessingMode Mode;
207-
213+
208214
#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
209215
#define IsInitProcessingMode()(Mode == InitProcessing)
210-
diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h
211-
index 9a26295c8e8..dc72b27a10d 100644
212-
--- a/src/include/port/pg_crc32c.h
213-
+++ b/src/include/port/pg_crc32c.h
214-
@@ -69,8 +69,11 @@ extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t le
215-
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
216-
217-
extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
218-
-extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
219-
-
220-
+extern
221-
+#ifndef FRONTEND
222-
+PGDLLIMPORT
223-
+#endif
224-
+pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
225-
#ifdef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK
226-
extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
227-
#endif
216+
diff --git a/src/include/storage/checksum.h b/src/include/storage/checksum.h
217+
index 433755e279..de06d3b0cf 100644
218+
--- a/src/include/storage/checksum.h
219+
+++ b/src/include/storage/checksum.h
220+
@@ -14,6 +14,7 @@
221+
#define CHECKSUM_H
222+
223+
#include "storage/block.h"
224+
+#include "port/pg_crc32c.h"
225+
226+
/*
227+
* Compute the checksum for a Postgres page. The page must be aligned on a
228+
@@ -21,4 +22,11 @@
229+
*/
230+
extern uint16 pg_checksum_page(char *page, BlockNumber blkno);
231+
232+
+/*
233+
+* Wrapper function for COMP_CRC32C macro. Was added to avoid
234+
+* FRONTEND macro use for pg_comp_crc32c pointer in windows build.
235+
+*/
236+
+extern pg_crc32c
237+
+comp_crc32c(pg_crc32c *crc, const void *data, size_t len);
238+
+
239+
#endif/* CHECKSUM_H */
240+
diff --git a/src/include/storage/checksum_impl.h b/src/include/storage/checksum_impl.h
241+
index a49d27febb..459c938018 100644
242+
--- a/src/include/storage/checksum_impl.h
243+
+++ b/src/include/storage/checksum_impl.h
244+
@@ -213,3 +213,9 @@ pg_checksum_page(char *page, BlockNumber blkno)
245+
*/
246+
return (checksum % 65535) + 1;
247+
}
248+
+
249+
+pg_crc32c comp_crc32c(pg_crc32c *crc, const void *data, size_t len)
250+
+{
251+
+COMP_CRC32C(*crc, data, len);
252+
+return *crc;
253+
+}
228254
diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h
229-
index4fef3e21072..e55430879c3 100644
255+
index4fef3e2107..e55430879c 100644
230256
--- a/src/include/storage/copydir.h
231257
+++ b/src/include/storage/copydir.h
232258
@@ -13,6 +13,9 @@
233259
#ifndef COPYDIR_H
234260
#define COPYDIR_H
235-
261+
236262
+typedef void (*copydir_hook_type) (const char *path);
237263
+extern PGDLLIMPORT copydir_hook_type copydir_hook;
238264
+
239265
extern void copydir(char *fromdir, char *todir, bool recurse);
240266
extern void copy_file(char *fromfile, char *tofile);
241-
267+
242268
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
243-
index0298ed1a2bc..24c684771d0 100644
269+
index0298ed1a2b..24c684771d 100644
244270
--- a/src/include/storage/smgr.h
245271
+++ b/src/include/storage/smgr.h
246272
@@ -116,6 +116,17 @@ extern void AtEOXact_SMgr(void);
247273
/* internals: move me elsewhere -- ay 7/94 */
248-
274+
249275
/* in md.c */
250276
+
251277
+typedef void (*mdextend_hook_type) (RelFileNodeBackend smgr_rnode,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp