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

Commit868c9c0

Browse files
authored
Merge pull request#666 from postgrespro/merge-ce
Merge ce
2 parents72d3d52 +da0d1d2 commit868c9c0

21 files changed

+225
-109
lines changed

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,4 @@ endif
8787
include packaging/Makefile.pkg
8888
include packaging/Makefile.repo
8989
include packaging/Makefile.test
90+

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
`pg_probackup` is a utility to manage backup and recovery of PostgreSQL database clusters. It is designed to perform periodic backups of the PostgreSQL instance that enable you to restore the server in case of a failure.
77

88
The utility is compatible with:
9-
* PostgreSQL 13, 14, 15, 16, 17
9+
* PostgreSQL 13, 14, 15, 16, 17, 18
1010

1111
As compared to other backup solutions,`pg_probackup` offers the following benefits that can help you implement different backup strategies and deal with large amounts of data:
1212
* Incremental backup: page-level incremental backup allows you to save disk space, speed up backup and restore. With three different incremental modes, you can plan the backup strategy in accordance with your data flow.
@@ -79,7 +79,7 @@ For users of Postgres Pro products, commercial editions of pg_probackup are avai
7979
##Building from source
8080
###Linux
8181

82-
To compile`pg_probackup`, you must have a PostgreSQL installation and raw source tree.Execute this in the module's directory:
82+
To compile`pg_probackup`, you must have a PostgreSQL installation and raw source tree.For versions under 18 execute this in the module's directory:
8383

8484
```shell
8585
make USE_PGXS=1 PG_CONFIG=<path_to_pg_config> top_srcdir=<path_to_PostgreSQL_source_tree>
@@ -91,6 +91,8 @@ The alternative way, without using the PGXS infrastructure, is to place `pg_prob
9191
cd<path_to_PostgreSQL_source_tree>&& git clone https://github.com/postgrespro/pg_probackup contrib/pg_probackup&&cd contrib/pg_probackup&& make
9292
```
9393

94+
For version 18 you have to apply PostgreSQL core patch (patches/REL_18_STABLE_pg_probackup.patch) first and recompile and reinstall PostgreSQL
95+
9496
###Windows
9597

9698
Currently pg_probackup can be build using only MSVC 2013.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From 5809673569d3d95c7bce75ea0aa6f9723e303c7d Mon Sep 17 00:00:00 2001
2+
From: Daria <d.lepikhova@postgrespro.ru>
3+
Date: Mon, 17 Nov 2025 02:57:38 +0100
4+
Subject: [PATCH] REL_18_STABLE_pg_probackup
5+
6+
---
7+
src/backend/utils/hash/pg_crc.c | 2 ++
8+
1 file changed, 2 insertions(+)
9+
10+
diff --git a/src/backend/utils/hash/pg_crc.c b/src/backend/utils/hash/pg_crc.c
11+
index e67a74ef852..6a474e804b5 100644
12+
--- a/src/backend/utils/hash/pg_crc.c
13+
+++ b/src/backend/utils/hash/pg_crc.c
14+
@@ -99,6 +99,7 @@ const uint32 pg_crc32_table[256] = {
15+
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
16+
};
17+
18+
+#ifndef FRONTEND
19+
/*
20+
* SQL-callable functions
21+
*/
22+
@@ -128,3 +129,4 @@ crc32c_bytea(PG_FUNCTION_ARGS)
23+
24+
PG_RETURN_INT64(crc);
25+
}
26+
+#endif
27+
--
28+
2.39.5 (Apple Git-154)
29+

‎src/backup.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static bool pgpro_support(PGconn *conn);
6666
staticboolpg_is_checksum_enabled(PGconn*conn);
6767
staticboolpg_is_in_recovery(PGconn*conn);
6868
staticboolpg_is_superuser(PGconn*conn);
69+
staticvoidcheck_server_version(PGconn*conn,PGNodeInfo*nodeInfo);
6970
staticvoidconfirm_block_size(PGconn*conn,constchar*name,intblcksz);
7071
staticvoidrewind_and_mark_cfs_datafiles(parray*files,constchar*root,char*relative,size_ti);
7172
staticboolremove_excluded_files_criterion(void*value,void*exclude_args);
@@ -946,7 +947,7 @@ do_backup(InstanceState *instanceState, pgSetBackupParams *set_backup_params,
946947
/*
947948
* Confirm that this server version is supported
948949
*/
949-
void
950+
staticvoid
950951
check_server_version(PGconn*conn,PGNodeInfo*nodeInfo)
951952
{
952953
PGresult*res=NULL;
@@ -2517,11 +2518,16 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno)
25172518
intsegno;
25182519
pgFile**file_item;
25192520
pgFilef;
2521+
#ifPG_VERSION_NUM >=180000
2522+
RelPathStrrel_path_str=relpathperm(rnode,forknum);
2523+
rel_path=rel_path_str.str;
2524+
#else
2525+
rel_path=relpathperm(rnode,forknum);
2526+
#endif
25202527

25212528
segno=blkno /RELSEG_SIZE;
25222529
blkno_inseg=blkno %RELSEG_SIZE;
25232530

2524-
rel_path=relpathperm(rnode,forknum);
25252531
if (segno>0)
25262532
f.rel_path=psprintf("%s.%u",rel_path,segno);
25272533
else
@@ -2553,7 +2559,9 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno)
25532559

25542560
if (segno>0)
25552561
pg_free(f.rel_path);
2562+
#ifPG_VERSION_NUM<180000
25562563
pg_free(rel_path);
2564+
#endif
25572565

25582566
}
25592567

‎src/data.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@ validate_one_page(Page page, BlockNumber absolute_blkno,
15311531
/* Verify checksum */
15321532
page_st->checksum=pg_checksum_page(page,absolute_blkno);
15331533

1534-
if (checksum_version)
1534+
if (checksum_version&& !skip_block_validation)
15351535
{
15361536
/* Checksums are enabled, so check them. */
15371537
if (page_st->checksum!= ((PageHeader)page)->pd_checksum)

‎src/pg_probackup.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ main(int argc, char *argv[])
687687
if (instance_config.pgdata!=NULL&&
688688
(backup_subcmd!=ARCHIVE_GET_CMD&&backup_subcmd!=CATCHUP_CMD)&&
689689
!is_absolute_path(instance_config.pgdata))
690-
elog(ERROR,"-D, --pgdata must be an absolute path");
690+
elog(ERROR,"-D, --pgdata must be an absolute path: %s",instance_config.pgdata);
691691

692692
#ifPG_VERSION_NUM >=110000
693693
/* Check xlog-seg-size option */
@@ -980,13 +980,7 @@ main(int argc, char *argv[])
980980
wal_file_path,wal_file_name,batch_size, !no_validate_wal);
981981
break;
982982
caseADD_INSTANCE_CMD:
983-
{
984-
PGNodeInfonodeInfo;
985-
pgNodeInit(&nodeInfo);
986-
instanceState->conn=pgut_connect(dbhost,dbport,dbname,dbuser);
987-
check_server_version(instanceState->conn,&nodeInfo);
988-
returndo_add_instance(instanceState,&instance_config);
989-
}
983+
returndo_add_instance(instanceState,&instance_config);
990984
caseDELETE_INSTANCE_CMD:
991985
returndo_delete_instance(instanceState);
992986
caseINIT_CMD:

‎src/pg_probackup.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,6 @@ extern const char *base36enc_to(long unsigned int value, char buf[ARG_SIZE_HINT
12451245
externlong unsignedintbase36dec(constchar*text);
12461246
externuint32parse_server_version(constchar*server_version_str);
12471247
externuint32parse_program_version(constchar*program_version);
1248-
voidcheck_server_version(PGconn*conn,PGNodeInfo*nodeInfo);
12491248
externboolparse_page(Pagepage,XLogRecPtr*lsn);
12501249
externint32do_compress(void*dst,size_tdst_size,voidconst*src,size_tsrc_size,
12511250
CompressAlgalg,intlevel,constchar**errormsg);

‎src/stream.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,11 @@ CreateReplicationSlot_compat(PGconn *conn, const char *slot_name, const char *pl
188188
boolis_temporary,boolis_physical,
189189
boolslot_exists_ok)
190190
{
191-
#ifPG_VERSION_NUM >=150000
191+
#ifPG_VERSION_NUM >=180000
192+
returnCreateReplicationSlot(conn,slot_name,plugin,is_temporary,is_physical,
193+
/* reserve_wal = */ true,slot_exists_ok,/* two_phase = */ false,/* failover = */ false);
194+
#elifPG_VERSION_NUM >=150000
195+
192196
returnCreateReplicationSlot(conn,slot_name,plugin,is_temporary,is_physical,
193197
/* reserve_wal = */ true,slot_exists_ok,/* two_phase = */ false);
194198
#elifPG_VERSION_NUM >=110000

‎src/util.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ digestControlFile(ControlFileData *ControlFile, char *src, size_t size)
9393
#endif
9494

9595
if (size!=ControlFileSize)
96+
{
97+
if (size==16384)
98+
elog(ERROR,"Unexpected control file size %d, expected %d. Probably you trying to connect Postgres Pro using %s built with PostgreSQL. ",
99+
(int)size,ControlFileSize,PROGRAM_NAME);
96100
elog(ERROR,"Unexpected control file size %d, expected %d",
97101
(int)size,ControlFileSize);
102+
}
98103

99104
memcpy(ControlFile,src,sizeof(ControlFileData));
100105

‎src/utils/pgut.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,23 @@ handle_interrupt(SIGNAL_ARGS)
10621062
staticvoid
10631063
init_cancel_handler(void)
10641064
{
1065+
#ifPG_VERSION_NUM<180000
10651066
oldhandler=pqsignal(SIGINT,handle_interrupt);
1067+
#else
1068+
{
1069+
structsigactionact,oldact;
1070+
1071+
act.sa_handler=handle_interrupt;
1072+
sigemptyset(&act.sa_mask);
1073+
act.sa_flags=SA_RESTART;
1074+
1075+
/* Get the previous handler and set the new one */
1076+
if (sigaction(SIGINT,&act,&oldact)<0)
1077+
elog(ERROR,"sigaction(SIGINT) failed: %m");
1078+
1079+
oldhandler=oldact.sa_handler;
1080+
}
1081+
#endif
10661082
pqsignal(SIGQUIT,handle_interrupt);
10671083
pqsignal(SIGTERM,handle_interrupt);
10681084
pqsignal(SIGPIPE,handle_interrupt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp