Commit 36e99eca authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

Make heartbeat case-insensitive in windows

parent 674f9616
......@@ -34,12 +34,13 @@ def heartbeat_event(settings, heartbeat, objname):
def set_log():
with heartbeat.lock() as hb:
beat = hb.get(objname)
registered_name = utils.reg_name(objname)
beat = hb.get(registered_name)
assert beat is not None
new_beat = {"ident": beat["ident"],
"tstamp": utils.time_stamp()}
hb[objname] = new_beat
logger.debug("HEARTBEAT '%s' %s" % (objname, new_beat))
hb[registered_name] = new_beat
logger.debug("HEARTBEAT '%s' %s" % (registered_name, new_beat))
def go():
interval = 0.2
......
......@@ -117,7 +117,7 @@ class FileSyncer(object):
db_state = db.get_state(archive, objname)
ref_state = db.get_state(self.SYNC, objname)
with self.heartbeat.lock() as hb:
beat = hb.get(objname)
beat = hb.get(utils.reg_name(objname))
if beat is not None:
if utils.younger_than(
beat["tstamp"], self.settings.action_max_wait):
......@@ -206,7 +206,7 @@ class FileSyncer(object):
if states is not None:
with self.heartbeat.lock() as hb:
beat = {"ident": ident, "tstamp": utils.time_stamp()}
hb[objname] = beat
hb[utils.reg_name(objname)] = beat
return states
def _do_decide_file_sync(self, objname, master, slave, ident,
......@@ -223,7 +223,7 @@ class FileSyncer(object):
decision_serial = decision_state.serial
with self.heartbeat.lock() as hb:
beat = hb.get(objname)
beat = hb.get(utils.reg_name(objname))
logger.debug("object: %s heartbeat: %s" % (objname, beat))
if beat is not None:
if beat["ident"] == ident:
......@@ -325,7 +325,7 @@ class FileSyncer(object):
serial = state.serial
objname = state.objname
with self.heartbeat.lock() as hb:
hb.pop(objname)
hb.pop(utils.reg_name(objname))
if hard:
logger.warning(
"Marking failed serial %s for archive: %s, object: '%s'" %
......@@ -348,7 +348,7 @@ class FileSyncer(object):
objname = synced_source_state.objname
target = synced_target_state.archive
with self.heartbeat.lock() as hb:
hb.pop(objname)
hb.pop(utils.reg_name(objname))
msg = messaging.AckSyncMessage(
archive=target, objname=objname, serial=serial,
logger=logger)
......
......@@ -99,6 +99,12 @@ def younger_than(tstamp, seconds):
return delta < datetime.timedelta(seconds=seconds)
def reg_name(objname):
if iswin():
return objname.lower()
return objname
BaseStoppableThread = watchdog.utils.BaseThread
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment