The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PGObject::Util::Replication::Slot - Manage and Monitor Replication Slots

VERSION

Version v0.20.0

SYNOPSIS

This module provides a low-level interface for monitoring and managing replication slots. It is intended to be used by other management modules and therefore requires read and write operations to pass in a database handle.

Slots here represent values and should be treated as read-only once instantiated. This is to improve utility when it comes to monitoring and logging.

    use PGObject::Util::Replication::Slot;

    my @slots = PGObject::Util::Replication::Slot->all($dbh);
    my $slot = PGObject::Util::Replication::Slot->get($dbh, 'slotname');

    # can also create and delete
    my $slot = PGObject::Util::Replication::Slot->create($dbh, 'slotname');
    my $success = PGObject::Util::Replication::Slot->delete($dbh, 'slotname');
    

SLOT PROPERTIES

Properties are set from the database. Tthey are not intended to be set by develoers.

slot_name

Name of slot.

slot_type

logical or physical

active

boolean

restart_lsn

Last log serial number sent

full_data

A json object of the whole pg_replication_slots entry. You can use this to get data not supported by base versions, such as last confirmed wal flush on Postgres 9.6. Note that the format here varies from version to version.

query_time

The return value of the now() command at the time the query was run.

pg_current_xlog_location

The current transaction log/wal lsn for the current system. We will not change this field here even when running on PostgreSQL 10

current_lag_bytes

The byte offset between the current xlog logation and the last restart lsn for the slot. This means basically the number of bytes that have not yet been confirmed as read by the slot compared to our current WAL.

METHODS

all($dbh, [$prefix])

Returns a list of objects fo this type filtered on the prefix specified/

get($dbh, $name)

Gets the slot specified by name

create($dbh, $name, [$type])

Creates a new slot, by default a physical one, with the specified name.

delete($dbh, $name)

Deletes the slot with the given name. Note that this will allow wal segments that are pending to be archived and thus may prevent the replica from being able to gatch up through normal means.

AUTHOR

Chris Travers, <chris.travers at adjust.com>

BUGS

Please report any bugs or feature requests to bug-pgobject-util-replication-slot at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PGObject-Util-Replication-Slot. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc PGObject::Util::Replication::Slot

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2017 Adjust.com

This program is distributed under the (Revised) BSD License: http://www.opensource.org/licenses/BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of Adjust.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.