Remove logging on Swift backup obj writer

Since change I1f1d9c0d6e3f04f1ecd5ef7c5d813005ee116409 we are running
parts of the backups on native threads, which due to an eventlet bug [1]
have bad interactions with greenthreads, so we have to avoid any logging
when executing code in a native thread.

This patch removes the MD5 logging on the SwiftObjectWriter close
method and adds comments and docstring referring to this limitation.

[1] https://github.com/eventlet/eventlet/issues/432

Closes-Bug: #1745168
Change-Id: I0857cecd7d8ab0ee7e3e9bd6e15f4987ede4d653
(cherry picked from commit c6cb84bd63)
This commit is contained in:
Gorka Eguileor 2018-01-24 17:00:19 +01:00
parent 96d0e2755d
commit a1084c237a
2 changed files with 17 additions and 7 deletions

View File

@ -56,6 +56,11 @@ CONF = cfg.CONF
CONF.register_opts(chunkedbackup_service_opts)
# Object writer and reader returned by inheriting classes must not have any
# logging calls, as well as the compression libraries, as eventlet has a bug
# (https://github.com/eventlet/eventlet/issues/432) that would result in
# failures.
@six.add_metaclass(abc.ABCMeta)
class ChunkedBackupDriver(driver.BackupDriver):
"""Abstract chunked backup driver.
@ -122,14 +127,23 @@ class ChunkedBackupDriver(driver.BackupDriver):
def get_object_writer(self, container, object_name, extra_metadata=None):
"""Returns a writer object which stores the chunk data in backup repository.
The object returned should be a context handler that can be used
in a "with" context.
The object returned should be a context handler that can be used in a
"with" context.
The object writer methods must not have any logging calls, as eventlet
has a bug (https://github.com/eventlet/eventlet/issues/432) that would
result in failures.
"""
return
@abc.abstractmethod
def get_object_reader(self, container, object_name, extra_metadata=None):
"""Returns a reader object for the backed up chunk."""
"""Returns a reader object for the backed up chunk.
The object reader methods must not have any logging calls, as eventlet
has a bug (https://github.com/eventlet/eventlet/issues/432) that would
result in failures.
"""
return
@abc.abstractmethod

View File

@ -280,11 +280,7 @@ class SwiftBackupDriver(chunkeddriver.ChunkedBackupDriver):
content_length=len(self.data))
except socket.error as err:
raise exception.SwiftConnectionFailed(reason=err)
LOG.debug('swift MD5 for %(object_name)s: %(etag)s',
{'object_name': self.object_name, 'etag': etag, })
md5 = hashlib.md5(self.data).hexdigest()
LOG.debug('backup MD5 for %(object_name)s: %(md5)s',
{'object_name': self.object_name, 'md5': md5})
if etag != md5:
err = _('error writing object to swift, MD5 of object in '
'swift %(etag)s is not the same as MD5 of object sent '