Skip to content

Commit 14e1ae2

Browse files
committed
Merge remote-tracking branch 'origin/master' into pgpro-1457
2 parents 9cdded9 + 0d08027 commit 14e1ae2

File tree

13 files changed

+124
-132
lines changed

13 files changed

+124
-132
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,27 @@ Regardless of the chosen backup type, all backups taken with `pg_probackup` supp
4747
#DEB Ubuntu|Debian Packages
4848
echo "deb [arch=amd64] http://repo.postgrespro.ru/pg_probackup/deb/ $(lsb_release -cs) main-$(lsb_release -cs)" > /etc/apt/sources.list.d/pg_probackup.list
4949
wget -O - http://repo.postgrespro.ru/pg_probackup/keys/GPG-KEY-PG_PROBACKUP | apt-key add - && apt-get update
50-
apt-get install pg-probackup-(10|9.6|9.5)
50+
apt-get install pg-probackup-{10,9.6,9.5}
5151

5252
#DEB-SRC Packages
5353
echo "deb-src [arch=amd64] http://repo.postgrespro.ru/pg_probackup/deb/ $(lsb_release -cs) main-$(lsb_release -cs)" >>\
5454
/etc/apt/sources.list.d/pg_probackup.list
55+
apt-get source pg-probackup-{10,9.6,9.5}
5556

5657
#RPM Centos Packages
5758
rpm -ivh http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-centos.noarch.rpm
58-
yum install pg_probackup-(10|9.6|9.5)
59+
yum install pg_probackup-{10,9.6,9.5}
5960

60-
#SRPM Centos Packages
61-
yumdownloader --source pg_probackup-(10|9.6|9.5)
61+
#RPM RHEL Packages
62+
rpm -ivh http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-rhel.noarch.rpm
63+
yum install pg_probackup-{10,9.6,9.5}
64+
65+
#RPM Oracle Linux Packages
66+
rpm -ivh http://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-oraclelinux.noarch.rpm
67+
yum install pg_probackup-{10,9.6,9.5}
68+
69+
#SRPM Oracle Linux Packages
70+
yumdownloader --source pg_probackup-{10,9.6,9.5}
6271
```
6372

6473
To compile `pg_probackup`, you must have a PostgreSQL installation and raw source tree. To install `pg_probackup`, execute this in the module's directory:

src/backup.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ confirm_block_size(const char *name, int blcksz)
942942
char *endp;
943943
int block_size;
944944

945-
res = pgut_execute(backup_conn, "SELECT current_setting($1)", 1, &name, true);
945+
res = pgut_execute(backup_conn, "SELECT pg_catalog.current_setting($1)", 1, &name, true);
946946
if (PQntuples(res) != 1 || PQnfields(res) != 1)
947947
elog(ERROR, "cannot get %s: %s", name, PQerrorMessage(backup_conn));
948948

@@ -976,13 +976,13 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup)
976976
params[1] = smooth ? "false" : "true";
977977
if (!exclusive_backup)
978978
res = pgut_execute(conn,
979-
"SELECT pg_start_backup($1, $2, false)",
979+
"SELECT pg_catalog.pg_start_backup($1, $2, false)",
980980
2,
981981
params,
982982
true);
983983
else
984984
res = pgut_execute(conn,
985-
"SELECT pg_start_backup($1, $2)",
985+
"SELECT pg_catalog.pg_start_backup($1, $2)",
986986
2,
987987
params,
988988
true);
@@ -1040,9 +1040,9 @@ pg_switch_wal(PGconn *conn)
10401040
PQclear(res);
10411041

10421042
if (server_version >= 100000)
1043-
res = pgut_execute(conn, "SELECT * FROM pg_switch_wal()", 0, NULL, true);
1043+
res = pgut_execute(conn, "SELECT * FROM pg_catalog.pg_switch_wal()", 0, NULL, true);
10441044
else
1045-
res = pgut_execute(conn, "SELECT * FROM pg_switch_xlog()", 0, NULL, true);
1045+
res = pgut_execute(conn, "SELECT * FROM pg_catalog.pg_switch_xlog()", 0, NULL, true);
10461046

10471047
PQclear(res);
10481048
}
@@ -1067,7 +1067,7 @@ pg_ptrack_support(void)
10671067
PQclear(res_db);
10681068

10691069
res_db = pgut_execute(backup_conn,
1070-
"SELECT ptrack_version()",
1070+
"SELECT pg_catalog.ptrack_version()",
10711071
0, NULL, true);
10721072
if (PQntuples(res_db) == 0)
10731073
{
@@ -1127,7 +1127,7 @@ pg_is_in_recovery(void)
11271127
{
11281128
PGresult *res_db;
11291129

1130-
res_db = pgut_execute(backup_conn, "SELECT pg_is_in_recovery()", 0, NULL, true);
1130+
res_db = pgut_execute(backup_conn, "SELECT pg_catalog.pg_is_in_recovery()", 0, NULL, true);
11311131

11321132
if (PQgetvalue(res_db, 0, 0)[0] == 't')
11331133
{
@@ -1166,11 +1166,11 @@ pg_ptrack_clear(void)
11661166
tblspcOid = atoi(PQgetvalue(res_db, i, 2));
11671167

11681168
tmp_conn = pgut_connect(dbname);
1169-
res = pgut_execute(tmp_conn, "SELECT pg_ptrack_clear()", 0, NULL, true);
1169+
res = pgut_execute(tmp_conn, "SELECT pg_catalog.pg_ptrack_clear()", 0, NULL, true);
11701170

11711171
sprintf(params[0], "%i", dbOid);
11721172
sprintf(params[1], "%i", tblspcOid);
1173-
res = pgut_execute(tmp_conn, "SELECT pg_ptrack_get_and_clear_db($1, $2)",
1173+
res = pgut_execute(tmp_conn, "SELECT pg_catalog.pg_ptrack_get_and_clear_db($1, $2)",
11741174
2, (const char **)params, true);
11751175
PQclear(res);
11761176

@@ -1217,7 +1217,7 @@ pg_ptrack_get_and_clear_db(Oid dbOid, Oid tblspcOid)
12171217

12181218
sprintf(params[0], "%i", dbOid);
12191219
sprintf(params[1], "%i", tblspcOid);
1220-
res = pgut_execute(backup_conn, "SELECT pg_ptrack_get_and_clear_db($1, $2)",
1220+
res = pgut_execute(backup_conn, "SELECT pg_catalog.pg_ptrack_get_and_clear_db($1, $2)",
12211221
2, (const char **)params, true);
12221222

12231223
if (PQnfields(res) != 1)
@@ -1278,7 +1278,7 @@ pg_ptrack_get_and_clear(Oid tablespace_oid, Oid db_oid, Oid rel_filenode,
12781278
tmp_conn = pgut_connect(dbname);
12791279
sprintf(params[0], "%i", tablespace_oid);
12801280
sprintf(params[1], "%i", rel_filenode);
1281-
res = pgut_execute(tmp_conn, "SELECT pg_ptrack_get_and_clear($1, $2)",
1281+
res = pgut_execute(tmp_conn, "SELECT pg_catalog.pg_ptrack_get_and_clear($1, $2)",
12821282
2, (const char **)params, true);
12831283

12841284
if (PQnfields(res) != 1)
@@ -1296,7 +1296,7 @@ pg_ptrack_get_and_clear(Oid tablespace_oid, Oid db_oid, Oid rel_filenode,
12961296
*/
12971297
sprintf(params[0], "%i", tablespace_oid);
12981298
sprintf(params[1], "%i", rel_filenode);
1299-
res = pgut_execute(backup_conn, "SELECT pg_ptrack_get_and_clear($1, $2)",
1299+
res = pgut_execute(backup_conn, "SELECT pg_catalog.pg_ptrack_get_and_clear($1, $2)",
13001300
2, (const char **)params, true);
13011301

13021302
if (PQnfields(res) != 1)
@@ -1477,10 +1477,10 @@ wait_replica_wal_lsn(XLogRecPtr lsn, bool is_start_backup)
14771477
if (is_start_backup)
14781478
{
14791479
if (server_version >= 100000)
1480-
res = pgut_execute(backup_conn, "SELECT pg_last_wal_replay_lsn()",
1480+
res = pgut_execute(backup_conn, "SELECT pg_catalog.pg_last_wal_replay_lsn()",
14811481
0, NULL, true);
14821482
else
1483-
res = pgut_execute(backup_conn, "SELECT pg_last_xlog_replay_location()",
1483+
res = pgut_execute(backup_conn, "SELECT pg_catalog.pg_last_xlog_replay_location()",
14841484
0, NULL, true);
14851485
}
14861486
/*
@@ -1490,10 +1490,10 @@ wait_replica_wal_lsn(XLogRecPtr lsn, bool is_start_backup)
14901490
else
14911491
{
14921492
if (server_version >= 100000)
1493-
res = pgut_execute(backup_conn, "SELECT pg_last_wal_receive_lsn()",
1493+
res = pgut_execute(backup_conn, "SELECT pg_catalog.pg_last_wal_receive_lsn()",
14941494
0, NULL, true);
14951495
else
1496-
res = pgut_execute(backup_conn, "SELECT pg_last_xlog_receive_location()",
1496+
res = pgut_execute(backup_conn, "SELECT pg_catalog.pg_last_xlog_receive_location()",
14971497
0, NULL, true);
14981498
}
14991499

@@ -1577,7 +1577,7 @@ pg_stop_backup(pgBackup *backup)
15771577
base36enc(backup->start_time));
15781578
params[0] = name;
15791579

1580-
res = pgut_execute(conn, "SELECT pg_create_restore_point($1)",
1580+
res = pgut_execute(conn, "SELECT pg_catalog.pg_create_restore_point($1)",
15811581
1, params, true);
15821582
PQclear(res);
15831583
}
@@ -1602,22 +1602,22 @@ pg_stop_backup(pgBackup *backup)
16021602
*/
16031603
sent = pgut_send(conn,
16041604
"SELECT"
1605-
" txid_snapshot_xmax(txid_current_snapshot()),"
1605+
" pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()),"
16061606
" current_timestamp(0)::timestamptz,"
16071607
" lsn,"
16081608
" labelfile,"
16091609
" spcmapfile"
1610-
" FROM pg_stop_backup(false)",
1610+
" FROM pg_catalog.pg_stop_backup(false)",
16111611
0, NULL, WARNING);
16121612
}
16131613
else
16141614
{
16151615

16161616
sent = pgut_send(conn,
16171617
"SELECT"
1618-
" txid_snapshot_xmax(txid_current_snapshot()),"
1618+
" pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()),"
16191619
" current_timestamp(0)::timestamptz,"
1620-
" pg_stop_backup() as lsn",
1620+
" pg_catalog.pg_stop_backup() as lsn",
16211621
0, NULL, WARNING);
16221622
}
16231623
pg_stop_backup_is_sent = true;
@@ -2139,8 +2139,8 @@ parse_backup_filelist_filenames(parray *files, const char *root)
21392139
continue;
21402140
}
21412141

2142-
/* Check files located inside database directories */
2143-
if (filename[0] != '\0' && file->dbOid != 0)
2142+
/* Check files located inside database directories including directory 'global' */
2143+
if (filename[0] != '\0' && file->tblspcOid != 0)
21442144
{
21452145
if (strcmp(filename, "pg_internal.init") == 0)
21462146
{
@@ -2700,7 +2700,7 @@ get_last_ptrack_lsn(void)
27002700
uint32 xrecoff;
27012701
XLogRecPtr lsn;
27022702

2703-
res = pgut_execute(backup_conn, "select pg_ptrack_control_lsn()", 0, NULL, true);
2703+
res = pgut_execute(backup_conn, "select pg_catalog.pg_ptrack_control_lsn()", 0, NULL, true);
27042704

27052705
/* Extract timeline and LSN from results of pg_start_backup() */
27062706
XLogDataFromLSN(PQgetvalue(res, 0, 0), &xlogid, &xrecoff);
@@ -2748,7 +2748,7 @@ pg_ptrack_get_block(backup_files_args *arguments,
27482748
//elog(LOG, "db %i pg_ptrack_get_block(%i, %i, %u)",dbOid, tblsOid, relOid, blknum);
27492749
res = pgut_execute_parallel(arguments->thread_backup_conn,
27502750
arguments->thread_cancel_conn,
2751-
"SELECT pg_ptrack_get_block_2($1, $2, $3, $4)",
2751+
"SELECT pg_catalog.pg_ptrack_get_block_2($1, $2, $3, $4)",
27522752
4, (const char **)params, true);
27532753

27542754
if (PQnfields(res) != 1)

src/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fetchFile(PGconn *conn, const char *filename, size_t *filesize)
9595
int len;
9696

9797
params[0] = filename;
98-
res = pgut_execute(conn, "SELECT pg_read_binary_file($1)",
98+
res = pgut_execute(conn, "SELECT pg_catalog.pg_read_binary_file($1)",
9999
1, params, false);
100100

101101
/* sanity check the result set */

src/pg_probackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <sys/stat.h>
1818
#include <unistd.h>
1919

20-
const char *PROGRAM_VERSION = "2.0.15";
20+
const char *PROGRAM_VERSION = "2.0.16";
2121
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
2222
const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues";
2323

@@ -437,7 +437,7 @@ main(int argc, char *argv[])
437437

438438
elog(INFO, "Backup start, pg_probackup version: %s, backup ID: %s, backup mode: %s, instance: %s, stream: %s, remote: %s",
439439
PROGRAM_VERSION, base36enc(start_time), backup_mode, instance_name,
440-
current.stream ? "true" : "false", is_remote_backup ? "true" : "false");
440+
stream_wal ? "true" : "false", is_remote_backup ? "true" : "false");
441441

442442
return do_backup(start_time);
443443
}

src/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ get_remote_system_identifier(PGconn *conn)
148148
char *val;
149149

150150
res = pgut_execute(conn,
151-
"SELECT system_identifier FROM pg_control_system()",
151+
"SELECT system_identifier FROM pg_catalog.pg_control_system()",
152152
0, NULL, true);
153153
val = PQgetvalue(res, 0, 0);
154154
if (!parse_uint64(val, &system_id_conn, 0))

tests/auth_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def test_pgpassword_and_wrong_pgpass(self):
198198
def run_pb_with_auth(cmd, password=None, kill=False):
199199
try:
200200
with spawn(" ".join(cmd), encoding='utf-8', timeout=10) as probackup:
201-
result = probackup.expect("Password for user .*:", 5)
201+
result = probackup.expect(u"Password for user .*:", 5)
202202
if kill:
203203
probackup.kill(signal.SIGINT)
204204
elif result == 0:

tests/backup_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def test_ptrack_threads_stream(self):
292292
self.del_test_dir(module_name, fname)
293293

294294
# @unittest.skip("skip")
295-
def test_checksumm_fail_heal_via_ptrack(self):
295+
def test_page_corruption_heal_via_ptrack_1(self):
296296
"""make node, corrupt some page, check that backup failed"""
297297
fname = self.id().split('.')[3]
298298
node = self.make_simple_node(
@@ -338,7 +338,7 @@ def test_checksumm_fail_heal_via_ptrack(self):
338338
with open(os.path.join(backup_dir, 'log', 'pg_probackup.log')) as f:
339339
log_content = f.read()
340340
self.assertIn('block 1, try to fetch via SQL', log_content)
341-
self.assertIn('SELECT pg_ptrack_get_block', log_content)
341+
self.assertIn('SELECT pg_catalog.pg_ptrack_get_block', log_content)
342342
f.close
343343

344344
self.assertTrue(
@@ -349,7 +349,7 @@ def test_checksumm_fail_heal_via_ptrack(self):
349349
self.del_test_dir(module_name, fname)
350350

351351
# @unittest.skip("skip")
352-
def test_checksumm_fail_heal_via_ptrack_fail(self):
352+
def test_page_corruption_heal_via_ptrack_2(self):
353353
"""make node, corrupt some page, check that backup failed"""
354354
fname = self.id().split('.')[3]
355355
node = self.make_simple_node(
@@ -410,7 +410,7 @@ def test_checksumm_fail_heal_via_ptrack_fail(self):
410410
"calculated checksum" in e.message and
411411
"ERROR: query failed: "
412412
"ERROR: invalid page in block" in e.message and
413-
"query was: SELECT pg_ptrack_get_block_2" in e.message,
413+
"query was: SELECT pg_catalog.pg_ptrack_get_block_2" in e.message,
414414
"\n Unexpected Error Message: {0}\n CMD: {1}".format(
415415
repr(e.message), self.cmd))
416416

tests/expected/option_version.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pg_probackup 2.0.15
1+
pg_probackup 2.0.16

tests/helpers/ptrack_helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def is_enterprise():
9696
stdout=subprocess.PIPE,
9797
stderr=subprocess.PIPE
9898
)
99-
if 'postgrespro.ru' in p.communicate()[0]:
99+
if b'postgrespro.ru' in p.communicate()[0]:
100100
return True
101101
else:
102102
return False
@@ -884,7 +884,7 @@ def del_test_dir(self, module_name, fname):
884884
except:
885885
pass
886886

887-
def pgdata_content(self, directory):
887+
def pgdata_content(self, directory, ignore_ptrack=True):
888888
""" return dict with directory content. "
889889
" TAKE IT AFTER CHECKPOINT or BACKUP"""
890890
dirs_to_ignore = [
@@ -897,9 +897,9 @@ def pgdata_content(self, directory):
897897
'backup_label', 'tablespace_map', 'recovery.conf',
898898
'ptrack_control', 'ptrack_init', 'pg_control'
899899
]
900-
suffixes_to_ignore = (
901-
'_ptrack'
902-
)
900+
# suffixes_to_ignore = (
901+
# '_ptrack'
902+
# )
903903
directory_dict = {}
904904
directory_dict['pgdata'] = directory
905905
directory_dict['files'] = {}
@@ -908,7 +908,7 @@ def pgdata_content(self, directory):
908908
for file in files:
909909
if (
910910
file in files_to_ignore or
911-
file.endswith(suffixes_to_ignore)
911+
(ignore_ptrack and file.endswith('_ptrack'))
912912
):
913913
continue
914914

0 commit comments

Comments
 (0)