Wed Mar 14 08:59:34 PDT 2007
- Previous message: [Slony1-commit] slony1-engine/src/backend slony1_funcs.sql
- Next message: [Slony1-commit] slony1-engine config.h.in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv8627/src/slon
Modified Files:
sync_thread.c
Log Message:
Reduce the quantity of spurious events generated:
1. generate_sync_event() only needs to generate a SYNC on a node
that is the origin for a set
2. sync thread generates a SYNC when it starts; in later iterations,
it will only generate a SYNC for its node if that node is the origin
for a replication set
Per discussions with Jan Wieck on 2007-02-09; this seemed an experiment
worth trying. I tried it, and the tests run fine, so I'm committing this.
Index: sync_thread.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/sync_thread.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** sync_thread.c 27 Oct 2006 20:10:57 -0000 1.18
--- sync_thread.c 14 Mar 2007 15:59:32 -0000 1.19
***************
*** 47,53 ****
--- 47,55 ----
SlonDString query1;
SlonDString query2;
+ SlonDString query3;
PGconn *dbconn;
PGresult *res;
int timeout_count;
+ bool first_time = TRUE;
slon_log(SLON_DEBUG1,
***************
*** 84,89 ****
dstring_init(&query2);
slon_mkquery(&query2,
! "select %s.createEvent('_%s', 'SYNC', NULL);",
! rtcfg_namespace, rtcfg_cluster_name);
timeout_count = (sync_interval_timeout == 0) ? 0 :
--- 86,99 ----
dstring_init(&query2);
slon_mkquery(&query2,
! "select %s.createEvent('_%s', 'SYNC', NULL)"
! " from %s.sl_node where no_id = %s.getLocalNodeId('_%s') "
! " and exists (select 1 from %s.sl_set where set_origin= no_id);",
! rtcfg_namespace, rtcfg_cluster_name,
! rtcfg_namespace, rtcfg_namespace, rtcfg_cluster_name, rtcfg_namespace);
!
! dstring_init(&query3);
! slon_mkquery(&query3,
! "select %s.createEvent('_%s', 'SYNC', NULL);",
! rtcfg_namespace, rtcfg_cluster_name);
timeout_count = (sync_interval_timeout == 0) ? 0 :
***************
*** 123,140 ****
PQclear(res);
! res = PQexec(dbconn, dstring_data(&query2));
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
slon_log(SLON_FATAL,
"syncThread: \"%s\" - %s",
! dstring_data(&query2), PQresultErrorMessage(res));
PQclear(res);
slon_retry();
break;
}
! slon_log(SLON_DEBUG2,
"syncThread: new sl_action_seq %s - SYNC %s\n",
last_actseq_buf, PQgetvalue(res, 0, 0));
PQclear(res);
/*
--- 133,153 ----
PQclear(res);
! res = PQexec(dbconn, dstring_data(first_time? &query3:&query2));
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
slon_log(SLON_FATAL,
"syncThread: \"%s\" - %s",
! dstring_data(first_time?&query3:&query2), PQresultErrorMessage(res));
PQclear(res);
slon_retry();
break;
}
! if (first_time) {
! slon_log(SLON_DEBUG2,
"syncThread: new sl_action_seq %s - SYNC %s\n",
last_actseq_buf, PQgetvalue(res, 0, 0));
+ }
PQclear(res);
+ first_time = FALSE;
/*
***************
*** 179,182 ****
--- 192,196 ----
dstring_free(&query1);
dstring_free(&query2);
+ dstring_free(&query3);
slon_disconnectdb(conn);
- Previous message: [Slony1-commit] slony1-engine/src/backend slony1_funcs.sql
- Next message: [Slony1-commit] slony1-engine config.h.in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list