londiste.table_copy/merge: don't restart failed DDL restore
authorMarko Kreen <markokr@gmail.com>
Mon, 22 Aug 2011 14:45:23 +0000 (17:45 +0300)
committerMarko Kreen <markokr@gmail.com>
Mon, 22 Aug 2011 14:48:59 +0000 (17:48 +0300)
it will start truncate/copy again, which will be unnoticeable
to other partitions.

Proper fix would be to restart DDL-only, but currently
there is no way to detect the situation.

python/londiste/table_copy.py

index 447047e97b45b501842f8dd54a0cec6366baa064..7422b5333aeb8aaed5fbc324a538b6c089c20102 100644 (file)
@@ -161,12 +161,14 @@ class CopyTable(Replicator):
                 dst_db.commit()
 
             if tbl_stat.dropped_ddl is not None:
+                self.looping = 0
                 for ddl in skytools.parse_statements(tbl_stat.dropped_ddl):
                     self.log.info(ddl)
                     dst_curs.execute(ddl)
                 q = "select * from londiste.local_set_table_struct(%s, %s, NULL)"
                 self.exec_cmd(dst_curs, q, [self.queue_name, tbl_stat.name])
                 tbl_stat.dropped_ddl = None
+                self.looping = 1
             dst_db.commit()
 
         # set state