new()

Object contstructor.

Since all OmniPITR programs are based on object, and they start with doing the same things (namely reading and validating command line arguments) - this is wrapped in here, to avoid code duplication.

Constructor also handles pid file creation, in case it was requested.

check_debug()

Internal method providing --debug option handling to every omnipitr program.

If *first* argument to omnipitr program it will print to stderr all arguments, and environment variables.

run()

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

verbose()

Shortcut to make code a bit nicer.

Returns values of (command line given) verbose switch.

log()

Shortcut to make code a bit nicer.

Returns logger object.

prepare_temp_directory()

Helper function, which builds path for temp directory, and creates it.

Path is generated by using given temp-dir and 'omnipitr-backup-master' named.

For example, for temp-dir '/tmp' used temp directory would be /tmp/omnipitr-backup-master.

If any arguments are passed - they are treated as subdirectories. For example, in above example, if ("xxx", "yyy") was passed, generated directory would be /tmp/omnipitr-backup-master/xxx/yyy.

temp_file()

Returns full path to temp file. Name of the file is passed as argument, temp directory is created (if needed) and full path is returned.

DESTROY()

Destructor for object - removes temp directory on program exit.

get_list_of_all_necessary_compressions()

Scans list of destinations, and gathers list of all compressions that have to be made.

This is to be able to compress file only once even when having multiple destinations that require compressed format.

This function is used by all programs that need to compress "stuff" - omnipitr-archive, omnipitr-backup-master and omnipitr-backup-slave.

get_control_data()

Calls pg_controldata, and parses its output.

Verifies that output contains 2 critical pieces of information:

  • Latest checkpoint's REDO location

  • Latest checkpoint's TimeLineID

psql()

Runs given query via psql - assumes there is $self->{'psql-path'}.

Uses also:

  • username

  • database

  • port

  • host

  • optional keys from $self.

    On first run it will cache psql call arguments, so if you'd change them on subsequent calls, you have to delete $self->{'psql'}.

    In case of errors, it raises fatal error.

    Otherwise returns stdout of the psql.

find_tablespaces()

Helper function. Takes no arguments. Uses pg_tblspc directory and returns a hashref of the physical locations of tablespaces. Keys in the hashref are tablespace OIDs (link names in pg_tblspc). Values are hashrefs with two keys:

  • pg_visible - what is the path to tablespace that PostgreSQL sees

  • real_path - what is the real absolute path to tablespace directory

The two can be different in case tablespace got moved and symlinked back to original location, or if tablespace path itself contains symlinks.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 299:

You forgot a '=back' before '=head1'