run()

Main function wrapping all work.

Starts with getting list of compressions that have to be done, then it chooses where to compress to (important if we have remote-only destination), then it makes actual backup, and delivers to all destinations.

make_xlog_archive()

Just a stub method, that has to be overriden in subclasses.

wait_for_file()

Helper function which waits for file to appear.

It will return only if the file appeared.

Return value is name of file.

choose_base_local_destinations()

Chooses single local destination for every compression schema required by destinations specifications.

In case some compression schema exists only for remote destination, local temp directory is created in --temp-dir location.

There can be additional destinations for given compression, if we have direct destinations.

get_tablespaces_and_transforms()

Helper function. Takes no arguments. Uses pg_tblspc directory and returns a listref of the physical locations for tar to include in the backup as well as a listref of the transform regexs that it will need to apply in order for those directories to get untarred to the correct location from pg_tblspc's perspective.

get_archive_filename()

Helper function, which takes filetype and compression schema to use, and returns generated filename (based on filename-template command line option).

tar_and_compress()

Worker function which does all of the actual tar, and sending data to compression filehandles (should be opened before).

Takes hash (not hashref) as argument, and uses following keys from it:

  • tar_dir - arrayref with list of directories to compress

  • work_dir - what should be current working directory when executing tar

  • excludes - optional key, that (if exists) is treated as arrayref of shell globs (tar dir) of items to exclude from backup

  • transform - optional key, that (if exists) is treated as value for --transform option for tar

If tar will print anything to STDERR it will be logged. Error status code is ignored, as it is expected that tar will generate errors (due to files modified while archiving).

Requires following keys in $self:

  • nice-path

  • tar-path

deliver_to_all_remote_destinations()

Delivers backups to remote destinations using rsync program.

_tar_command()

Helper function which returns string to be passed to system() to run tar of given directory

_add_tar_consummers()

Helper function which returns array. Each element of the array is string to be passed to system() that will cause it to compress data from stdin to appropriate output file.

_get_remote_writer_command()

Helper function returning command line that should be added to deliver data to direct destination