Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADBDEV-4338: Fix gprestore with --resize-cluster to a smaller one #40

Closed
wants to merge 6 commits into from

Conversation

RekGRpth
Copy link
Member

@RekGRpth RekGRpth commented Sep 25, 2023

Fix gprestore with --resize-cluster to a smaller one

When restoring a large cluster to a smaller one with the --resize-cluster
option, the error "Found incorrect number of backup files" occurs.
This error occurs when checking a backup, when the pgrestore expects
an increased set of data in the backup directories for certain segments,
but in fact this is not the case. Moreover, if you disable the checking,
another error will appear indicating that not all expected data was restored.

This patch fixes both of these bugs.
To correct the first error, the patch collects actual data not only from
the directory for one segment, but also from the remaining directories
that will be restored on this segment.
To correct the second error, the patch changes the path to the file
being restored, replacing not only the file name,
but also the directory name. This can be done because the path always
contains the sequence "...SegmentNumber/backups/..."

Tests for restoring with the --resize-cluster option to a smaller cluster
contained the moveSegmentBackupFiles function, which moved the backup data
to the required directories. Now you don't need to do this anymore.

When restoring a large cluster to a smaller one with the --resize-cluster
option, the error "Found incorrect number of backup files" occurs.
This error occurs when checking a backup, when the pgrestore expects
an increased set of data in the backup directories for certain segments,
but in fact this is not the case. Moreover, if you disable the checking,
another error will appear indicating that not all expected data was restored.

This patch fixes both of these bugs.
To correct the first error, the patch collects actual data not only from
the directory for one segment, but also from the remaining directories
that will be restored on this segment.
To correct the second error, the patch changes the path to the file
being restored, replacing not only the file name,
but also the directory name. This can be done because the path always
contains the sequence "...SegmentNumber/backups/..."

Tests for restoring with the --resize-cluster option to a smaller cluster
contained the moveSegmentBackupFiles function, which moved the backup data
to the required directories. Now you don't need to do this anymore.
dnskvlnk
dnskvlnk previously approved these changes Nov 14, 2023
restore/remote.go Outdated Show resolved Hide resolved
restore/remote.go Outdated Show resolved Hide resolved
restore/remote.go Outdated Show resolved Hide resolved
restore/remote.go Outdated Show resolved Hide resolved
@RekGRpth
Copy link
Member Author

RekGRpth commented Dec 6, 2023

Upstream solved the problem in another way https://github.com/greenplum-db/gpbackup/pull/739

@RekGRpth RekGRpth closed this Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants