mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-01-20 11:34:51 +02:00
Merge branch 'pgpro-1973'
This commit is contained in:
commit
202c88b8a1
11
src/backup.c
11
src/backup.c
@ -405,7 +405,7 @@ remote_backup_files(void *arg)
|
||||
instance_config.pguser);
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "interrupted during backup");
|
||||
|
||||
query_str = psprintf("FILE_BACKUP FILEPATH '%s'",file->path);
|
||||
@ -621,6 +621,7 @@ do_backup_instance(void)
|
||||
/* By default there are some error */
|
||||
stream_thread_arg.ret = 1;
|
||||
|
||||
thread_interrupted = false;
|
||||
pthread_create(&stream_thread, NULL, StreamLog, &stream_thread_arg);
|
||||
}
|
||||
|
||||
@ -678,8 +679,7 @@ do_backup_instance(void)
|
||||
* where this backup has started.
|
||||
*/
|
||||
extractPageMap(arclog_path, current.tli, instance_config.xlog_seg_size,
|
||||
prev_backup->start_lsn, current.start_lsn,
|
||||
backup_files_list);
|
||||
prev_backup->start_lsn, current.start_lsn);
|
||||
}
|
||||
else if (current.backup_mode == BACKUP_MODE_DIFF_PTRACK)
|
||||
{
|
||||
@ -746,6 +746,7 @@ do_backup_instance(void)
|
||||
}
|
||||
|
||||
/* Run threads */
|
||||
thread_interrupted = false;
|
||||
elog(INFO, "Start transfering data files");
|
||||
for (i = 0; i < num_threads; i++)
|
||||
{
|
||||
@ -2244,7 +2245,7 @@ backup_files(void *arg)
|
||||
elog(VERBOSE, "Copying file: \"%s\" ", file->path);
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "interrupted during backup");
|
||||
|
||||
if (progress)
|
||||
@ -2689,7 +2690,7 @@ stop_streaming(XLogRecPtr xlogpos, uint32 timeline, bool segment_finished)
|
||||
static XLogRecPtr prevpos = InvalidXLogRecPtr;
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "Interrupted during backup");
|
||||
|
||||
/* we assume that we get called once at the end of each segment */
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include "utils/thread.h"
|
||||
|
||||
/* Union to ease operations on relation pages */
|
||||
typedef union DataPage
|
||||
{
|
||||
@ -318,7 +320,7 @@ prepare_page(backup_files_arg *arguments,
|
||||
BlockNumber absolute_blknum = file->segno * RELSEG_SIZE + blknum;
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "Interrupted during backup");
|
||||
|
||||
/*
|
||||
|
@ -131,7 +131,7 @@ help_pg_probackup(void)
|
||||
printf(_(" [--skip-block-validation]\n"));
|
||||
|
||||
printf(_("\n %s validate -B backup-path [--instance=instance_name]\n"), PROGRAM_NAME);
|
||||
printf(_(" [-i backup-id] [--progress]\n"));
|
||||
printf(_(" [-i backup-id] [--progress] [-j num-threads]\n"));
|
||||
printf(_(" [--time=time|--xid=xid|--lsn=lsn [--inclusive=boolean]]\n"));
|
||||
printf(_(" [--recovery-target-name=target-name]\n"));
|
||||
printf(_(" [--timeline=timeline]\n"));
|
||||
@ -350,6 +350,7 @@ help_validate(void)
|
||||
printf(_(" -i, --backup-id=backup-id backup to validate\n"));
|
||||
|
||||
printf(_(" --progress show progress\n"));
|
||||
printf(_(" -j, --threads=NUM number of parallel threads\n"));
|
||||
printf(_(" --time=time time stamp up to which recovery will proceed\n"));
|
||||
printf(_(" --xid=xid transaction ID up to which recovery will proceed\n"));
|
||||
printf(_(" --lsn=lsn LSN of the write-ahead log location up to which recovery will proceed\n"));
|
||||
|
@ -245,6 +245,7 @@ merge_backups(pgBackup *to_backup, pgBackup *from_backup)
|
||||
pg_atomic_init_flag(&file->lock);
|
||||
}
|
||||
|
||||
thread_interrupted = false;
|
||||
for (i = 0; i < num_threads; i++)
|
||||
{
|
||||
merge_files_arg *arg = &(threads_args[i]);
|
||||
@ -402,7 +403,7 @@ merge_files(void *arg)
|
||||
continue;
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "Interrupted during merging backups");
|
||||
|
||||
/* Directories were created before */
|
||||
|
1241
src/parsexlog.c
1241
src/parsexlog.c
File diff suppressed because it is too large
Load Diff
@ -551,14 +551,11 @@ extern bool check_file_pages(pgFile *file, XLogRecPtr stop_lsn,
|
||||
/* parsexlog.c */
|
||||
extern void extractPageMap(const char *archivedir,
|
||||
TimeLineID tli, uint32 seg_size,
|
||||
XLogRecPtr startpoint, XLogRecPtr endpoint,
|
||||
parray *files);
|
||||
extern void validate_wal(pgBackup *backup,
|
||||
const char *archivedir,
|
||||
time_t target_time,
|
||||
TransactionId target_xid,
|
||||
XLogRecPtr target_lsn,
|
||||
TimeLineID tli, uint32 seg_size);
|
||||
XLogRecPtr startpoint, XLogRecPtr endpoint);
|
||||
extern void validate_wal(pgBackup *backup, const char *archivedir,
|
||||
time_t target_time, TransactionId target_xid,
|
||||
XLogRecPtr target_lsn, TimeLineID tli,
|
||||
uint32 seg_size);
|
||||
extern bool read_recovery_info(const char *archivedir, TimeLineID tli,
|
||||
uint32 seg_size,
|
||||
XLogRecPtr start_lsn, XLogRecPtr stop_lsn,
|
||||
|
@ -511,6 +511,7 @@ restore_backup(pgBackup *backup)
|
||||
}
|
||||
|
||||
/* Restore files into target directory */
|
||||
thread_interrupted = false;
|
||||
for (i = 0; i < num_threads; i++)
|
||||
{
|
||||
restore_files_arg *arg = &(threads_args[i]);
|
||||
@ -617,7 +618,7 @@ restore_files(void *arg)
|
||||
lengthof(from_root), DATABASE_DIR);
|
||||
|
||||
/* check for interrupt */
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "interrupted during restore database");
|
||||
|
||||
rel_path = GetRelativePath(file->path,from_root);
|
||||
|
@ -121,9 +121,6 @@ exit_if_necessary(int elevel)
|
||||
{
|
||||
if (elevel > WARNING && !in_cleanup)
|
||||
{
|
||||
/* Interrupt other possible routines */
|
||||
interrupted = true;
|
||||
|
||||
if (loggin_in_progress)
|
||||
{
|
||||
loggin_in_progress = false;
|
||||
@ -132,11 +129,15 @@ exit_if_necessary(int elevel)
|
||||
|
||||
/* If this is not the main thread then don't call exit() */
|
||||
if (main_tid != pthread_self())
|
||||
{
|
||||
#ifdef WIN32
|
||||
ExitThread(elevel);
|
||||
#else
|
||||
pthread_exit(NULL);
|
||||
#endif
|
||||
/* Interrupt other possible routines */
|
||||
thread_interrupted = true;
|
||||
}
|
||||
else
|
||||
exit(elevel);
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ on_interrupt(void)
|
||||
int save_errno = errno;
|
||||
char errbuf[256];
|
||||
|
||||
/* Set interruped flag */
|
||||
/* Set interrupted flag */
|
||||
interrupted = true;
|
||||
|
||||
/*
|
||||
|
@ -7,8 +7,12 @@
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "postgres_fe.h"
|
||||
|
||||
#include "thread.h"
|
||||
|
||||
bool thread_interrupted = false;
|
||||
|
||||
#ifdef WIN32
|
||||
DWORD main_tid = 0;
|
||||
#else
|
||||
|
@ -34,7 +34,7 @@ extern DWORD main_tid;
|
||||
extern pthread_t main_tid;
|
||||
#endif
|
||||
|
||||
|
||||
extern bool thread_interrupted;
|
||||
|
||||
extern int pthread_lock(pthread_mutex_t *mp);
|
||||
|
||||
|
@ -115,6 +115,7 @@ pgBackupValidate(pgBackup *backup)
|
||||
palloc(sizeof(validate_files_arg) * num_threads);
|
||||
|
||||
/* Validate files */
|
||||
thread_interrupted = false;
|
||||
for (i = 0; i < num_threads; i++)
|
||||
{
|
||||
validate_files_arg *arg = &(threads_args[i]);
|
||||
@ -184,7 +185,7 @@ pgBackupValidateFiles(void *arg)
|
||||
if (!pg_atomic_test_set_flag(&file->lock))
|
||||
continue;
|
||||
|
||||
if (interrupted)
|
||||
if (interrupted || thread_interrupted)
|
||||
elog(ERROR, "Interrupted during validate");
|
||||
|
||||
/* Validate only regular files */
|
||||
|
@ -63,7 +63,7 @@ pg_probackup - utility to manage backup/recovery of PostgreSQL database.
|
||||
[--skip-block-validation]
|
||||
|
||||
pg_probackup validate -B backup-path [--instance=instance_name]
|
||||
[-i backup-id] [--progress]
|
||||
[-i backup-id] [--progress] [-j num-threads]
|
||||
[--time=time|--xid=xid|--lsn=lsn [--inclusive=boolean]]
|
||||
[--recovery-target-name=target-name]
|
||||
[--timeline=timeline]
|
||||
|
@ -711,7 +711,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
'INFO: Wait for LSN' in e.message and
|
||||
'in archived WAL segment' in e.message and
|
||||
'could not read WAL record at' in e.message and
|
||||
'Could not read WAL record at' in e.message and
|
||||
'WAL segment "{0}" is absent\n'.format(
|
||||
file) in e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
@ -737,7 +737,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
'INFO: Wait for LSN' in e.message and
|
||||
'in archived WAL segment' in e.message and
|
||||
'could not read WAL record at' in e.message and
|
||||
'Could not read WAL record at' in e.message and
|
||||
'WAL segment "{0}" is absent\n'.format(
|
||||
file) in e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
@ -829,7 +829,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
'INFO: Wait for LSN' in e.message and
|
||||
'in archived WAL segment' in e.message and
|
||||
'could not read WAL record at' in e.message and
|
||||
'Could not read WAL record at' in e.message and
|
||||
'incorrect resource manager data checksum in record at' in e.message and
|
||||
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
|
||||
file) in e.message,
|
||||
@ -855,7 +855,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
'INFO: Wait for LSN' in e.message and
|
||||
'in archived WAL segment' in e.message and
|
||||
'could not read WAL record at' in e.message and
|
||||
'Could not read WAL record at' in e.message and
|
||||
'incorrect resource manager data checksum in record at' in e.message and
|
||||
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
|
||||
file) in e.message,
|
||||
@ -952,7 +952,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
'INFO: Wait for LSN' in e.message and
|
||||
'in archived WAL segment' in e.message and
|
||||
'could not read WAL record at' in e.message and
|
||||
'Could not read WAL record at' in e.message and
|
||||
'WAL file is from different database system: WAL file database system identifier is' in e.message and
|
||||
'pg_control database system identifier is' in e.message and
|
||||
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
|
||||
@ -979,7 +979,7 @@ class PageBackupTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(
|
||||
'INFO: Wait for LSN' in e.message and
|
||||
'in archived WAL segment' in e.message and
|
||||
'could not read WAL record at' in e.message and
|
||||
'Could not read WAL record at' in e.message and
|
||||
'WAL file is from different database system: WAL file database system identifier is' in e.message and
|
||||
'pg_control database system identifier is' in e.message and
|
||||
'Possible WAL corruption. Error has occured during reading WAL segment "{0}"'.format(
|
||||
|
@ -58,7 +58,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'{0} blknum 1, empty page'.format(file_path) in f.read(),
|
||||
'Failed to detect nullified block')
|
||||
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -96,10 +96,10 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Validate to real time
|
||||
self.assertIn(
|
||||
"INFO: backup validation completed successfully",
|
||||
"INFO: Backup validation completed successfully",
|
||||
self.validate_pb(
|
||||
backup_dir, 'node',
|
||||
options=["--time={0}".format(target_time)]),
|
||||
options=["--time={0}".format(target_time), "-j", "4"]),
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(self.output), self.cmd))
|
||||
|
||||
@ -108,7 +108,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', options=["--time={0}".format(
|
||||
unreal_time_1)])
|
||||
unreal_time_1), "-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of validation to unreal time.\n "
|
||||
@ -126,7 +126,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node',
|
||||
options=["--time={0}".format(unreal_time_2)])
|
||||
options=["--time={0}".format(unreal_time_2), "-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of validation to unreal time.\n "
|
||||
@ -134,7 +134,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
'ERROR: not enough WAL records to time' in e.message,
|
||||
'ERROR: Not enough WAL records to time' in e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
@ -148,9 +148,10 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
self.switch_wal_segment(node)
|
||||
|
||||
self.assertIn(
|
||||
"INFO: backup validation completed successfully",
|
||||
"INFO: Backup validation completed successfully",
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', options=["--xid={0}".format(target_xid)]),
|
||||
backup_dir, 'node', options=["--xid={0}".format(target_xid),
|
||||
"-j", "4"]),
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(self.output), self.cmd))
|
||||
|
||||
@ -158,7 +159,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
unreal_xid = int(target_xid) + 1000
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', options=["--xid={0}".format(unreal_xid)])
|
||||
backup_dir, 'node', options=["--xid={0}".format(unreal_xid),
|
||||
"-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of validation to unreal xid.\n "
|
||||
@ -166,12 +168,13 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
'ERROR: not enough WAL records to xid' in e.message,
|
||||
'ERROR: Not enough WAL records to xid' in e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
# Validate with backup ID
|
||||
output = self.validate_pb(backup_dir, 'node', backup_id)
|
||||
output = self.validate_pb(backup_dir, 'node', backup_id,
|
||||
options=["-j", "4"])
|
||||
self.assertIn(
|
||||
"INFO: Validating backup {0}".format(backup_id),
|
||||
output,
|
||||
@ -257,7 +260,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
# Simple validate
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', backup_id=backup_id_2)
|
||||
backup_dir, 'node', backup_id=backup_id_2, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data files corruption.\n "
|
||||
@ -360,7 +363,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
# Validate PAGE1
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', backup_id=backup_id_2)
|
||||
backup_dir, 'node', backup_id=backup_id_2, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data files corruption.\n "
|
||||
@ -459,7 +462,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
# Validate PAGE1
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', backup_id=backup_id_2)
|
||||
backup_dir, 'node', backup_id=backup_id_2, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because backup has status ERROR.\n "
|
||||
@ -546,7 +549,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Validate instance
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because backup has status ERROR.\n "
|
||||
@ -685,7 +688,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node',
|
||||
backup_id=backup_id_4)
|
||||
backup_id=backup_id_4, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data files corruption.\n"
|
||||
@ -885,7 +888,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
self.validate_pb(
|
||||
backup_dir, 'node',
|
||||
options=[
|
||||
'-i', backup_id_4, '--xid={0}'.format(target_xid)])
|
||||
'-i', backup_id_4, '--xid={0}'.format(target_xid),
|
||||
"-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data files corruption.\n "
|
||||
@ -1026,8 +1030,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Validate Instance
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data files corruption.\n "
|
||||
@ -1175,7 +1178,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Validate Instance
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(1, 0, "Expecting Error because of data files corruption.\n Output: {0} \n CMD: {1}".format(
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
@ -1276,7 +1279,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Validate Instance
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data files corruption.\n "
|
||||
@ -1334,7 +1337,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Simple validate
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of wal segments corruption.\n"
|
||||
@ -1404,7 +1407,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'node',
|
||||
backup_id,
|
||||
options=[
|
||||
"--xid={0}".format(target_xid)])
|
||||
"--xid={0}".format(target_xid), "-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of wal segments corruption.\n"
|
||||
@ -1461,7 +1464,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
file = file[:-3]
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of wal segment disappearance.\n"
|
||||
@ -1485,7 +1488,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Run validate again
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', backup_id)
|
||||
self.validate_pb(backup_dir, 'node', backup_id, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup corruption.\n"
|
||||
@ -1569,7 +1572,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
'node',
|
||||
backup_id,
|
||||
options=[
|
||||
"--xid={0}".format(target_xid)])
|
||||
"--xid={0}".format(target_xid), "-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of wal segments corruption.\n"
|
||||
@ -1577,9 +1580,9 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
'ERROR: not enough WAL records to xid' in e.message and
|
||||
'WARNING: recovery can be done up to time' in e.message and
|
||||
"ERROR: not enough WAL records to xid {0}\n".format(
|
||||
'ERROR: Not enough WAL records to xid' in e.message and
|
||||
'WARNING: Recovery can be done up to time' in e.message and
|
||||
"ERROR: Not enough WAL records to xid {0}\n".format(
|
||||
target_xid),
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
@ -1623,7 +1626,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
try:
|
||||
self.validate_pb(
|
||||
backup_dir, 'node',
|
||||
options=["--time={0}".format(recovery_time)])
|
||||
options=["--time={0}".format(recovery_time), "-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of wal segment disappearance.\n "
|
||||
@ -1663,7 +1666,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
backup_dir, 'node', backup_id)['recovery-time']
|
||||
|
||||
self.validate_pb(
|
||||
backup_dir, 'node', options=["--time={0}".format(recovery_time)])
|
||||
backup_dir, 'node', options=["--time={0}".format(recovery_time),
|
||||
"-j", "4"])
|
||||
|
||||
# Clean after yourself
|
||||
self.del_test_dir(module_name, fname)
|
||||
@ -1820,7 +1824,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(file, file_new)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data file dissapearance.\n "
|
||||
@ -1858,7 +1862,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
os.rename(file_new, file)
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'WARNING: Some backups are not valid'.format(
|
||||
@ -1923,7 +1927,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(file, file_new)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data file dissapearance.\n "
|
||||
@ -1963,7 +1967,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(file, file_new)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'WARNING: Some backups are not valid'.format(
|
||||
@ -2037,7 +2041,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(file, file_new)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data file dissapearance.\n "
|
||||
@ -2084,7 +2089,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
self.backup_node(backup_dir, 'node', node, backup_type='page')
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data file dissapearance.\n "
|
||||
@ -2152,7 +2157,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
# revalidate again
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data file dissapearance.\n "
|
||||
@ -2225,7 +2231,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
# Fix CORRUPT
|
||||
os.rename(file_new, file)
|
||||
|
||||
output = self.validate_pb(backup_dir, 'node', validate_id)
|
||||
output = self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
|
||||
self.assertIn(
|
||||
'WARNING: Backup {0} has status: ORPHAN'.format(validate_id),
|
||||
@ -2387,7 +2394,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(file, file_new)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of data file dissapearance.\n "
|
||||
@ -2429,7 +2436,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(old_directory, new_directory)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'WARNING: Some backups are not valid', e.message,
|
||||
@ -2473,7 +2480,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
# second time must be provided with ID of missing backup
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir)
|
||||
self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
except ProbackupException as e:
|
||||
self.assertIn(
|
||||
'WARNING: Some backups are not valid', e.message,
|
||||
@ -2518,7 +2525,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[1]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['status'] == 'OK')
|
||||
|
||||
output = self.validate_pb(backup_dir)
|
||||
output = self.validate_pb(backup_dir, options=["-j", "4"])
|
||||
|
||||
self.assertIn(
|
||||
'INFO: All backups are valid',
|
||||
@ -2694,7 +2701,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(old_directory, new_directory)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -2734,7 +2742,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[0]['status'] == 'OK')
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -2763,7 +2772,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(new_directory, old_directory)
|
||||
|
||||
# Revalidate backup chain
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id, options=["-j", "4"])
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[11]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[10]['status'] == 'OK')
|
||||
@ -2841,7 +2850,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(full_old_directory, full_new_directory)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -2884,7 +2894,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(full_new_directory, full_old_directory)
|
||||
|
||||
# Revalidate backup chain
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id, options=["-j", "4"])
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[11]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[10]['status'] == 'OK')
|
||||
@ -2964,7 +2974,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(full_old_directory, full_new_directory)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -3007,7 +3018,8 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Revalidate backup chain
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id,
|
||||
options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -3072,7 +3084,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(full_new_directory, full_old_directory)
|
||||
|
||||
# Revalidate chain
|
||||
self.validate_pb(backup_dir, 'node', validate_id)
|
||||
self.validate_pb(backup_dir, 'node', validate_id, options=["-j", "4"])
|
||||
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[11]['status'] == 'OK')
|
||||
self.assertTrue(self.show_pb(backup_dir, 'node')[10]['status'] == 'OK')
|
||||
@ -3148,7 +3160,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
os.rename(full_old_directory, full_new_directory)
|
||||
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -3197,7 +3209,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Revalidate backup chain
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of backup dissapearance.\n "
|
||||
@ -3306,7 +3318,7 @@ class ValidateTest(ProbackupTest, unittest.TestCase):
|
||||
|
||||
# Validate backup
|
||||
try:
|
||||
self.validate_pb(backup_dir, 'node')
|
||||
self.validate_pb(backup_dir, 'node', options=["-j", "4"])
|
||||
self.assertEqual(
|
||||
1, 0,
|
||||
"Expecting Error because of pg_control change.\n "
|
||||
|
Loading…
x
Reference in New Issue
Block a user