run()

Main function, called by actual script in bin/, wraps all work done by script with the sole exception of reading and validating command line arguments.

These tasks (reading and validating arguments) are in this module, but they are called from OmniPITR::Program::new()

Name of called method should be self explanatory, and if you need further information - simply check doc for the method you have questions about.

run_transfers

Runs alls the transfer commands, watching for errors.

run_pg_start_backup

Calls pg_start_backup() function in database, and checks if return is sane.

run_pg_stop_backup

Calls pg_stop_backup() function in database, and checks if return is sane.

prepare_commands_to_run

Helper function, which, for every source generates command that has to be run to transfer it to destinations.

Generated commands are stored in $self->{'commands'} arrayref, as hashref, with keys:

  • cmd - command to run (via shell)

  • label - short description what this command does

Internally there is no logic in this function - it just redirects call to prepare_commands_to_run_via_tar or prepare_commands_to_run_via_rsync depending on existence of --rsync switch

prepare_commands_to_run_via_tar

Creates command list (vide prepare_commands_to_run method) when omnipitr-synch was called without --rsync option.

prepare_commands_to_run_via_rsync

Creates command list (vide prepare_commands_to_run method) when omnipitr-synch was called with --rsync option.

get_user_confirmation

This program should be run manually because it's potentially destructive.

Unless user specified -a option, we should print what is what, and get final confirmation.

get_list_of_directories_to_process

Gets (if it was not passed) data dir plus paths to all used tablespaces, applies mapping, and stores it all as hashref in $self->{'transfers'}.

apply_output_mapping

For all tablespaces, apply mapping rules (given by -m option), and store the result under key 'mapped'

read_args_specification

Defines which options are legal for this program.

read_args_normalization

Function called back from OmniPITR::Program::read_args(), with parsed args as hashref.

Is responsible for putting arguments to correct places, initializing logs, and so on.

validate_args()

Does all necessary validation of given command line arguments.

One exception is for programs paths - technically, it could be validated in here, but benefit would be pretty limited, and code to do so relatively complex, as program path might, but doesn't have to be actual file path - it might be just program name (without path), which is the default.