summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kreen2011-12-23 12:27:27 +0000
committerMarko Kreen2011-12-23 12:27:27 +0000
commitcf00b0ce480c4efe6b4ad21e485fcd77aa382ea5 (patch)
tree081dbc2d509e08d9d9676cf31a5dfb1b301ed323
parent6f9ce39336603e13f8a898899be935ec2903da0f (diff)
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.
-rw-r--r--python/londiste/table_copy.py10
1 files 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)