1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Fixed an issue that could cause copying large manifests to fail during restore.

Reported by Craig A. James.
This commit is contained in:
David Steele
2017-11-14 14:48:44 -05:00
parent cf7da546a3
commit 04e55fe71b
9 changed files with 57 additions and 13 deletions

View File

@@ -12,6 +12,16 @@
<release-list> <release-list>
<release date="XXXX-XX-XX" version="1.26dev" title="UNDER DEVELOPMENT"> <release date="XXXX-XX-XX" version="1.26dev" title="UNDER DEVELOPMENT">
<release-core-list> <release-core-list>
<release-bug-list>
<release-item>
<release-item-contributor-list>
<release-item-ideator id="james.craig"/>
</release-item-contributor-list>
<p>Fixed an issue that could cause copying large manifests to fail during restore.</p>
</release-item>
</release-bug-list>
<release-feature-list> <release-feature-list>
<release-item> <release-item>
<release-item-contributor-list> <release-item-contributor-list>
@@ -3566,6 +3576,11 @@
<contributor-id type="github">crunchyjohn</contributor-id> <contributor-id type="github">crunchyjohn</contributor-id>
</contributor> </contributor>
<contributor id="james.craig">
<contributor-name-display>Craig A. James</contributor-name-display>
<contributor-id type="github">cjames53</contributor-id>
</contributor>
<contributor id="kulkarni.nikhilchandra"> <contributor id="kulkarni.nikhilchandra">
<contributor-name-display>Nikhilchandra Kulkarni</contributor-name-display> <contributor-name-display>Nikhilchandra Kulkarni</contributor-name-display>
<contributor-id type="github">nikhilchandra-kulkarni</contributor-id> <contributor-id type="github">nikhilchandra-kulkarni</contributor-id>

View File

@@ -47,6 +47,9 @@ sub new
# Set read/write # Set read/write
$self->{bWrite} = false; $self->{bWrite} = false;
# Initialize EOF to false
$self->eofSet(false);
# Return from function and log return values if any # Return from function and log return values if any
return logDebugReturn return logDebugReturn
( (
@@ -55,6 +58,25 @@ sub new
); );
} }
####################################################################################################################################
# eof - have reads reached eof?
####################################################################################################################################
sub eof
{
return shift->{bEOF};
}
####################################################################################################################################
# eofSet - set eof
####################################################################################################################################
sub eofSet
{
my $self = shift;
my $bEOF = shift;
$self->{bEOF} = $bEOF;
}
#################################################################################################################################### ####################################################################################################################################
# read - read block from protocol # read - read block from protocol
#################################################################################################################################### ####################################################################################################################################
@@ -63,6 +85,9 @@ sub read
my $self = shift; my $self = shift;
my $rtBuffer = shift; my $rtBuffer = shift;
# After EOF always return 0
return 0 if $self->eof();
my $lBlockSize; my $lBlockSize;
# Read the block header and make sure it's valid # Read the block header and make sure it's valid
@@ -81,6 +106,10 @@ sub read
{ {
$self->{oProtocol}->io()->read($rtBuffer, $lBlockSize, true); $self->{oProtocol}->io()->read($rtBuffer, $lBlockSize, true);
} }
else
{
$self->eofSet(true);
}
# Return the block size # Return the block size
return $lBlockSize; return $lBlockSize;

View File

@@ -159,12 +159,12 @@ restore, type 'default', expect exit 40 - path not empty (db-master host)
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
restore, type 'default' (db-master host) restore, type 'default' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --db-include=test1 --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --db-include=test1 --buffer-size=16384 --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf + supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
---------------------------------------------------------------- ----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' restore_command = '[BACKREST-BIN] --buffer-size=16384 --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"'
restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host) restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore

View File

@@ -213,12 +213,12 @@ protocol-timeout=60
spool-path=[TEST_PATH]/db-standby/spool spool-path=[TEST_PATH]/db-standby/spool
restore, type 'default' (db-master host) restore, type 'default' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf + supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
---------------------------------------------------------------- ----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' restore_command = '[BACKREST-BIN] --buffer-size=16384 --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"'
restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host) restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore

View File

@@ -219,12 +219,12 @@ archive-copy=y
start-fast=y start-fast=y
restore, type 'default' (db-master host) restore, type 'default' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf + supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
---------------------------------------------------------------- ----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' restore_command = '[BACKREST-BIN] --buffer-size=16384 --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"'
restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host) restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore

View File

@@ -217,12 +217,12 @@ archive-copy=y
start-fast=y start-fast=y
restore, type 'default' (db-master host) restore, type 'default' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf + supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
---------------------------------------------------------------- ----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' restore_command = '[BACKREST-BIN] --buffer-size=16384 --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"'
restore delta, backup '[BACKUP-FULL-1]', type 'time', target '[TIMESTAMP-TARGET-1]' (db-master host) restore delta, backup '[BACKUP-FULL-1]', type 'time', target '[TIMESTAMP-TARGET-1]' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --set=[BACKUP-FULL-1] --type=time --target="[TIMESTAMP-TARGET-1]" --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --set=[BACKUP-FULL-1] --type=time --target="[TIMESTAMP-TARGET-1]" --link-all --stanza=db restore

View File

@@ -300,12 +300,12 @@ archive-copy=y
start-fast=y start-fast=y
restore, type 'default' (db-master host) restore, type 'default' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf + supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
---------------------------------------------------------------- ----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' restore_command = '[BACKREST-BIN] --buffer-size=16384 --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"'
restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host) restore, force, backup '[BACKUP-FULL-1]', type 'immediate' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --force --set=[BACKUP-FULL-1] --type=immediate --link-all --stanza=db restore

View File

@@ -223,12 +223,12 @@ archive-copy=y
start-fast=y start-fast=y
restore, type 'default' (db-master host) restore, type 'default' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --buffer-size=16384 --link-all --stanza=db restore
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
+ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf + supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf
---------------------------------------------------------------- ----------------------------------------------------------------
restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' restore_command = '[BACKREST-BIN] --buffer-size=16384 --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"'
restore delta, backup '[BACKUP-FULL-1]', type 'time', target '[TIMESTAMP-TARGET-1]' (db-master host) restore delta, backup '[BACKUP-FULL-1]', type 'time', target '[TIMESTAMP-TARGET-1]' (db-master host)
> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --set=[BACKUP-FULL-1] --type=time --target="[TIMESTAMP-TARGET-1]" --link-all --stanza=db restore > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --set=[BACKUP-FULL-1] --type=time --target="[TIMESTAMP-TARGET-1]" --link-all --stanza=db restore

View File

@@ -729,7 +729,7 @@ sub run
$oHostDbMaster->restore( $oHostDbMaster->restore(
cfgDefOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), undef, undef, $bDelta, $bForce, $strType, $strTarget, cfgDefOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), undef, undef, $bDelta, $bForce, $strType, $strTarget,
$bTargetExclusive, $strTargetAction, $strTargetTimeline, $oRecoveryHashRef, $strComment, $iExpectedExitStatus, $bTargetExclusive, $strTargetAction, $strTargetTimeline, $oRecoveryHashRef, $strComment, $iExpectedExitStatus,
$bTestLocal ? ' --db-include=test1' : undef); ($bTestLocal ? ' --db-include=test1' : '') . ' --buffer-size=16384');
$oHostDbMaster->clusterStart(); $oHostDbMaster->clusterStart();
$oHostDbMaster->sqlSelectOneTest('select message from test', $bTestLocal ? $strNameMessage : $strIncrMessage); $oHostDbMaster->sqlSelectOneTest('select message from test', $bTestLocal ? $strNameMessage : $strIncrMessage);