Chris Browne cbbrowne at lists.slony.info
Mon Oct 22 13:44:26 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv19826/src/slon

Modified Files:
      Tag: REL_1_2_STABLE
	remote_worker.c 
Log Message:
- Error handling for "ERROR: could not serialize access due to
  concurrent update"

If this error is encountered when starting processing of
sl_archive_counter, then two threads are fighting over access to this
counter, and at least one has just failed.

Rather than waiting, we ask to restart the node immediately.


Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.124.2.28
retrieving revision 1.124.2.29
diff -C2 -d -r1.124.2.28 -r1.124.2.29
*** remote_worker.c	19 Oct 2007 18:37:03 -0000	1.124.2.28
--- remote_worker.c	22 Oct 2007 20:44:24 -0000	1.124.2.29
***************
*** 5563,5571 ****
  	if ((rc = PQresultStatus(res)) != PGRES_TUPLES_OK)
  	{
! 		slon_log(SLON_ERROR,
! 				 "remoteWorkerThread_%d: \"%s\" %s %s\n",
  				 node->no_id, dstring_data(&query),
  				 PQresStatus(rc),
! 				 PQresultErrorMessage(res));
  		PQclear(res);
  		dstring_free(&query);
--- 5563,5583 ----
  	if ((rc = PQresultStatus(res)) != PGRES_TUPLES_OK)
  	{
! 		/* see what kind of error it is... */
! #define CONCUPDATEMSG "ERROR:  could not serialize access due to concurrent update"
! 		if (strncmp(CONCUPDATEMSG, PQresultErrorMessage(res), strlen(CONCUPDATEMSG)) == 0) {
! 			slon_log(SLON_WARN, "serialization problem updating sl_archive_counter: restarting slon\n");
! 			slon_mkquery(&query,
! 				     "notify \"_%s_Restart\"; ",
! 				     rtcfg_cluster_name);
! 			PQexec(dbconn, dstring_data(&query));
! 		} else {
! 
! 			slon_log(SLON_WARN, "error message was [%s]\n", PQresultErrorMessage(res));
! 			slon_log(SLON_ERROR,
! 					 "remoteWorkerThread_%d: \"%s\" %s %s\n",
  				 node->no_id, dstring_data(&query),
  				 PQresStatus(rc),
! 					 PQresultErrorMessage(res));
! 		}
  		PQclear(res);
  		dstring_free(&query);



More information about the Slony1-commit mailing list