2016-08-24 12:39:27 -04:00
|
|
|
####################################################################################################################################
|
|
|
|
# ARCHIVE COMMON MODULE
|
|
|
|
####################################################################################################################################
|
2017-06-21 08:02:21 -04:00
|
|
|
package pgBackRest::Archive::Common;
|
2016-08-24 12:39:27 -04:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings FATAL => qw(all);
|
|
|
|
use Carp qw(confess);
|
|
|
|
|
2017-11-16 16:53:49 -05:00
|
|
|
use Config;
|
2016-08-24 12:39:27 -04:00
|
|
|
use Exporter qw(import);
|
|
|
|
our @EXPORT = qw();
|
2017-06-09 17:51:41 -04:00
|
|
|
use Fcntl qw(SEEK_CUR O_RDONLY);
|
2017-01-10 19:59:32 -05:00
|
|
|
use File::Basename qw(dirname);
|
2016-08-24 12:39:27 -04:00
|
|
|
|
|
|
|
use pgBackRest::DbVersion;
|
2017-01-04 18:39:50 -05:00
|
|
|
use pgBackRest::Common::Exception;
|
2016-08-24 12:39:27 -04:00
|
|
|
use pgBackRest::Common::Log;
|
2017-01-10 19:59:32 -05:00
|
|
|
use pgBackRest::Common::Wait;
|
2017-06-09 17:51:41 -04:00
|
|
|
use pgBackRest::Storage::Helper;
|
2016-12-03 10:28:08 -05:00
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# RegEx constants
|
|
|
|
####################################################################################################################################
|
2017-12-18 18:51:19 -05:00
|
|
|
use constant REGEX_ARCHIVE_DIR_DB_VERSION => '^[0-9]+(\.[0-9]+)*-[0-9]+$';
|
2016-12-03 10:28:08 -05:00
|
|
|
push @EXPORT, qw(REGEX_ARCHIVE_DIR_DB_VERSION);
|
|
|
|
use constant REGEX_ARCHIVE_DIR_WAL => '^[0-F]{16}$';
|
|
|
|
push @EXPORT, qw(REGEX_ARCHIVE_DIR_WAL);
|
|
|
|
|
|
|
|
####################################################################################################################################
|
|
|
|
# PostgreSQL WAL system id offset
|
|
|
|
####################################################################################################################################
|
2017-11-16 16:53:49 -05:00
|
|
|
use constant PG_WAL_SYSTEM_ID_OFFSET_GTE_93 => 12 + $Config{ptrsize};
|
2016-12-03 10:28:08 -05:00
|
|
|
push @EXPORT, qw(PG_WAL_SYSTEM_ID_OFFSET_GTE_93);
|
|
|
|
use constant PG_WAL_SYSTEM_ID_OFFSET_LT_93 => 12;
|
|
|
|
push @EXPORT, qw(PG_WAL_SYSTEM_ID_OFFSET_LT_93);
|
|
|
|
|
2017-06-09 17:51:41 -04:00
|
|
|
####################################################################################################################################
|
|
|
|
# WAL segment size
|
|
|
|
####################################################################################################################################
|
|
|
|
use constant PG_WAL_SEGMENT_SIZE => 16777216;
|
|
|
|
push @EXPORT, qw(PG_WAL_SEGMENT_SIZE);
|
|
|
|
|
2016-08-24 12:39:27 -04:00
|
|
|
1;
|