From cf00b0ce480c4efe6b4ad21e485fcd77aa382ea5 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Fri, 23 Dec 2011 14:27:27 +0200 Subject: [PATCH] londiste copy: fix after-copy wait Wait now on any non-NULL role. The string changed in .sql but code here was not updated. But new simpler rule is that role will be NULL it catchup can proceed. So follow that. Also dont do some potentially dangerous operations (lock, drop-fkey) on follow-up copies. --- python/londiste/table_copy.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/londiste/table_copy.py b/python/londiste/table_copy.py index ee035ef1..3c137ae6 100644 --- a/python/londiste/table_copy.py +++ b/python/londiste/table_copy.py @@ -105,11 +105,13 @@ class CopyTable(Replicator): # just in case, drop all fkeys (in case "replay" was skipped) # !! this may commit, so must be done before anything else !! - self.drop_fkeys(dst_db, tbl_stat.dest_table) + if cmode > 0: + self.drop_fkeys(dst_db, tbl_stat.dest_table) # now start ddl-dropping tx - q = "lock table " + skytools.quote_fqident(tbl_stat.dest_table) - dst_curs.execute(q) + if cmode > 0: + q = "lock table " + skytools.quote_fqident(tbl_stat.dest_table) + dst_curs.execute(q) # find dst struct src_struct = TableStruct(src_curs, src_real_table) @@ -179,7 +181,7 @@ class CopyTable(Replicator): dst_db.commit() # start waiting for other copy processes to finish - while tbl_stat.copy_role == 'lead': + while tbl_stat.copy_role: self.log.info('waiting for other partitions to finish copy') time.sleep(10) tbl_stat = self.reload_table_stat(dst_curs, tbl_stat.name) -- 2.39.5