-
Notifications
You must be signed in to change notification settings - Fork 193
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
barman-cloud-wal-restore Sometimes Unable to Restore Compressed Files #325
Comments
Upon further investigation, it is not sufficient to |
Any updates? |
We are currently looking at barman-cloud-backup, barman-cloud-restore/barman-cloud-wal-restore for backup solution and we interested in your progress |
I spent some time researching this issue but unfortunately didn't manage to resolve it in time for 2.13. What I did learn is summarized below.
The problem is actually in the python2 implementation of gzip which is why using an alternative to shutil.copyfileobj does not help.
If the WAL is archived with no compression then the wal-restore is successful. If the wal-restore happens with barman-cloud on python3 then it is also successful. Note: The issue also affects barman-cloud-wal-restore when using the |
Updates the barman-cloud-wal-archive man page and the argument help strings to warn people that compression options should not be used with older python versions (<3.2 for gzip, 3.3 for bzip2). See issue #325 for the full context.
Detects when barman-cloud-wal-restore is attempting to restore a compressed WAL on python 2.x and returns an error message telling the user to upgrade to a supported python 3.x. See issue #325
We have encountered an issue where restoring from an Amazon S3 location can result in this Boto3 error:
And this does to be the case. In the Boto3 code, the
StreamingBody
object does not provide atell
method. Even though it is a "file-like" object, passing this to a method that expects certain callable routines will result in an error. We apparently do this inbarman/cloud.py
:As the
StreamingBody
object only offers aread
method, the "correct" use would be to avoidshutil.copyfileobj
and write the file directly. I.e.:This appears to only happen when the base class or various superclasses (
gzip.GzipFile
) when streamed from S3 lack thetell
method, but this can happen with other methods as well, such asseek
. This may also be boto3 version dependent, as there's currently a bug discussion in issue 879 regarding addingIOBase
to add these missing methods. The issue is still open, but some pull requests have been accepted through its lifetime.Either we should require a certain Boto3 version, wrap the compressed IO classes to include
IOBase
ourselves or add the methodsshutil.copyfileobj
expects, or write files directly.I'll also note that in the same
barman/cloud.py
we create aStreamingBodyIO
class that extendsRawIOBase
, but this is not utilized for compressed streams.The text was updated successfully, but these errors were encountered: