Mon May 26 13:14:29 PDT 2008
- Previous message: [Slony1-commit] slony1-engine/src/slon remote_worker.c
- Next message: [Slony1-commit] slony1-engine RELEASE-2.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slon In directory main.slony.info:/tmp/cvs-serv8227 Modified Files: remote_listen.c Log Message: Establish a maximum number of events (sel_max_events) to be processed in an iteration in remote_listen.c's pull of events from a remote node. This means that if a node is way, way, way behind (e.g. - tens or hundreds of thousands of events behind), it won't try to get up to date in one swell foop. Index: remote_listen.c =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_listen.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** remote_listen.c 23 Apr 2008 22:29:12 -0000 1.43 --- remote_listen.c 26 May 2008 20:14:27 -0000 1.44 *************** *** 66,69 **** --- 66,71 ---- int remote_listen_timeout; + static int sel_max_events = 0; + /* ---------- * slon_remoteListenThread *************** *** 698,702 **** slon_appendquery(&query, ")"); } ! slon_appendquery(&query, " order by e.ev_origin, e.ev_seqno"); rtcfg_unlock(); --- 700,708 ---- slon_appendquery(&query, ")"); } ! /* Limit the result set size to: ! sync_group_maxsize * 2, if it's set ! 100, if sync_group_maxsize isn't set */ ! slon_appendquery(&query, " order by e.ev_origin, e.ev_seqno limit %d", ! (sync_group_maxsize>0)? sync_group_maxsize * 2 : 100); rtcfg_unlock(); *************** *** 755,758 **** --- 761,771 ---- */ ntuples = PQntuples(res); + + /* If we drew in the maximum number of events */ + if (ntuples == ((sync_group_maxsize>0)? sync_group_maxsize * 2 : 100)) + sel_max_events++; /* Add to the count... */ + else + sel_max_events=0; /* reset the count */ + for (tupno = 0; tupno < ntuples; tupno++) { *************** *** 786,808 **** if (ntuples > 0) { ! poll_sleep = 0; ! poll_state = SLON_POLLSTATE_POLL; } else { ! poll_sleep = poll_sleep * 2 + sync_interval; ! if (poll_sleep > sync_interval_timeout) { ! poll_sleep = sync_interval_timeout; ! poll_state = SLON_POLLSTATE_LISTEN; ! } } PQclear(res); ! return 0; } - - /* - * Local Variables: - * tab-width: 4 - * c-indent-level: 4 - * c-basic-offset: 4 - * End: - */ --- 799,822 ---- if (ntuples > 0) { ! if ((sel_max_events > 2) && (sync_group_maxsize > 100)) { ! poll_state = SLON_POLLSTATE_LISTEN; ! slon_log(SLON_INFO, "remoteListenThread_%d: drew maximum # of events for %d iterations\n", ! node->no_id, sel_max_events); ! slon_log(SLON_INFO, "remoteListenThread_%d: sleep %ds, return to LISTEN mode\n", ! node->no_id, 10+sel_max_events); ! sched_msleep(node, 10000 + (1000 * sel_max_events)); ! } else { ! poll_sleep = 0; ! poll_state = SLON_POLLSTATE_POLL; ! } } else { ! poll_sleep = poll_sleep * 2 + sync_interval; ! if (poll_sleep > sync_interval_timeout) { ! poll_sleep = sync_interval_timeout; ! poll_state = SLON_POLLSTATE_LISTEN; ! } } PQclear(res); ! last_event_sel = ntuples; return 0; }
- Previous message: [Slony1-commit] slony1-engine/src/slon remote_worker.c
- Next message: [Slony1-commit] slony1-engine RELEASE-2.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list