1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-12-23 23:51:07 +02:00

v0.75: New repository format, info command and experimental 9.5 support

* IMPORTANT NOTE: This flag day release breaks compatibility with older versions of PgBackRest.  The manifest format, on-disk structure, and the binary names have all changed.  You must create a new repository to hold backups for this version of PgBackRest and keep your older repository for a time in case you need to do a restore.  The `pg_backrest.conf` file has not changed but you'll need to change any references to `pg_backrest.pl` in cron (or elsewhere) to `pg_backrest` (without the `.pl` extension).

* Add info command.

* More efficient file ordering for backup.  Files are copied in descending size order so a single thread does not end up copying a large file at the end.  This had already been implemented for restore.

* Logging now uses unbuffered output.  This should make log files that are being written by multiple threads less chaotic.  Suggested by Michael Renner.

* Experimental support for PostgreSQL 9.5.  This may break when the control version or WAL magic changes but will be updated in each release.
This commit is contained in:
David Steele
2015-06-14 20:59:32 -04:00
parent f83f0fa54d
commit 1afbab010f
62 changed files with 24500 additions and 3139 deletions

View File

@@ -11,8 +11,9 @@ use strict;
use warnings FATAL => qw(all);
use Carp qw(confess);
use File::Basename qw(dirname);
use Cwd qw(abs_path);
use Exporter qw(import);
use File::Basename qw(dirname);
use Scalar::Util 'blessed';
#use Data::Dumper qw(Dumper);
#use Scalar::Util qw(blessed);
@@ -20,15 +21,13 @@ use Scalar::Util 'blessed';
# use Test::Deep;
use lib dirname($0) . '/../lib';
use BackRest::Exception;
use BackRest::Utility;
use BackRest::Config;
use BackRest::Exception;
use BackRest::Ini;
use BackRest::Utility;
use BackRestTest::CommonTest;
use Exporter qw(import);
our @EXPORT = qw(BackRestTestConfig_Test);
sub optionSetTest
{
my $oOption = shift;
@@ -240,6 +239,8 @@ sub optionTestExpect
####################################################################################################################################
# BackRestTestConfig_Test
####################################################################################################################################
our @EXPORT = qw(BackRestTestConfig_Test);
sub BackRestTestConfig_Test
{
my $strTest = shift;
@@ -546,7 +547,7 @@ sub BackRestTestConfig_Test
optionSetTest($oOption, OPTION_COMMAND_PSQL_OPTION, '--port 5432');
configLoadExpect($oOption, OP_BACKUP);
optionTestExpect(OPTION_COMMAND_REMOTE, dirname(abs_path($0)) . '/pg_backrest_remote.pl');
optionTestExpect(OPTION_COMMAND_REMOTE, dirname(abs_path($0)) . '/pg_backrest_remote');
}
if (BackRestTestCommon_Run(++$iRun, OP_BACKUP . ' missing option ' . OPTION_DB_PATH))
@@ -608,8 +609,8 @@ sub BackRestTestConfig_Test
if (BackRestTestCommon_Run(++$iRun, 'load from config stanza section - option ' . OPTION_THREAD_MAX))
{
$oConfig = {};
$$oConfig{"$strStanza:" . &OP_BACKUP}{&OPTION_THREAD_MAX} = 2;
ini_save($strConfigFile, $oConfig);
$$oConfig{"${strStanza}:" . &OP_BACKUP}{&OPTION_THREAD_MAX} = 2;
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -623,7 +624,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{"$strStanza:" . &CONFIG_SECTION_GENERAL}{&OPTION_THREAD_MAX} = 3;
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -638,7 +639,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &OP_BACKUP}{&OPTION_THREAD_MAX} = 2;
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -652,7 +653,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_GENERAL}{&OPTION_THREAD_MAX} = 5;
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -665,7 +666,7 @@ sub BackRestTestConfig_Test
if (BackRestTestCommon_Run(++$iRun, 'default - option ' . OPTION_THREAD_MAX))
{
$oConfig = {};
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -679,7 +680,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_GENERAL}{&OPTION_THREAD_MAX} = 9;
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -694,7 +695,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &OP_BACKUP}{&OPTION_HARDLINK} = 'Y';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -707,7 +708,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_LOG}{&OPTION_LOG_LEVEL_CONSOLE} = BOGUS;
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -720,7 +721,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_LOG}{&OPTION_LOG_LEVEL_CONSOLE} = lc(INFO);
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_CONFIG, $strConfigFile);
@@ -740,7 +741,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_EXPIRE}{&OPTION_RETENTION_FULL} = 2;
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_CONFIG, $strConfigFile);
@@ -753,7 +754,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_BACKUP}{&OPTION_COMPRESS} = 'n';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -766,21 +767,21 @@ sub BackRestTestConfig_Test
if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' option ' . OPTION_RESTORE_RECOVERY_SETTING))
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_RESTORE_RECOVERY_SETTING}{'archive-command'} = '/path/to/pg_backrest.pl';
ini_save($strConfigFile, $oConfig);
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_RESTORE_RECOVERY_SETTING}{'archive-command'} = '/path/to/pg_backrest';
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_CONFIG, $strConfigFile);
configLoadExpect($oOption, OP_RESTORE);
optionTestExpect(OPTION_RESTORE_RECOVERY_SETTING, '/path/to/pg_backrest.pl', 'archive-command');
optionTestExpect(OPTION_RESTORE_RECOVERY_SETTING, '/path/to/pg_backrest', 'archive-command');
}
if (BackRestTestCommon_Run(++$iRun, OP_RESTORE . ' option ' . OPTION_RESTORE_RECOVERY_SETTING))
{
$oConfig = {};
$$oConfig{$strStanza . ':' . &CONFIG_SECTION_RESTORE_RECOVERY_SETTING}{'standby-mode'} = 'on';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_CONFIG, $strConfigFile);
@@ -792,7 +793,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{$strStanza}{&OPTION_DB_PATH} = '/path/to/db';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_CONFIG, $strConfigFile);
@@ -805,7 +806,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{$strStanza}{&OPTION_DB_PATH} = '/path/to/db';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_CONFIG, $strConfigFile);
@@ -818,7 +819,7 @@ sub BackRestTestConfig_Test
{
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_GENERAL}{&OPTION_REPO_PATH} = '/repo';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');
@@ -833,7 +834,7 @@ sub BackRestTestConfig_Test
$oConfig = {};
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_COMMAND}{&OPTION_COMMAND_PSQL} = '/psql -X %option%';
$$oConfig{&CONFIG_GLOBAL . ':' . &CONFIG_SECTION_COMMAND}{&OPTION_COMMAND_PSQL_OPTION} = '--port=5432';
ini_save($strConfigFile, $oConfig);
iniSave($strConfigFile, $oConfig, true);
optionSetTest($oOption, OPTION_STANZA, $strStanza);
optionSetTest($oOption, OPTION_DB_PATH, '/db');