Commit 12b1979f authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

use settings to determine case sensitivity in heartbeat

parent 29bc9904
......@@ -34,7 +34,7 @@ def heartbeat_event(settings, heartbeat, objname):
def set_log():
with heartbeat.lock() as hb:
registered_name = utils.reg_name(objname)
registered_name = utils.reg_name(settings, objname)
beat = hb.get(registered_name)
assert beat is not None
new_beat = {"ident": beat["ident"],
......
......@@ -105,6 +105,9 @@ class FileSyncer(object):
except common.DatabaseError:
pass
def reg_name(self, objname):
return utils.reg_name(self.settings, objname)
@transaction()
def _probe_files(self, archive, objnames, ident):
for objname in objnames:
......@@ -117,7 +120,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(utils.reg_name(objname))
beat = hb.get(self.reg_name(objname))
if beat is not None:
if utils.younger_than(
beat["tstamp"], self.settings.action_max_wait):
......@@ -206,7 +209,7 @@ class FileSyncer(object):
if states is not None:
with self.heartbeat.lock() as hb:
beat = {"ident": ident, "tstamp": utils.time_stamp()}
hb[utils.reg_name(objname)] = beat
hb[self.reg_name(objname)] = beat
return states
def _do_decide_file_sync(self, objname, master, slave, ident,
......@@ -223,7 +226,7 @@ class FileSyncer(object):
decision_serial = decision_state.serial
with self.heartbeat.lock() as hb:
beat = hb.get(utils.reg_name(objname))
beat = hb.get(self.reg_name(objname))
logger.debug("object: %s heartbeat: %s" % (objname, beat))
if beat is not None:
if beat["ident"] == ident:
......@@ -325,7 +328,7 @@ class FileSyncer(object):
serial = state.serial
objname = state.objname
with self.heartbeat.lock() as hb:
hb.pop(utils.reg_name(objname))
hb.pop(self.reg_name(objname))
if hard:
logger.warning(
"Marking failed serial %s for archive: %s, object: '%s'" %
......@@ -348,7 +351,7 @@ class FileSyncer(object):
objname = synced_source_state.objname
target = synced_target_state.archive
with self.heartbeat.lock() as hb:
hb.pop(utils.reg_name(objname))
hb.pop(self.reg_name(objname))
msg = messaging.AckSyncMessage(
archive=target, objname=objname, serial=serial,
logger=logger)
......
......@@ -103,8 +103,8 @@ def younger_than(tstamp, seconds):
return delta < datetime.timedelta(seconds=seconds)
def reg_name(objname):
if iswin():
def reg_name(settings, objname):
if settings.case_insensitive:
return objname.lower()
return objname
......
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