Chris Browne cbbrowne at lists.slony.info
Wed Feb 6 12:51:58 PST 2008
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv5306/src/slon

Modified Files:
	remote_worker.c 
Log Message:
Suppress NOTIFY _%s_Event for subsequent SYNCs in a SYNC group


Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -C2 -d -r1.164 -r1.165
*** remote_worker.c	6 Feb 2008 20:20:50 -0000	1.164
--- remote_worker.c	6 Feb 2008 20:51:56 -0000	1.165
***************
*** 242,246 ****
  			  SlonDString * dsp);
  static void query_append_event(SlonDString * dsp,
! 				   SlonWorkMsg_event * event);
  static void store_confirm_forward(SlonNode * node, SlonConn * conn,
  					  SlonWorkMsg_confirm * confirm);
--- 242,246 ----
  			  SlonDString * dsp);
  static void query_append_event(SlonDString * dsp,
! 			       SlonWorkMsg_event * event, bool suppress_notify);
  static void store_confirm_forward(SlonNode * node, SlonConn * conn,
  					  SlonWorkMsg_confirm * confirm);
***************
*** 290,294 ****
  	bool			event_ok;
  	bool			need_reloadListen = false;
! 
  	slon_log(SLON_INFO,
  			 "remoteWorkerThread_%d: thread starts\n",
--- 290,294 ----
  	bool			event_ok;
  	bool			need_reloadListen = false;
! 	bool suppress_notify;
  	slon_log(SLON_INFO,
  			 "remoteWorkerThread_%d: thread starts\n",
***************
*** 658,667 ****
  			dstring_reset(&query1);
  			last_sync_group_size = 0;
  			for (i = 0; i < sync_group_size; i++)
  			{
! 				query_append_event(&query1, sync_group[i]);
  				if (i < (sync_group_size - 1))
  					free(sync_group[i]);
  				last_sync_group_size++;
  			}
  			slon_appendquery(&query1, "commit transaction;");
--- 658,669 ----
  			dstring_reset(&query1);
  			last_sync_group_size = 0;
+ 			suppress_notify = FALSE;
  			for (i = 0; i < sync_group_size; i++)
  			{
! 				query_append_event(&query1, sync_group[i], suppress_notify);
  				if (i < (sync_group_size - 1))
  					free(sync_group[i]);
  				last_sync_group_size++;
+ 				suppress_notify = TRUE;
  			}
  			slon_appendquery(&query1, "commit transaction;");
***************
*** 1035,1039 ****
  									 "notify \"_%s_Restart\"; ",
  									 rtcfg_cluster_name);
! 					query_append_event(&query1, event);
  					slon_appendquery(&query1, "commit transaction;");
  					query_execute(node, local_dbconn, &query1);
--- 1037,1041 ----
  									 "notify \"_%s_Restart\"; ",
  									 rtcfg_cluster_name);
! 					query_append_event(&query1, event, FALSE);
  					slon_appendquery(&query1, "commit transaction;");
  					query_execute(node, local_dbconn, &query1);
***************
*** 1401,1405 ****
  			if (event_ok)
  			{
! 				query_append_event(&query1, event);
  				slon_appendquery(&query1, "commit transaction;");
  				if (archive_close(node) < 0)
--- 1403,1407 ----
  			if (event_ok)
  			{
! 				query_append_event(&query1, event, FALSE);
  				slon_appendquery(&query1, "commit transaction;");
  				if (archive_close(node) < 0)
***************
*** 2121,2139 ****
   * Add queries to a dstring that notify for Event and Confirm and that insert a
   * duplicate of an event record as well as the confirmation for it.
   * ----------
   */
  static void
! query_append_event(SlonDString * dsp, SlonWorkMsg_event * event)
  {
  	char		seqbuf[64];
  
  	sprintf(seqbuf, INT64_FORMAT, event->ev_seqno);
! 
  	slon_appendquery(dsp,
- 			 "notify \"_%s_Event\"; "
  			 "insert into %s.sl_event "
  			 "    (ev_origin, ev_seqno, ev_timestamp, "
  			 "     ev_snapshot, ev_type ",
- 			 rtcfg_cluster_name,
  			 rtcfg_namespace);
  	if (event->ev_data1 != NULL)
--- 2123,2145 ----
   * Add queries to a dstring that notify for Event and Confirm and that insert a
   * duplicate of an event record as well as the confirmation for it.
+  * "suppress_notify" parm permits omitting the notify request if running this many times
   * ----------
   */
  static void
! query_append_event(SlonDString * dsp, SlonWorkMsg_event * event, bool suppress_notify)
  {
  	char		seqbuf[64];
  
  	sprintf(seqbuf, INT64_FORMAT, event->ev_seqno);
! 	if (!suppress_notify) {
! 		slon_appendquery(dsp,
! 				 "notify \"_%s_Event\"; ",
! 				 rtcfg_cluster_name);
! 		
! 	}
  	slon_appendquery(dsp,
  			 "insert into %s.sl_event "
  			 "    (ev_origin, ev_seqno, ev_timestamp, "
  			 "     ev_snapshot, ev_type ",
  			 rtcfg_namespace);
  	if (event->ev_data1 != NULL)



More information about the Slony1-commit mailing list