Steve Singer,,, ssinger at lists.slony.info
Wed Jul 7 07:45:29 PDT 2010
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv24602/src/slon

Modified Files:
	remote_worker.c 
Log Message:
release sl_config_lock before sleeping
    
See bug # 135, slon appeared to be waiting to get a sl_config_lock
that the same slon process was already holding.
slon kept sleeping waiting for a sync to catch up.
Not holding the lock when we sleep should allow
other threads to obtain the lock.

Merged from 2.0

Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -C 2 -d -r1.187 -r1.188
*** remote_worker.c	1 Jun 2010 15:15:33 -0000	1.187
--- remote_worker.c	7 Jul 2010 14:45:27 -0000	1.188
***************
*** 1096,1099 ****
--- 1096,1100 ----
  					query_append_event(&query1, event);
  					slon_appendquery(&query1, "commit transaction;");
+ 
  					query_execute(node, local_dbconn, &query1);
  					slon_log(SLON_DEBUG1, "ACCEPT_SET - done\n");
***************
*** 1235,1238 ****
--- 1236,1247 ----
  										 node->no_id, sub_provider,
  										 prov_seqno);
+ 
+ 								/**
+ 								 * Release the sl_config_lock
+ 								 * we want other threads to be
+ 								 * able to continue during the sleep.
+ 								 */
+ 								if (query_execute(node, local_dbconn, &query2) < 0)
+ 									slon_retry();
  								sched_rc = sched_msleep(node, 5000);
  								if (sched_rc != SCHED_STATUS_OK)
***************
*** 1241,1244 ****
--- 1250,1266 ----
  									break;
  								}
+ 								/**
+ 								 * Obtain the config lock again.
+ 								 * it was released above.
+ 								 */
+ 								slon_mkquery(&query1, "start transaction;"
+ 											 "set transaction isolation level serializable;");
+ 								slon_appendquery(&query1,
+ 												 "lock table %s.sl_config_lock; ",
+ 												 rtcfg_namespace);
+ 
+ 								if (query_execute(node, local_dbconn, &query1) < 0)
+ 									slon_retry();
+ 
  								continue;
  							}



More information about the Slony1-commit mailing list