diff options
author | Marko Kreen | 2012-11-28 18:16:30 +0000 |
---|---|---|
committer | Marko Kreen | 2012-11-28 18:16:30 +0000 |
commit | ff4ca429552266422ee808e77dbf334997105362 (patch) | |
tree | 312ce779b6c2ec3c614df763a19bcc9f49a5189b | |
parent | c3ed7ef3e7999113c3f85d0d0884516a518598d9 (diff) | |
parent | 6eda59aaf560bb3c76d5eb4bb63674e6c508a296 (diff) |
Merge remote-tracking branch 'martino/master'
Conflicts:
python/londiste/syncer.py
-rw-r--r-- | doc/howto/londiste3_cascaded_rep_howto.txt | 18 | ||||
-rw-r--r-- | python/londiste/syncer.py | 13 |
2 files changed, 18 insertions, 13 deletions
diff --git a/doc/howto/londiste3_cascaded_rep_howto.txt b/doc/howto/londiste3_cascaded_rep_howto.txt index baed95e6..c5fe2e8a 100644 --- a/doc/howto/londiste3_cascaded_rep_howto.txt +++ b/doc/howto/londiste3_cascaded_rep_howto.txt @@ -86,11 +86,11 @@ Now let's play with data. Create table on root node and fill couple of rows ---- -$ psql -d db1 -c create table mytable (id serial primary key, data text) -$ psql -d db1 -c insert into mytable (data) values ('row1') -$ psql -d db1 -c insert into mytable (data) values ('row2') -$ psql -d db1 -c insert into mytable (data) values ('row3') -$ psql -d db1 -c insert into mytable (data) values ('row4') +$ psql -d db1 -c "create table mytable (id serial primary key, data text)" +$ psql -d db1 -c "insert into mytable (data) values ('row1')" +$ psql -d db1 -c "insert into mytable (data) values ('row2')" +$ psql -d db1 -c "insert into mytable (data) values ('row3')" +$ psql -d db1 -c "insert into mytable (data) values ('row4')" ---- Creat some load on table @@ -111,19 +111,19 @@ Register table on other node with creation ---- $ psql -d db2 -c create sequence mytable_id_seq CREATE SEQUENCE -$ londiste3 -q conf/londiste_db1.ini add-seq mytable_id_seq +$ londiste3 -q conf/londiste_db2.ini add-seq mytable_id_seq $ londiste3 -q conf/londiste_db2.ini add-table mytable --create-full $ psql -d db3 -c create sequence mytable_id_seq CREATE SEQUENCE -$ londiste3 -q conf/londiste_db1.ini add-seq mytable_id_seq +$ londiste3 -q conf/londiste_db3.ini add-seq mytable_id_seq $ londiste3 -q conf/londiste_db3.ini add-table mytable --create-full $ psql -d db4 -c create sequence mytable_id_seq CREATE SEQUENCE -$ londiste3 -q conf/londiste_db1.ini add-seq mytable_id_seq +$ londiste3 -q conf/londiste_db4.ini add-seq mytable_id_seq $ londiste3 -q conf/londiste_db4.ini add-table mytable --create-full $ psql -d db5 -c create sequence mytable_id_seq CREATE SEQUENCE -$ londiste3 -q conf/londiste_db1.ini add-seq mytable_id_seq +$ londiste3 -q conf/londiste_db5.ini add-seq mytable_id_seq $ londiste3 -q conf/londiste_db5.ini add-table mytable --create-full ---- diff --git a/python/londiste/syncer.py b/python/londiste/syncer.py index ccc0cdff..80dbbf9c 100644 --- a/python/londiste/syncer.py +++ b/python/londiste/syncer.py @@ -72,6 +72,7 @@ class Syncer(skytools.DBScript): setup_curs = setup_db.cursor() dst_curs = dst_db.cursor() + c = 0 while 1: q = "select * from pgq_node.get_consumer_state(%s, %s)" res = self.exec_cmd(dst_db, q, [self.queue_name, self.consumer_name]) @@ -99,9 +100,13 @@ class Syncer(skytools.DBScript): if consumer_lag < ticker_lag + 5: break - self.log.warning('Consumer lag: %s, ticker_lag %s, too big difference, waiting', - consumer_lag, ticker_lag) - self.sleep(10) + lag_msg = 'Consumer lag: %s, ticker_lag %s, too big difference, waiting' + if c % 30 == 0: + self.log.warning(lag_msg, consumer_lag, ticker_lag) + else: + self.log.debug(lag_msg, consumer_lag, ticker_lag) + c += 1 + time.sleep(1) def get_tables(self, db): """Load table info. @@ -361,5 +366,5 @@ class Syncer(skytools.DBScript): res = self.exec_cmd(curs, q, [self.queue_name, cons_name]) if res[0]['uptodate']: break - self.sleep(0.5) + time.sleep(0.5) |