Skip to content

Commit 1a48b0a

Browse files
committed
bugfix: add additional cmdline check (reported by Roman Zharkov)
1 parent 6240c9f commit 1a48b0a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/pg_probackup.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ main(int argc, char *argv[])
451451
catalogState->catalog_path, WAL_SUBDIR);
452452
}
453453

454-
/* backup_path is required for all pg_probackup commands except help, version and checkdb */
454+
/* backup_path is required for all pg_probackup commands except help, version, checkdb and catchup */
455455
if (backup_path == NULL &&
456456
backup_subcmd != CHECKDB_CMD &&
457457
backup_subcmd != HELP_CMD &&
@@ -598,6 +598,13 @@ main(int argc, char *argv[])
598598
"You must specify --log-directory option when running checkdb with "
599599
"--log-level-file option enabled.");
600600

601+
if (backup_subcmd == CATCHUP_CMD &&
602+
instance_config.logger.log_level_file != LOG_OFF &&
603+
instance_config.logger.log_directory == NULL)
604+
elog(ERROR, "Cannot save catchup logs to a file. "
605+
"You must specify --log-directory option when running catchup with "
606+
"--log-level-file option enabled.");
607+
601608
/* Initialize logger */
602609
init_logger(backup_path, &instance_config.logger);
603610

tests/catchup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import io
21
import os
32
import unittest
43
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
@@ -381,8 +380,6 @@ def test_tablefile_truncation(self):
381380
source_pgdata = source_pg.data_dir,
382381
destination_node = dest_pg,
383382
options = ['-d', 'postgres', '-p', str(source_pg.port), '--stream'])
384-
with io.open(os.path.join(dest_pg.logs_dir, 'catchup.log'), 'a') as catchup_log:
385-
catchup_log.write(self.output)
386383

387384
source_pgdata = self.pgdata_content(source_pg.data_dir)
388385
dest_pgdata = self.pgdata_content(dest_pg.data_dir)

tests/helpers/ptrack_helpers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,10 @@ def catchup_node(
10531053
if self.remote:
10541054
cmd_list += ['--remote-proto=ssh', '--remote-host=localhost']
10551055
if self.verbose:
1056-
cmd_list += ['--log-level-console=verbose']
1056+
cmd_list += [
1057+
'--log-level-file=VERBOSE',
1058+
'--log-directory={0}'.format(destination_node.logs_dir)
1059+
]
10571060

10581061
return self.run_pb(cmd_list + options)
10591062

0 commit comments

Comments
 (0)