Merge "Add an __str__ method to brokers"
This commit is contained in:
commit
7ccde73974
@ -118,10 +118,10 @@ class AccountAuditor(Daemon):
|
||||
broker.get_info()
|
||||
self.logger.increment('passes')
|
||||
self.account_passes += 1
|
||||
self.logger.debug(_('Audit passed for %s') % broker.db_file)
|
||||
self.logger.debug(_('Audit passed for %s') % broker)
|
||||
except (Exception, Timeout):
|
||||
self.logger.increment('failures')
|
||||
self.account_failures += 1
|
||||
self.logger.exception(_('ERROR Could not get account info %s'),
|
||||
(broker.db_file))
|
||||
path)
|
||||
self.logger.timing_since('timing', start_time)
|
||||
|
@ -187,6 +187,14 @@ class DatabaseBroker(object):
|
||||
self.container = container
|
||||
self._db_version = -1
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
Returns a string indentifying the entity under broker to a human.
|
||||
The baseline implementation returns a full pathname to a database.
|
||||
This is vital for useful diagnostics.
|
||||
"""
|
||||
return self.db_file
|
||||
|
||||
def initialize(self, put_timestamp=None):
|
||||
"""
|
||||
Create the DB
|
||||
|
@ -296,8 +296,8 @@ class Replicator(Daemon):
|
||||
if objects:
|
||||
self.logger.debug(_(
|
||||
'Synchronization for %s has fallen more than '
|
||||
'%s rows behind; moving on and will try again next pass.') %
|
||||
(broker.db_file, self.max_diffs * self.per_diff))
|
||||
'%s rows behind; moving on and will try again next pass.'),
|
||||
broker, self.max_diffs * self.per_diff)
|
||||
self.stats['diff_capped'] += 1
|
||||
self.logger.increment('diff_caps')
|
||||
else:
|
||||
@ -606,7 +606,7 @@ class ReplicatorRpc(object):
|
||||
info = broker.get_replication_info()
|
||||
except (Exception, Timeout) as e:
|
||||
if 'no such table' in str(e):
|
||||
self.logger.error(_("Quarantining DB %s") % broker.db_file)
|
||||
self.logger.error(_("Quarantining DB %s"), broker)
|
||||
quarantine_db(broker.db_file, broker.db_type)
|
||||
return HTTPNotFound()
|
||||
raise
|
||||
|
@ -118,10 +118,10 @@ class ContainerAuditor(Daemon):
|
||||
broker.get_info()
|
||||
self.logger.increment('passes')
|
||||
self.container_passes += 1
|
||||
self.logger.debug(_('Audit passed for %s'), broker.db_file)
|
||||
self.logger.debug(_('Audit passed for %s'), broker)
|
||||
except (Exception, Timeout):
|
||||
self.logger.increment('failures')
|
||||
self.container_failures += 1
|
||||
self.logger.exception(_('ERROR Could not get container info %s'),
|
||||
broker.db_file)
|
||||
path)
|
||||
self.logger.timing_since('timing', start_time)
|
||||
|
@ -245,7 +245,7 @@ class ContainerSync(Daemon):
|
||||
if err:
|
||||
self.logger.info(
|
||||
_('ERROR %(db_file)s: %(validate_sync_to_err)s'),
|
||||
{'db_file': broker.db_file,
|
||||
{'db_file': str(broker),
|
||||
'validate_sync_to_err': err})
|
||||
self.container_failures += 1
|
||||
self.logger.increment('failures')
|
||||
@ -299,7 +299,7 @@ class ContainerSync(Daemon):
|
||||
self.container_failures += 1
|
||||
self.logger.increment('failures')
|
||||
self.logger.exception(_('ERROR Syncing %s'),
|
||||
broker.db_file if broker else path)
|
||||
broker if broker else path)
|
||||
|
||||
def container_sync_row(self, row, sync_to, sync_key, broker, info):
|
||||
"""
|
||||
@ -397,14 +397,14 @@ class ContainerSync(Daemon):
|
||||
else:
|
||||
self.logger.exception(
|
||||
_('ERROR Syncing %(db_file)s %(row)s'),
|
||||
{'db_file': broker.db_file, 'row': row})
|
||||
{'db_file': str(broker), 'row': row})
|
||||
self.container_failures += 1
|
||||
self.logger.increment('failures')
|
||||
return False
|
||||
except (Exception, Timeout) as err:
|
||||
self.logger.exception(
|
||||
_('ERROR Syncing %(db_file)s %(row)s'),
|
||||
{'db_file': broker.db_file, 'row': row})
|
||||
{'db_file': str(broker), 'row': row})
|
||||
self.container_failures += 1
|
||||
self.logger.increment('failures')
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user