Skip to content

Commit 3edfd7a

Browse files
authoredNov 6, 2020
Merge pull request #4 from postgrespro/travis_rel13
Add support of REL_13_STABLE. Add tests of REL_13_STABLE.
2 parents 8b6a5d6 + 5f54b73 commit 3edfd7a

File tree

3 files changed

+314
-1
lines changed

3 files changed

+314
-1
lines changed
 

Diff for: ‎.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ notifications:
2121

2222
# keep in sync with codecov.yml number of builds
2323
env:
24+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=tap
25+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=tap MODE=legacy
26+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=all
27+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE TEST_CASE=all MODE=paranoia
2428
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=tap
2529
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=tap MODE=legacy
2630
- PG_VERSION=12 PG_BRANCH=REL_12_STABLE TEST_CASE=all

Diff for: ‎codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
codecov:
22
notify:
3-
after_n_builds: 12 # keep in sync with .travis.yml number of builds
3+
after_n_builds: 16 # keep in sync with .travis.yml number of builds
44

55
# datapagemap.c/.h are copied from Postgres, so let's remove it
66
# from report. Otherwise, we would have to remove some currently

Diff for: ‎patches/REL_13_STABLE-ptrack-core.diff

+309
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
commit a14ac459d71528c64df00c693e9c71ac70d3ba29
2+
Author: anastasia <a.lubennikova@postgrespro.ru>
3+
Date: Mon Oct 19 14:53:06 2020 +0300
4+
5+
add ptrack 2.0
6+
7+
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
8+
index 50ae1f16d0..721b926ad2 100644
9+
--- a/src/backend/replication/basebackup.c
10+
+++ b/src/backend/replication/basebackup.c
11+
@@ -233,6 +233,13 @@ static const struct exclude_list_item excludeFiles[] =
12+
{"postmaster.pid", false},
13+
{"postmaster.opts", false},
14+
15+
+ /*
16+
+ * Skip all transient ptrack files, but do copy ptrack.map, since it may
17+
+ * be successfully used immediately after backup. TODO: check, test?
18+
+ */
19+
+ {"ptrack.map.mmap", false},
20+
+ {"ptrack.map.tmp", false},
21+
+
22+
/* end of list */
23+
{NULL, false}
24+
};
25+
@@ -248,6 +255,11 @@ static const struct exclude_list_item noChecksumFiles[] = {
26+
{"pg_filenode.map", false},
27+
{"pg_internal.init", true},
28+
{"PG_VERSION", false},
29+
+
30+
+ {"ptrack.map.mmap", false},
31+
+ {"ptrack.map", false},
32+
+ {"ptrack.map.tmp", false},
33+
+
34+
#ifdef EXEC_BACKEND
35+
{"config_exec_params", true},
36+
#endif
37+
diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
38+
index 0cf598dd0c..c9c44a4ae7 100644
39+
--- a/src/backend/storage/file/copydir.c
40+
+++ b/src/backend/storage/file/copydir.c
41+
@@ -27,6 +27,8 @@
42+
#include "storage/copydir.h"
43+
#include "storage/fd.h"
44+
45+
+copydir_hook_type copydir_hook = NULL;
46+
+
47+
/*
48+
* copydir: copy a directory
49+
*
50+
@@ -78,6 +80,9 @@ copydir(char *fromdir, char *todir, bool recurse)
51+
}
52+
FreeDir(xldir);
53+
54+
+ if (copydir_hook)
55+
+ copydir_hook(todir);
56+
+
57+
/*
58+
* Be paranoid here and fsync all files to ensure the copy is really done.
59+
* But if fsync is disabled, we're done.
60+
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
61+
index 0eacd461cd..c2ef404a1a 100644
62+
--- a/src/backend/storage/smgr/md.c
63+
+++ b/src/backend/storage/smgr/md.c
64+
@@ -87,6 +87,8 @@ typedef struct _MdfdVec
65+
66+
static MemoryContext MdCxt; /* context for all MdfdVec objects */
67+
68+
+mdextend_hook_type mdextend_hook = NULL;
69+
+mdwrite_hook_type mdwrite_hook = NULL;
70+
71+
/* Populate a file tag describing an md.c segment file. */
72+
#define INIT_MD_FILETAG(a,xx_rnode,xx_forknum,xx_segno) \
73+
@@ -435,6 +437,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
74+
register_dirty_segment(reln, forknum, v);
75+
76+
Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
77+
+
78+
+ if (mdextend_hook)
79+
+ mdextend_hook(reln->smgr_rnode, forknum, blocknum);
80+
}
81+
82+
/*
83+
@@ -721,6 +726,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
84+
85+
if (!skipFsync && !SmgrIsTemp(reln))
86+
register_dirty_segment(reln, forknum, v);
87+
+
88+
+ if (mdwrite_hook)
89+
+ mdwrite_hook(reln->smgr_rnode, forknum, blocknum);
90+
}
91+
92+
/*
93+
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
94+
index 3ded2cdd71..3a596a59f7 100644
95+
--- a/src/backend/storage/sync/sync.c
96+
+++ b/src/backend/storage/sync/sync.c
97+
@@ -75,6 +75,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
98+
static CycleCtr sync_cycle_ctr = 0;
99+
static CycleCtr checkpoint_cycle_ctr = 0;
100+
101+
+ProcessSyncRequests_hook_type ProcessSyncRequests_hook = NULL;
102+
+
103+
/* Intervals for calling AbsorbSyncRequests */
104+
#define FSYNCS_PER_ABSORB 10
105+
#define UNLINKS_PER_ABSORB 10
106+
@@ -420,6 +422,9 @@ ProcessSyncRequests(void)
107+
CheckpointStats.ckpt_longest_sync = longest;
108+
CheckpointStats.ckpt_agg_sync_time = total_elapsed;
109+
110+
+ if (ProcessSyncRequests_hook)
111+
+ ProcessSyncRequests_hook();
112+
+
113+
/* Flag successful completion of ProcessSyncRequests */
114+
sync_in_progress = false;
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+
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
129+
index ffdc23945c..7ae95866ce 100644
130+
--- a/src/bin/pg_checksums/pg_checksums.c
131+
+++ b/src/bin/pg_checksums/pg_checksums.c
132+
@@ -114,6 +114,11 @@ static const struct exclude_list_item skip[] = {
133+
{"pg_filenode.map", false},
134+
{"pg_internal.init", true},
135+
{"PG_VERSION", false},
136+
+
137+
+ {"ptrack.map.mmap", false},
138+
+ {"ptrack.map", false},
139+
+ {"ptrack.map.tmp", false},
140+
+
141+
#ifdef EXEC_BACKEND
142+
{"config_exec_params", true},
143+
#endif
144+
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
145+
index 233441837f..cf7bd073bf 100644
146+
--- a/src/bin/pg_resetwal/pg_resetwal.c
147+
+++ b/src/bin/pg_resetwal/pg_resetwal.c
148+
@@ -84,6 +84,7 @@ static void RewriteControlFile(void);
149+
static void FindEndOfXLOG(void);
150+
static void KillExistingXLOG(void);
151+
static void KillExistingArchiveStatus(void);
152+
+static void KillExistingPtrack(void);
153+
static void WriteEmptyXLOG(void);
154+
static void usage(void);
155+
156+
@@ -513,6 +514,7 @@ main(int argc, char *argv[])
157+
RewriteControlFile();
158+
KillExistingXLOG();
159+
KillExistingArchiveStatus();
160+
+ KillExistingPtrack();
161+
WriteEmptyXLOG();
162+
163+
printf(_("Write-ahead log reset\n"));
164+
@@ -1102,6 +1104,53 @@ KillExistingArchiveStatus(void)
165+
}
166+
}
167+
168+
+/*
169+
+ * Remove existing ptrack files
170+
+ */
171+
+static void
172+
+KillExistingPtrack(void)
173+
+{
174+
+#define PTRACKDIR "global"
175+
+
176+
+ DIR *xldir;
177+
+ struct dirent *xlde;
178+
+ char path[MAXPGPATH + sizeof(PTRACKDIR)];
179+
+
180+
+ xldir = opendir(PTRACKDIR);
181+
+ if (xldir == NULL)
182+
+ {
183+
+ pg_log_error("could not open directory \"%s\": %m", PTRACKDIR);
184+
+ exit(1);
185+
+ }
186+
+
187+
+ while (errno = 0, (xlde = readdir(xldir)) != NULL)
188+
+ {
189+
+ if (strcmp(xlde->d_name, "ptrack.map.mmap") == 0 ||
190+
+ strcmp(xlde->d_name, "ptrack.map") == 0 ||
191+
+ strcmp(xlde->d_name, "ptrack.map.tmp") == 0)
192+
+ {
193+
+ snprintf(path, sizeof(path), "%s/%s", PTRACKDIR, xlde->d_name);
194+
+ if (unlink(path) < 0)
195+
+ {
196+
+ pg_log_error("could not delete file \"%s\": %m", path);
197+
+ exit(1);
198+
+ }
199+
+ }
200+
+ }
201+
+
202+
+ if (errno)
203+
+ {
204+
+ pg_log_error("could not read directory \"%s\": %m", PTRACKDIR);
205+
+ exit(1);
206+
+ }
207+
+
208+
+ if (closedir(xldir))
209+
+ {
210+
+ pg_log_error("could not close directory \"%s\": %m", PTRACKDIR);
211+
+ exit(1);
212+
+ }
213+
+}
214+
+
215+
216+
/*
217+
* Write an empty XLOG file, containing only the checkpoint record
218+
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
219+
index fbb97b5cf1..6cd7f2ae3e 100644
220+
--- a/src/bin/pg_rewind/filemap.c
221+
+++ b/src/bin/pg_rewind/filemap.c
222+
@@ -124,6 +124,10 @@ static const struct exclude_list_item excludeFiles[] =
223+
{"postmaster.pid", false},
224+
{"postmaster.opts", false},
225+
226+
+ {"ptrack.map.mmap", false},
227+
+ {"ptrack.map", false},
228+
+ {"ptrack.map.tmp", false},
229+
+
230+
/* end of list */
231+
{NULL, false}
232+
};
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;
240+
241+
-extern ProcessingMode Mode;
242+
+extern PGDLLIMPORT ProcessingMode Mode;
243+
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)
252+
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
259+
+#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+
diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h
265+
index 5d28f59c1d..0d3f04d8af 100644
266+
--- a/src/include/storage/copydir.h
267+
+++ b/src/include/storage/copydir.h
268+
@@ -13,6 +13,9 @@
269+
#ifndef COPYDIR_H
270+
#define COPYDIR_H
271+
272+
+typedef void (*copydir_hook_type) (const char *path);
273+
+extern PGDLLIMPORT copydir_hook_type copydir_hook;
274+
+
275+
extern void copydir(char *fromdir, char *todir, bool recurse);
276+
extern void copy_file(char *fromfile, char *tofile);
277+
278+
diff --git a/src/include/storage/md.h b/src/include/storage/md.h
279+
index 07fd1bb7d0..5294811bc8 100644
280+
--- a/src/include/storage/md.h
281+
+++ b/src/include/storage/md.h
282+
@@ -19,6 +19,13 @@
283+
#include "storage/smgr.h"
284+
#include "storage/sync.h"
285+
286+
+typedef void (*mdextend_hook_type) (RelFileNodeBackend smgr_rnode,
287+
+ ForkNumber forknum, BlockNumber blocknum);
288+
+extern PGDLLIMPORT mdextend_hook_type mdextend_hook;
289+
+typedef void (*mdwrite_hook_type) (RelFileNodeBackend smgr_rnode,
290+
+ ForkNumber forknum, BlockNumber blocknum);
291+
+extern PGDLLIMPORT mdwrite_hook_type mdwrite_hook;
292+
+
293+
/* md storage manager functionality */
294+
extern void mdinit(void);
295+
extern void mdopen(SMgrRelation reln);
296+
diff --git a/src/include/storage/sync.h b/src/include/storage/sync.h
297+
index e16ab8e711..88da9686eb 100644
298+
--- a/src/include/storage/sync.h
299+
+++ b/src/include/storage/sync.h
300+
@@ -50,6 +50,9 @@ typedef struct FileTag
301+
uint32 segno;
302+
} FileTag;
303+
304+
+typedef void (*ProcessSyncRequests_hook_type) (void);
305+
+extern PGDLLIMPORT ProcessSyncRequests_hook_type ProcessSyncRequests_hook;
306+
+
307+
extern void InitSync(void);
308+
extern void SyncPreCheckpoint(void);
309+
extern void SyncPostCheckpoint(void);

0 commit comments

Comments
 (0)
Please sign in to comment.