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.
There is new bit of information - metadata file.
This file will have the same name schema as all other files, but it's FILETYPE is "meta".
In this file there are two bits of information:
Min-Xlog: minimal xlog filename that is required to restore this backup
Started-epoch: when this backup has been started, given as UTC-based epoch time.
Since these files are different from others, and they get delivered only after everything else (data, xlogs, checksums) have been delivered, delivering them had to be added separately.
In future, I might want to refactor this method, but for now it simply works.
Just a stub method, that has to be overriden in subclasses.
Helper function which waits for file to appear.
It will return only if the file appeared.
Return value is name of file.
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.
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.
Helper function, which takes filetype and compression schema to use, and returns generated filename (based on filename-template command line option).
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:
Delivers backups to remote destinations using rsync program.
Helper function which returns string to be passed to system() to run tar of given directory
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.
Helper function returning command line that should be added to deliver data to direct destination