From a3b424a4799851d02298e226e5a582fa1f4e8aad Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 25 Nov 2016 23:53:36 +0100 Subject: merge_fetch: Write to chainsdb in controlling process. Multiple writers won't work when using permdb. Also, improve throughput by polling worker processes with timeout 0 and read all messages at once. --- tools/mergetools.py | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'tools/mergetools.py') diff --git a/tools/mergetools.py b/tools/mergetools.py index d5d5f75..1334186 100644 --- a/tools/mergetools.py +++ b/tools/mergetools.py @@ -484,25 +484,6 @@ def flock_ex_or_fail(path): return False return True -def flock_ex_wait(path): - fd = os.open(path, os.O_CREAT) - logging.debug("waiting for exclusive lock on %s (%s)", fd, path) - fcntl.flock(fd, fcntl.LOCK_EX) - logging.debug("taken exclusive lock on %s", fd) - return fd - -def flock_sh_wait(path): - fd = os.open(path, os.O_CREAT) - logging.debug("waiting for shared lock on %s (%s)", fd, path) - fcntl.flock(fd, fcntl.LOCK_SH) - logging.debug("taken shared lock on %s", fd) - return fd - -def flock_release(fd): - logging.debug("releasing lock on %s", fd) - fcntl.flock(fd, fcntl.LOCK_UN) - os.close(fd) - def terminate_child_procs(): for p in multiprocessing.active_children(): #print >>sys.stderr, "DEBUG: terminating pid", p.pid @@ -522,12 +503,6 @@ class FileDB: return read_chain(self.path, key) def add(self, key, value): return write_chain(key, value, self.path) - def lock_sh(self): - self.lockfile = flock_sh_wait(self.path + "/.lock") - def lock_ex(self): - self.lockfile = flock_ex_wait(self.path + "/.lock") - def release_lock(self): - flock_release(self.lockfile) def commit(self): pass @@ -538,12 +513,6 @@ class PermDB: return permdb.getvalue(self.permdbobj, key) def add(self, key, value): return permdb.addvalue(self.permdbobj, key, value) - def lock_sh(self): - assert False # NYI - def lock_ex(self): - assert False # NYI - def release_lock(self): - assert False # NYI def commit(self): permdb.committree(self.permdbobj) -- cgit v1.1