londiste: cmd_execute() did not check ret_code of londiste.execute_start()
authorMarko Kreen <markokr@gmail.com>
Thu, 30 Apr 2009 09:06:11 +0000 (12:06 +0300)
committerMarko Kreen <markokr@gmail.com>
Thu, 30 Apr 2009 09:06:11 +0000 (12:06 +0300)
Also unify checking in both places - dont depend on exactly
'200' code from there.

python/londiste/playback.py
python/londiste/setup.py

index d6a6b668b8fcc5238b7d502649ba0f9e8565a470..5618da4acf357e17f145c34531bd211417befaf8 100644 (file)
@@ -528,7 +528,8 @@ class Replicator(CascadedWorker):
         q = "select * from londiste.execute_start(%s, %s, %s, false)"
         res = self.exec_cmd(dst_curs, q, [self.queue_name, fname, sql], commit = False)
         ret = res[0]['ret_code']
-        if ret != 200:
+        if ret >= 300:
+            self.log.warning("Skipping execution of '%s'", fname)
             return
         for stmt in skytools.parse_statements(sql):
             dst_curs.execute(stmt)
index efc14ea85c5159eb23dcba4dd02b8e9850071a4b..61f226fe1cee21685575abc081dbeda7003de6a4 100644 (file)
@@ -308,7 +308,11 @@ class LondisteSetup(CascadeAdmin):
             fname = os.path.basename(fn)
             sql = open(fn, "r").read()
             q = "select * from londiste.execute_start(%s, %s, %s, true)"
-            self.exec_cmd(db, q, [self.queue_name, fname, sql], commit = False)
+            res = self.exec_cmd(db, q, [self.queue_name, fname, sql], commit = False)
+            ret = res[0]['ret_code']
+            if ret >= 300:
+                self.log.warning("Skipping execution of '%s'" % fname)
+                continue
             for stmt in skytools.parse_statements(sql):
                 curs.execute(stmt)
             q = "select * from londiste.execute_finish(%s, %s)"