londiste.handlers.dispatch: fixed "ignore events aiming at obsolete partitions" bug
authormartinko <gamato@users.sf.net>
Tue, 3 Dec 2013 14:46:09 +0000 (15:46 +0100)
committermartinko <gamato@users.sf.net>
Tue, 3 Dec 2013 14:46:09 +0000 (15:46 +0100)
but really :-)

python/londiste/handlers/dispatch.py
python/londiste/setup.py

index 7590ee73952707b6eac9cb043f048111e16d0251..2a39475a551ff4d22e3f47dd456c527ae8fe2b64 100644 (file)
@@ -910,11 +910,12 @@ class Dispatcher (ShardHandler):
         self.log.info("Created table: %s", dst)
 
         if self.conf.retention_period:
-            self.drop_obsolete_partitions (self.dest_table, self.conf.retention_period, self.conf.period)
-            if self.conf.ignore_old_events and not skytools.exists_table(curs, dst):
-                self.ignored_tables.add(dst) # must have been just dropped
-                if dst in self.row_handler.table_map:
-                    del self.row_handler.table_map[dst]
+            dropped = self.drop_obsolete_partitions (self.dest_table, self.conf.retention_period, self.conf.period)
+            if self.conf.ignore_old_events and dropped:
+                for tbl in dropped:
+                    self.ignored_tables.add(tbl)
+                    if tbl in self.row_handler.table_map:
+                        del self.row_handler.table_map[tbl]
 
     def drop_obsolete_partitions (self, parent_table, retention_period, partition_period):
         """ Drop obsolete partitions of partition-by-date parent table.
@@ -930,6 +931,7 @@ class Dispatcher (ShardHandler):
             res.append(row[0])
         if res:
             self.log.info("Dropped tables: %s", ", ".join(res))
+        return res
 
     def get_copy_condition(self, src_curs, dst_curs):
         """ Prepare where condition for copy and replay filtering.
index 1ce79598b4a86730f32e9e1c313bb544a1171ca4..055be9221f5caff9b778f3006c8e67105ca6281a 100644 (file)
@@ -45,7 +45,7 @@ class LondisteSetup(CascadeAdmin):
         londiste.handler.load_handler_modules(self.cf)
 
     def init_optparse(self, parser=None):
-        """Add londiste switches to cascadeadmin ones."""
+        """Add londiste switches to CascadeAdmin ones."""
 
         p = CascadeAdmin.init_optparse(self, parser)
         p.add_option("--expect-sync", action="store_true", dest="expect_sync",