CVS User Account cvsuser
Wed Mar 29 08:10:06 PST 2006
Log Message:
-----------
When a slon runs into the fatal error where sl_nodelock-pkey gets a
non-unique value (which indicates a second slon trying to manage a
node), the log also receives additional messages that may be useful
for diagnosis:

2006-03-29 16:01:34 UTC FATAL  localListenThread: "select "_test1538".cleanupNodelock(); insert into "_test1538".sl_nodelock values (    1, 0, "pg_catalog".pg_backend_pid()); " - ERROR:  duplicate key violates unique constraint "sl_nodelock-pkey"

2006-03-29 16:01:34 UTC FATAL  Do you already have a slon running against this node?
2006-03-29 16:01:34 UTC FATAL  Or perhaps a residual idle backend connection from a dead slon?

Modified Files:
--------------
    slony1-engine/src/slon:
        local_listen.c (r1.36 -> r1.37)

-------------- next part --------------
Index: local_listen.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/local_listen.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -Lsrc/slon/local_listen.c -Lsrc/slon/local_listen.c -u -w -r1.36 -r1.37
--- src/slon/local_listen.c
+++ src/slon/local_listen.c
@@ -89,6 +89,8 @@
 	/*
 	 * Check that we are the only slon daemon connected.
 	 */
+#define NODELOCKERROR "ERROR:  duplicate key violates unique constraint \"sl_nodelock-pkey\""
+
 	slon_mkquery(&query1,
 				 "select %s.cleanupNodelock(); "
 				 "insert into %s.sl_nodelock values ("
@@ -99,8 +101,15 @@
 	if (PQresultStatus(res) != PGRES_COMMAND_OK)
 	{
 		slon_log(SLON_FATAL,
-				 "localListenThread: \"%s\" - %s",
+				 "localListenThread: \"%s\" - %s\n",
 				 dstring_data(&query1), PQresultErrorMessage(res));
+		if (strncmp(NODELOCKERROR, PQresultErrorMessage(res), strlen(NODELOCKERROR)) == 0) {
+			slon_log(SLON_FATAL,
+				 "Do you already have a slon running against this node?\n");
+			slon_log(SLON_FATAL,
+				 "Or perhaps a residual idle backend connection from a dead slon?\n");
+		}
+		    
 		PQclear(res);
 		dstring_free(&query1);
 		slon_abort();



More information about the Slony1-commit mailing list