diff options
| author | Marko Kreen | 2008-04-16 09:55:41 +0000 |
|---|---|---|
| committer | Marko Kreen | 2008-04-16 09:55:41 +0000 |
| commit | 2e10c0cdeba86ade288e9fc4a0eaf8b0141f898e (patch) | |
| tree | e2b443348eb762cbf76a5af3f84366c35d0c6928 /python | |
| parent | 8277ba5546ced7a745d47ffc310964b761a98144 (diff) | |
fix more bugs - stats, trigger type
Diffstat (limited to 'python')
| -rw-r--r-- | python/londiste/playback.py | 5 | ||||
| -rw-r--r-- | python/pgq/consumer.py | 4 | ||||
| -rw-r--r-- | python/pgq/maint.py | 2 | ||||
| -rw-r--r-- | python/pgq/setconsumer.py | 2 | ||||
| -rw-r--r-- | python/pgq/ticker.py | 2 | ||||
| -rw-r--r-- | python/skytools/scripting.py | 3 | ||||
| -rwxr-xr-x | python/walmgr.py | 6 |
7 files changed, 12 insertions, 12 deletions
diff --git a/python/londiste/playback.py b/python/londiste/playback.py index 67b40951..fdf90c2d 100644 --- a/python/londiste/playback.py +++ b/python/londiste/playback.py @@ -291,6 +291,9 @@ class Replicator(pgq.SetConsumer): self.handle_seqs(dst_curs) + q = "select pgq.set_connection_context(%s)" + dst_curs.execute(q, [self.set_name]) + self.sql_list = [] pgq.SetConsumer.process_set_batch(self, src_db, dst_db, ev_list) self.flush_sql(dst_curs) @@ -453,7 +456,7 @@ class Replicator(pgq.SetConsumer): if len(self.sql_list) > 200: self.flush_sql(dst_curs) else: - self.stat_inc('ignored_events') + self.stat_increase('ignored_events') ev.tag_done() def flush_sql(self, dst_curs): diff --git a/python/pgq/consumer.py b/python/pgq/consumer.py index c44ba236..af02e4fd 100644 --- a/python/pgq/consumer.py +++ b/python/pgq/consumer.py @@ -295,8 +295,8 @@ class Consumer(skytools.DBScript): def stat_end(self, count): t = time.time() - self.stat_add('count', count) - self.stat_add('duration', t - self.stat_batch_start) + self.stat_put('count', count) + self.stat_put('duration', t - self.stat_batch_start) class RemoteConsumer(Consumer): diff --git a/python/pgq/maint.py b/python/pgq/maint.py index c6486f49..396f9c0a 100644 --- a/python/pgq/maint.py +++ b/python/pgq/maint.py @@ -59,7 +59,7 @@ class MaintenanceJob(skytools.DBScript): self.last_time = t duration = time.time() - t - self.stat_add('maint_duration', duration) + self.stat_put('maint_duration', duration) def do_maintenance(self): """Helper function for running maintenance.""" diff --git a/python/pgq/setconsumer.py b/python/pgq/setconsumer.py index 3b87cbfd..76b8dbe6 100644 --- a/python/pgq/setconsumer.py +++ b/python/pgq/setconsumer.py @@ -183,7 +183,7 @@ class SetConsumer(skytools.DBScript): self.process_set_event(dst_curs, ev) if self.dst_queue: self.dst_queue.bulk_insert(dst_curs, ev) - self.stat_add('count', len(ev_list)) + self.stat_increase('count', len(ev_list)) def process_set_event(self, dst_curs, ev): if ev.type == 'set-tick': diff --git a/python/pgq/ticker.py b/python/pgq/ticker.py index bff59214..327864d5 100644 --- a/python/pgq/ticker.py +++ b/python/pgq/ticker.py @@ -170,6 +170,6 @@ class SmartTicker(skytools.DBScript): if cur_time > self.ticker_log_time + self.ticker_log_delay: self.ticker_log_time = cur_time - self.stat_add('ticks', self.tick_count) + self.stat_increase('ticks', self.tick_count) self.tick_count = 0 diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index 3a3556a2..8c1639c1 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -371,9 +371,6 @@ class DBScript(object): "Internal SIGINT handler. Minimal code here." self.stop() - def stat_add(self, key, value): - self.stat_put(key, value) - def stat_put(self, key, value): """Sets a stat value.""" self.stat_dict[key] = value diff --git a/python/walmgr.py b/python/walmgr.py index 63c1bf26..ea384705 100755 --- a/python/walmgr.py +++ b/python/walmgr.py @@ -645,8 +645,8 @@ class WalMgr(skytools.DBScript): self.log.debug("%s: done", srcname) end_time = time.time() - self.stat_add('count', 1) - self.stat_add('duration', end_time - start_time) + self.stat_put('count', 1) + self.stat_put('duration', end_time - start_time) self.send_stats() def slave_append_partial(self): @@ -942,7 +942,7 @@ class WalMgr(skytools.DBScript): open(prgrfile, "w").write("1") # it would be nice to have apply time too - self.stat_add('count', 1) + self.stat_put('count', 1) self.send_stats() def restore_database(self): |
