From 8f5e4e22660dba64b733acdaa9e4ed94731bdb72 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 24 Apr 2013 12:57:32 -0700 Subject: [PATCH] Database rebuilder fixes. --- python/cumulus/rebuild_database.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/python/cumulus/rebuild_database.py b/python/cumulus/rebuild_database.py index a1ba9e8..53481d5 100755 --- a/python/cumulus/rebuild_database.py +++ b/python/cumulus/rebuild_database.py @@ -201,7 +201,7 @@ class ChunkerExternal(Chunker): self.subproc.stdin.write(buf) self.subproc.stdin.flush() breaks = self.subproc.stdout.readline() - return [int(x) + 1 for x in breaks.split()] + return [0] + [int(x) + 1 for x in breaks.split()] class DatabaseRebuilder(object): @@ -209,10 +209,8 @@ class DatabaseRebuilder(object): self.database = database self.cursor = database.cursor() self.segment_ids = {} - #try: self.chunker = ChunkerExternal() - #except: - # self.chunker = Chunker() + #self.chunker = Chunker() def segment_to_id(self, segment): if segment in self.segment_ids: return self.segment_ids[segment] @@ -311,14 +309,13 @@ class DatabaseRebuilder(object): blockid = self.cursor.lastrowid # Store subblock signatures, if available. - print "blockid:", blockid - if (segment, object) in subblock_signatures: + sigs = subblock_signatures.get((segment, object)) + if sigs: self.cursor.execute( """insert or replace into subblock_signatures( blockid, algorithm, signatures) values (?, ?, ?)""", - (blockid, self.chunker.ALGORITHM_NAME, - buffer(subblock_signatures[(segment, object)]))) + (blockid, self.chunker.ALGORITHM_NAME, buffer(sigs))) if __name__ == "__main__": -- 2.20.1