londiste.playback: move plugin-only dest_table to table_info
authorMarko Kreen <markokr@gmail.com>
Fri, 4 Nov 2011 11:50:19 +0000 (13:50 +0200)
committerMarko Kreen <markokr@gmail.com>
Fri, 4 Nov 2011 11:50:19 +0000 (13:50 +0200)
its pain to do in sql, so lets do it in python

python/londiste/playback.py

index e9c20ea8c13ca68639c94c081337686c3d8ccae4..03a456657567723762aa9153b78112eb9203f0aa 100644 (file)
@@ -767,6 +767,14 @@ class Replicator(CascadedWorker):
         """Store changed table state in database."""
 
         for t in self.table_list:
+            # backwards compat: move plugin-only dest_table to table_info
+            if t.dest_table != t.plugin.dest_table:
+                self.log.info("Overwriting .dest_table from plugin: tbl=%s  dst=%s",
+                              t.name, t.plugin.dest_table)
+                q = "update londiste.table_info set dest_table = %s"\
+                    " where queue_name = %s and table_name = %s"
+                curs.execute(q, [t.plugin.dest_table, self.set_name, t.name])
+
             if not t.changed:
                 continue
             merge_state = t.render_state()