2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-15 20:27:50 +00:00

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.
This commit is contained in:
Jarrod Johnson 2018-10-10 15:24:55 -04:00
parent 6b70a4322a
commit 2d0199a4e9

View File

@ -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()