From 5b68eb5396edc33a64c6012a333c72d5a5878a64 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Tue, 10 Apr 2018 17:04:56 -0700 Subject: [PATCH] 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 --- bin/swift-account-info | 3 ++- bin/swift-container-info | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/swift-account-info b/bin/swift-account-info index 554f5e0095..e9ae188dca 100755 --- a/bin/swift-account-info +++ b/bin/swift-account-info @@ -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') diff --git a/bin/swift-container-info b/bin/swift-container-info index 136e489192..cbb10b6ec0 100755 --- a/bin/swift-container-info +++ b/bin/swift-container-info @@ -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')