From 2d0199a4e92d319c27ac32e96fd42e92cf317566 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 10 Oct 2018 15:24:55 -0400 Subject: [PATCH] Wrap bdb deletion in same lock that sync itself uses If os.remove happens at a bad time, it causes an unfortunate behavior in dbm. Serialize this sort of operation to avoid the bad behavior. --- confluent_server/confluent/config/configmanager.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 9275693f..b5fa19bb 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -646,12 +646,13 @@ def commit_clear(): global _oldcfgstore _oldcfgstore = None _oldtxcount = 0 - todelete = _config_areas + ('globals', 'collective', 'transactioncount') - for cfg in todelete: - try: - os.remove(os.path.join(ConfigManager._cfgdir, cfg)) - except OSError as oe: - pass + with _synclock: + todelete = _config_areas + ('globals', 'collective', 'transactioncount') + for cfg in todelete: + try: + os.remove(os.path.join(ConfigManager._cfgdir, cfg)) + except OSError as oe: + pass ConfigManager.wait_for_sync(True) ConfigManager._bg_sync_to_file()