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

PGPRO-5771#21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
antamel wants to merge10 commits intomaster
base:master
Choose a base branch
Loading
fromPGPRO-5771
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
10 commits
Select commitHold shift + click to select a range
db9dfe7
[PGPRO-5771] Replace macro COMP_CRC32C with handler function.
antamelOct 31, 2021
c5d5906
[PGPRO-5771] Add pg_comp_crc32c_handler and restore pg_comp_crc32c p…
antamelOct 31, 2021
dc3530b
[PGPRO-5771] Add macros to use pg_comp_crc32c_handler() in windows …
antamelNov 2, 2021
f9e9dcd
[PGPRO-5771] Rename pg_comp_crc32c_handler() to comp_crc32c()
antamelNov 7, 2021
06b27cf
[PGPRO-5771] Move comp_crc32c() to checksum_impl.h
antamelNov 8, 2021
099b0b0
[PGPRO-5771] Update core patches for REL_11_STABLE, REL_12_STABLE, …
antamelNov 8, 2021
0e000fa
[PGPRO-5771] Revert changes for stable branches (last 6 commits).
antamelMar 12, 2022
6ad12a5
[PGPRO-5771] Fix make errors with current PG master.
antamelMar 12, 2022
511e341
[PGPRO-5771] Use common macro for Windows and Linux.
antamelMar 12, 2022
1ad0308
[PGPRO-5771] Use common crc32 macro with PG master only.
antamelMar 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletionsengine.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,14 +31,22 @@
#include "access/xlog.h"
#include "catalog/pg_tablespace.h"
#include "miscadmin.h"
#if PG_VERSION_NUM >= 150000
#include "storage/checksum.h"
#else
#include "port/pg_crc32c.h"
#endif
#include "storage/copydir.h"
#if PG_VERSION_NUM >= 120000
#include "storage/md.h"
#include "storage/sync.h"
#endif
#include "storage/reinit.h"
#include "storage/smgr.h"
#if PG_VERSION_NUM >= 150000
#include "storage/fd.h"
#include "access/xlogrecovery.h"
#endif
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/pg_lsn.h"
Expand DownExpand Up@@ -73,7 +81,11 @@ ptrack_file_exists(const char *path)
static void
ptrack_write_chunk(int fd, pg_crc32c *crc, char *chunk, size_t size)
{
#if PG_VERSION_NUM >= 150000
COMP_CRC32C_COMMON(*crc, (char *) chunk, size);
#else
COMP_CRC32C(*crc, (char *) chunk, size);
#endif

if (write(fd, chunk, size) != size)
{
Expand DownExpand Up@@ -193,7 +205,11 @@ ptrackMapReadFromFile(const char *ptrack_path)
pg_crc32c *file_crc;

INIT_CRC32C(crc);
#if PG_VERSION_NUM >= 150000
COMP_CRC32C_COMMON(crc, (char *) ptrack_map, PtrackCrcOffset);
#else
COMP_CRC32C(crc, (char *) ptrack_map, PtrackCrcOffset);
#endif
FIN_CRC32C(crc);

file_crc = (pg_crc32c *) ((char *) ptrack_map + PtrackCrcOffset);
Expand Down
136 changes: 70 additions & 66 deletionspatches/master-ptrack-core.diff
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
commita14ac459d71528c64df00c693e9c71ac70d3ba29
Author:anastasia<a.lubennikova@postgrespro.ru>
Date:Mon Oct 19 14:53:06 2020 +0300
commit98d98792c0dbe589e8baee4c4100e0dc174ccacb
Author:Anton A. Melnikov<a.melnikov@postgrespro.ru>
Date:Wed Apr 13 09:49:33 2022 +0300

add ptrack 2.0
Apply core patch on PG master

diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index50ae1f16d0..721b926ad2 100644
index67489192a2..5e22017bd1 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -233,6 +233,13 @@ static const struct exclude_list_item excludeFiles[] =
@@ -197,6 +197,13 @@ static const struct exclude_list_item excludeFiles[] =
{"postmaster.pid", false},
{"postmaster.opts", false},

Expand All@@ -22,7 +22,7 @@ index 50ae1f16d0..721b926ad2 100644
/* end of list */
{NULL, false}
};
@@ -248,6 +255,11 @@ static const struct exclude_list_item noChecksumFiles[] = {
@@ -212,6 +219,11 @@ static const struct exclude_list_item noChecksumFiles[] = {
{"pg_filenode.map", false},
{"pg_internal.init", true},
{"PG_VERSION", false},
Expand All@@ -35,7 +35,7 @@ index 50ae1f16d0..721b926ad2 100644
{"config_exec_params", true},
#endif
diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
index0cf598dd0c..c9c44a4ae7 100644
index658fd95ba9..eee38eba17 100644
--- a/src/backend/storage/file/copydir.c
+++ b/src/backend/storage/file/copydir.c
@@ -27,6 +27,8 @@
Expand All@@ -58,7 +58,7 @@ index 0cf598dd0c..c9c44a4ae7 100644
* Be paranoid here and fsync all files to ensure the copy is really done.
* But if fsync is disabled, we're done.
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index0eacd461cd..c2ef404a1a 100644
index286dd3f755..2c496b3a6d 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -87,6 +87,8 @@ typedef struct _MdfdVec
Expand All@@ -70,7 +70,7 @@ index 0eacd461cd..c2ef404a1a 100644

/* Populate a file tag describing an md.c segment file. */
#define INIT_MD_FILETAG(a,xx_rnode,xx_forknum,xx_segno) \
@@ -435,6 +437,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@@ -465,6 +467,9 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
register_dirty_segment(reln, forknum, v);

Assert(_mdnblocks(reln, forknum, v) <= ((BlockNumber) RELSEG_SIZE));
Expand All@@ -80,7 +80,7 @@ index 0eacd461cd..c2ef404a1a 100644
}

/*
@@ -721,6 +726,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@@ -757,6 +762,9 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,

if (!skipFsync && !SmgrIsTemp(reln))
register_dirty_segment(reln, forknum, v);
Expand All@@ -91,10 +91,10 @@ index 0eacd461cd..c2ef404a1a 100644

/*
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
index3ded2cdd71..3a596a59f7 100644
indexc695d816fc..77e2ab1996 100644
--- a/src/backend/storage/sync/sync.c
+++ b/src/backend/storage/sync/sync.c
@@ -75,6 +75,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
@@ -81,6 +81,8 @@ static MemoryContext pendingOpsCxt; /* context for the above */
static CycleCtr sync_cycle_ctr = 0;
static CycleCtr checkpoint_cycle_ctr = 0;

Expand All@@ -103,7 +103,7 @@ index 3ded2cdd71..3a596a59f7 100644
/* Intervals for calling AbsorbSyncRequests */
#define FSYNCS_PER_ABSORB10
#define UNLINKS_PER_ABSORB10
@@ -420,6 +422,9 @@ ProcessSyncRequests(void)
@@ -478,6 +480,9 @@ ProcessSyncRequests(void)
CheckpointStats.ckpt_longest_sync = longest;
CheckpointStats.ckpt_agg_sync_time = total_elapsed;

Expand All@@ -113,23 +113,11 @@ index 3ded2cdd71..3a596a59f7 100644
/* Flag successful completion of ProcessSyncRequests */
sync_in_progress = false;
}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 1683629ee3..d2fc154576 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -620,7 +620,6 @@ static char *recovery_target_xid_string;
static char *recovery_target_name_string;
static char *recovery_target_lsn_string;

-
/* should be static, but commands/variable.c needs to get at this */
char *role_string;

diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c
indexffdc23945c..7ae95866ce 100644
index21dfe1b6ee..266ac1ef40 100644
--- a/src/bin/pg_checksums/pg_checksums.c
+++ b/src/bin/pg_checksums/pg_checksums.c
@@ -114,6 +114,11 @@ static const struct exclude_list_item skip[] = {
@@ -118,6 +118,11 @@ static const struct exclude_list_item skip[] = {
{"pg_filenode.map", false},
{"pg_internal.init", true},
{"PG_VERSION", false},
Expand All@@ -142,27 +130,27 @@ index ffdc23945c..7ae95866ce 100644
{"config_exec_params", true},
#endif
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index233441837f..cf7bd073bf 100644
indexd4772a2965..66456f7e44 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -84,6 +84,7 @@ static void RewriteControlFile(void);
@@ -85,6 +85,7 @@ static void RewriteControlFile(void);
static void FindEndOfXLOG(void);
static void KillExistingXLOG(void);
static void KillExistingArchiveStatus(void);
+static void KillExistingPtrack(void);
static void WriteEmptyXLOG(void);
static void usage(void);

@@ -513,6 +514,7 @@ main(int argc, char *argv[])
@@ -488,6 +489,7 @@ main(int argc, char *argv[])
RewriteControlFile();
KillExistingXLOG();
KillExistingArchiveStatus();
+KillExistingPtrack();
WriteEmptyXLOG();

printf(_("Write-ahead log reset\n"));
@@ -1102,6 +1104,53 @@ KillExistingArchiveStatus(void)
}
@@ -1036,6 +1038,53 @@ KillExistingArchiveStatus(void)
pg_fatal("could not close directory \"%s\": %m", ARCHSTATDIR);
}

+/*
Expand DownExpand Up@@ -216,10 +204,10 @@ index 233441837f..cf7bd073bf 100644
/*
* Write an empty XLOG file, containing only the checkpoint record
diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c
indexfbb97b5cf1..6cd7f2ae3e 100644
indexd61067f6b2..27ec23137d 100644
--- a/src/bin/pg_rewind/filemap.c
+++ b/src/bin/pg_rewind/filemap.c
@@ -124,6 +124,10 @@ static const struct exclude_list_item excludeFiles[] =
@@ -157,6 +157,10 @@ static const struct exclude_list_item excludeFiles[] =
{"postmaster.pid", false},
{"postmaster.opts", false},

Expand All@@ -230,39 +218,55 @@ index fbb97b5cf1..6cd7f2ae3e 100644
/* end of list */
{NULL, false}
};
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 72e3352398..5c2e016501 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -388,7 +388,7 @@ typedef enum ProcessingMode
NormalProcessing/* normal processing */
} ProcessingMode;
diff --git a/src/include/storage/checksum.h b/src/include/storage/checksum.h
index 1904fabd5a..f9306a6d01 100644
--- a/src/include/storage/checksum.h
+++ b/src/include/storage/checksum.h
@@ -14,6 +14,7 @@
#define CHECKSUM_H

-extern ProcessingMode Mode;
+extern PGDLLIMPORT ProcessingMode Mode;
#include "storage/block.h"
+#include "port/pg_crc32c.h"

#define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
#define IsInitProcessingMode()(Mode == InitProcessing)
diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h
index 3c6f906683..a7355f7ad1 100644
--- a/src/include/port/pg_crc32c.h
+++ b/src/include/port/pg_crc32c.h
@@ -69,8 +69,11 @@ extern pg_crc32c pg_comp_crc32c_armv8(pg_crc32c crc, const void *data, size_t le
#define FIN_CRC32C(crc) ((crc) ^= 0xFFFFFFFF)
/*
* Compute the checksum for a Postgres page. The page must be aligned on a
@@ -21,4 +22,18 @@
*/
extern uint16 pg_checksum_page(char *page, BlockNumber blkno);

extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len);
-extern pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
-
+extern
+#ifndef FRONTEND
+PGDLLIMPORT
+#ifdef WIN32
+/*
+ * Wrapper function for COMP_CRC32C macro. Was added to avoid
+ * FRONTEND macro use for pg_comp_crc32c pointer in windows build.
+ */
+extern void
+comp_crc32c(pg_crc32c *crc, const void *data, size_t len);
+
+#define COMP_CRC32C_COMMON(crc, data, len)\
+comp_crc32c(&(crc), data, len)
+#else
+#define COMP_CRC32C_COMMONCOMP_CRC32C
+#endif/* WIN32 */
+
#endif/* CHECKSUM_H */
diff --git a/src/include/storage/checksum_impl.h b/src/include/storage/checksum_impl.h
index 015f0f1f83..1c5a0ba351 100644
--- a/src/include/storage/checksum_impl.h
+++ b/src/include/storage/checksum_impl.h
@@ -213,3 +213,11 @@ pg_checksum_page(char *page, BlockNumber blkno)
*/
return (uint16) ((checksum % 65535) + 1);
}
+
+#ifdef WIN32
+void
+comp_crc32c(pg_crc32c *crc, const void *data, size_t len)
+{
+COMP_CRC32C(*crc, data, len);
+}
+#endif
+pg_crc32c (*pg_comp_crc32c) (pg_crc32c crc, const void *data, size_t len);
#ifdef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK
extern pg_crc32c pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len);
#endif
diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h
index5d28f59c1d..0d3f04d8af 100644
index50a26edeb0..af1602f515 100644
--- a/src/include/storage/copydir.h
+++ b/src/include/storage/copydir.h
@@ -13,6 +13,9 @@
Expand All@@ -276,7 +280,7 @@ index 5d28f59c1d..0d3f04d8af 100644
extern void copy_file(char *fromfile, char *tofile);

diff --git a/src/include/storage/md.h b/src/include/storage/md.h
index07fd1bb7d0..5294811bc8 100644
index6e46d8d96a..f0967ef484 100644
--- a/src/include/storage/md.h
+++ b/src/include/storage/md.h
@@ -19,6 +19,13 @@
Expand All@@ -294,10 +298,10 @@ index 07fd1bb7d0..5294811bc8 100644
extern void mdinit(void);
extern void mdopen(SMgrRelation reln);
diff --git a/src/include/storage/sync.h b/src/include/storage/sync.h
indexe16ab8e711..88da9686eb 100644
index9737e1eb67..914ad86328 100644
--- a/src/include/storage/sync.h
+++ b/src/include/storage/sync.h
@@ -50,6 +50,9 @@ typedef struct FileTag
@@ -55,6 +55,9 @@ typedef struct FileTag
uint32segno;
} FileTag;

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp