swift-(account|container)-info: tolerate LockTimeouts

I'm not really clear on why a sqlite3.OperationalError should cause us to
retry with stale_reads_ok=True, but swift.common.exceptions.LockTimeout
*definitely* should.

Change-Id: I707dec1d11b8db80bc8fbee30662b319bf10d6a5
This commit is contained in:
Tim Burke 2018-04-10 17:04:56 -07:00
parent bbf5e5c7f3
commit 5b68eb5396
2 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import sys
from optparse import OptionParser
from swift.cli.info import print_info, InfoSystemExit
from swift.common.exceptions import LockTimeout
def run_print_info(args, opts):
@ -23,7 +24,7 @@ def run_print_info(args, opts):
print_info('account', *args, **opts)
except InfoSystemExit:
sys.exit(1)
except sqlite3.OperationalError as e:
except (sqlite3.OperationalError, LockTimeout) as e:
if not opts.get('stale_reads_ok'):
opts['stale_reads_ok'] = True
print('Warning: Possibly Stale Data')

View File

@ -16,6 +16,7 @@ import sys
from optparse import OptionParser
from swift.cli.info import print_info, InfoSystemExit
from swift.common.exceptions import LockTimeout
def run_print_info(args, opts):
@ -23,7 +24,7 @@ def run_print_info(args, opts):
print_info('container', *args, **opts)
except InfoSystemExit:
sys.exit(1)
except sqlite3.OperationalError as e:
except (sqlite3.OperationalError, LockTimeout) as e:
if not opts.get('stale_reads_ok'):
opts['stale_reads_ok'] = True
print('Warning: Possibly Stale Data')