Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8623628

Browse files
committed
Merge branch 'master' into issue_79
2 parents 79f6733 + 46f875b commit 8623628

File tree

10 files changed

+808
-742
lines changed

10 files changed

+808
-742
lines changed

Documentation.md

+751-696
Large diffs are not rendered by default.

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Regardless of the chosen backup type, all backups taken with `pg_probackup` supp
3333
* `Autonomous backups` streams via replication protocol all the WAL files required to restore the cluster to a consistent state at the time the backup was taken. Even if continuous archiving is not set up, the required WAL segments are included into the backup.
3434
* `Archive backups` rely on continuous archiving.
3535

36+
## ptrack support
37+
3638
`PTRACK` backup support provided via following options:
3739
* vanilla PostgreSQL compiled with ptrack patch. Currently there are patches for [PostgreSQL 9.6](https://gist.githubusercontent.com/gsmol/5b615c971dfd461c76ef41a118ff4d97/raw/e471251983f14e980041f43bea7709b8246f4178/ptrack_9.6.6_v1.5.patch) and [PostgreSQL 10](https://gist.githubusercontent.com/gsmol/be8ee2a132b88463821021fd910d960e/raw/de24f9499f4f314a4a3e5fae5ed4edb945964df8/ptrack_10.1_v1.5.patch)
3840
* Postgres Pro Standard 9.5, 9.6, 10, 11
@@ -47,7 +49,7 @@ Regardless of the chosen backup type, all backups taken with `pg_probackup` supp
4749

4850
## Current release
4951

50-
[2.1.4](https://github.com/postgrespro/pg_probackup/releases/tag/2.1.4)
52+
[2.1.5](https://github.com/postgrespro/pg_probackup/releases/tag/2.1.5)
5153

5254
## Installation and Setup
5355
### Windows Installation
@@ -110,7 +112,8 @@ gen_probackup_project.pl C:\path_to_postgresql_source_tree
110112

111113
## Documentation
112114

113-
Currently the latest documentation can be found at [github](https://github.com/postgrespro/pg_probackup/blob/master/Documentation.md) and [Postgres Pro Enterprise documentation](https://postgrespro.com/docs/postgrespro/current/app-pgprobackup).
115+
Currently the latest documentation can be found at [github](https://postgrespro.github.io/pg_probackup)
116+
Slightly outdated documentation can be found at [Postgres Pro Enterprise documentation](https://postgrespro.com/docs/postgrespro/current/app-pgprobackup).
114117

115118
## License
116119

doit.cmd

-3
This file was deleted.

doit96.cmd

-1
This file was deleted.

gen_probackup_project.pl

+4-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ sub build_pgprobackup
155155
'restore.c',
156156
'show.c',
157157
'util.c',
158-
'validate.c'
158+
'validate.c',
159+
'checkdb.c'
159160
);
160161
$probackup->AddFiles(
161162
"$currpath/src/utils",
@@ -166,7 +167,8 @@ sub build_pgprobackup
166167
'logger.c',
167168
'parray.c',
168169
'pgut.c',
169-
'thread.c'
170+
'thread.c',
171+
'remote.c'
170172
);
171173
$probackup->AddFile("$pgsrc/src/backend/access/transam/xlogreader.c");
172174
$probackup->AddFile("$pgsrc/src/backend/utils/hash/pg_crc.c");

src/backup.c

+36-33
Original file line numberDiff line numberDiff line change
@@ -678,28 +678,57 @@ do_backup(time_t start_time, bool no_validate)
678678
elog(ERROR, "required parameter not specified: PGDATA "
679679
"(-D, --pgdata)");
680680

681+
/* Update backup status and other metainfo. */
682+
current.status = BACKUP_STATUS_RUNNING;
683+
current.start_time = start_time;
684+
StrNCpy(current.program_version, PROGRAM_VERSION,
685+
sizeof(current.program_version));
686+
681687
current.compress_alg = instance_config.compress_alg;
682688
current.compress_level = instance_config.compress_level;
683689

690+
/* Save list of external directories */
691+
if (instance_config.external_dir_str &&
692+
pg_strcasecmp(instance_config.external_dir_str, "none") != 0)
693+
{
694+
current.external_dir_str = instance_config.external_dir_str;
695+
}
696+
697+
elog(INFO, "Backup start, pg_probackup version: %s, instance: %s, backup ID: %s, backup mode: %s, "
698+
"wal-method: %s, remote: %s, compress-algorithm: %s, compress-level: %i",
699+
PROGRAM_VERSION, instance_name, base36enc(start_time), pgBackupGetBackupMode(&current),
700+
current.stream ? "STREAM" : "ARCHIVE", IsSshProtocol() ? "true" : "false",
701+
deparse_compress_alg(current.compress_alg), current.compress_level);
702+
703+
/* Create backup directory and BACKUP_CONTROL_FILE */
704+
if (pgBackupCreateDir(&current))
705+
elog(ERROR, "Cannot create backup directory");
706+
if (!lock_backup(&current))
707+
elog(ERROR, "Cannot lock backup %s directory",
708+
base36enc(current.start_time));
709+
write_backup(&current);
710+
711+
/* set the error processing function for the backup process */
712+
pgut_atexit_push(backup_cleanup, NULL);
713+
714+
elog(LOG, "Backup destination is initialized");
715+
684716
/*
685717
* setup backup_conn, do some compatibility checks and
686718
* fill basic info about instance
687719
*/
688720
backup_conn = pgdata_basic_setup(instance_config.conn_opt, &nodeInfo);
721+
722+
if (current.from_replica)
723+
elog(INFO, "Backup %s is going to be taken from standby", base36enc(start_time));
724+
689725
/*
690726
* Ensure that backup directory was initialized for the same PostgreSQL
691727
* instance we opened connection to. And that target backup database PGDATA
692728
* belogns to the same instance.
693729
*/
694730
check_system_identifiers(backup_conn, instance_config.pgdata);
695731

696-
elog(INFO, "Backup start, pg_probackup version: %s, instance: %s, backup ID: %s, backup mode: %s, "
697-
"wal-method: %s, remote: %s, replica: %s, compress-algorithm: %s, compress-level: %i",
698-
PROGRAM_VERSION, instance_name, base36enc(start_time), pgBackupGetBackupMode(&current),
699-
current.stream ? "STREAM" : "ARCHIVE", IsSshProtocol() ? "true" : "false",
700-
current.from_replica ? "true" : "false", deparse_compress_alg(current.compress_alg),
701-
current.compress_level);
702-
703732
/* below perform checks specific for backup command */
704733
#if PG_VERSION_NUM >= 110000
705734
if (!RetrieveWalSegSize(backup_conn))
@@ -728,32 +757,6 @@ do_backup(time_t start_time, bool no_validate)
728757
if (instance_config.master_conn_opt.pghost == NULL)
729758
elog(ERROR, "Options for connection to master must be provided to perform backup from replica");
730759

731-
/* Start backup. Update backup status. */
732-
current.status = BACKUP_STATUS_RUNNING;
733-
current.start_time = start_time;
734-
StrNCpy(current.program_version, PROGRAM_VERSION,
735-
sizeof(current.program_version));
736-
737-
/* Save list of external directories */
738-
if (instance_config.external_dir_str &&
739-
pg_strcasecmp(instance_config.external_dir_str, "none") != 0)
740-
{
741-
current.external_dir_str = instance_config.external_dir_str;
742-
}
743-
744-
/* Create backup directory and BACKUP_CONTROL_FILE */
745-
if (pgBackupCreateDir(&current))
746-
elog(ERROR, "Cannot create backup directory");
747-
if (!lock_backup(&current))
748-
elog(ERROR, "Cannot lock backup %s directory",
749-
base36enc(current.start_time));
750-
write_backup(&current);
751-
752-
elog(LOG, "Backup destination is initialized");
753-
754-
/* set the error processing function for the backup process */
755-
pgut_atexit_push(backup_cleanup, NULL);
756-
757760
/* backup data */
758761
do_backup_instance(backup_conn, &nodeInfo);
759762
pgut_atexit_pop(backup_cleanup, NULL);

src/pg_probackup.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ typedef enum ShowFormat
195195
#define BYTES_INVALID (-1) /* file didn`t changed since previous backup, DELTA backup do not rely on it */
196196
#define FILE_NOT_FOUND (-2) /* file disappeared during backup */
197197
#define BLOCKNUM_INVALID (-1)
198-
#define PROGRAM_VERSION "2.1.4"
199-
#define AGENT_PROTOCOL_VERSION 20104
198+
#define PROGRAM_VERSION "2.1.5"
199+
#define AGENT_PROTOCOL_VERSION 20105
200200

201201

202202
typedef struct ConnectionOptions

src/utils/remote.c

+7
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,16 @@ static void kill_child(void)
7070

7171
void wait_ssh(void)
7272
{
73+
/*
74+
* We need to wait termination of SSH process to eliminate zombies.
75+
* There is no waitpid() function at Windows but there are no zombie processes caused by lack of wait/waitpid.
76+
* So just disable waitpid for Windows.
77+
*/
78+
#ifndef WIN32
7379
int status;
7480
waitpid(child_pid, &status, 0);
7581
elog(LOG, "SSH process %d is terminated with status %d", child_pid, status);
82+
#endif
7683
}
7784

7885
#ifdef WIN32

tests/expected/option_version.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pg_probackup 2.1.4
1+
pg_probackup 2.1.5

tests/helpers/ptrack_helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1039,10 +1039,10 @@ def set_archiving(
10391039
archive_command = archive_command + '--overwrite '
10401040

10411041
if os.name == 'posix':
1042-
archive_command = archive_command + '--wal-file-path %p --wal-file-name %f'
1042+
archive_command = archive_command + '--wal-file-path=%p --wal-file-name=%f'
10431043

10441044
elif os.name == 'nt':
1045-
archive_command = archive_command + '--wal-file-path "%p" --wal-file-name "%f"'
1045+
archive_command = archive_command + '--wal-file-path="%p" --wal-file-name="%f"'
10461046

10471047
node.append_conf(
10481048
'postgresql.auto.conf',

0 commit comments

Comments
 (0)