CVS User Account cvsuser
Wed Jan 12 17:27:46 PST 2005
Log Message:
-----------
pgindent run

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_funcs.c (r1.27 -> r1.28)
    slony1-engine/src/slon:
        cleanup_thread.c (r1.18 -> r1.19)
        conf-file.h (r1.1 -> r1.2)
        confoptions.c (r1.9 -> r1.10)
        confoptions.h (r1.11 -> r1.12)
        dbutils.c (r1.14 -> r1.15)
        local_listen.c (r1.28 -> r1.29)
        misc.c (r1.15 -> r1.16)
        misc.h (r1.3 -> r1.4)
        remote_listen.c (r1.19 -> r1.20)
        remote_worker.c (r1.69 -> r1.70)
        runtime_config.c (r1.22 -> r1.23)
        scheduler.c (r1.16 -> r1.17)
        slon.c (r1.40 -> r1.41)
        slon.h (r1.42 -> r1.43)
        sync_thread.c (r1.14 -> r1.15)
    slony1-engine/src/slonik:
        dbutil.c (r1.6 -> r1.7)
        slonik.c (r1.38 -> r1.39)
        slonik.h (r1.22 -> r1.23)
    slony1-engine/src/xxid:
        xxid.c (r1.8 -> r1.9)

-------------- next part --------------
Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/misc.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lsrc/slon/misc.h -Lsrc/slon/misc.h -u -w -r1.3 -r1.4
--- src/slon/misc.h
+++ src/slon/misc.h
@@ -7,7 +7,8 @@
 #include "config.h"
 #include "c.h"
 
-typedef enum {
+typedef enum
+{
         SLON_FATAL = -4,
         SLON_ERROR,
         SLON_WARN,
@@ -22,7 +23,6 @@
 extern void             slon_log(SlonLogLevel level, char * fmt, ...);
 
 extern int              slon_scanint64(char *str, int64 *result);
-
 #endif
 
 /*
Index: confoptions.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/confoptions.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -Lsrc/slon/confoptions.h -Lsrc/slon/confoptions.h -u -w -r1.11 -r1.12
--- src/slon/confoptions.h
+++ src/slon/confoptions.h
@@ -298,7 +298,6 @@
 #endif
 	NULL
 };
-
 #endif
 /*
  * Local Variables:
@@ -307,4 +306,3 @@
  *  c-basic-offset: 4
  * End:
  */
-
Index: scheduler.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/scheduler.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lsrc/slon/scheduler.c -Lsrc/slon/scheduler.c -u -w -r1.16 -r1.17
--- src/slon/scheduler.c
+++ src/slon/scheduler.c
@@ -85,9 +85,8 @@
 	sched_main_thread = pthread_self();
 
 	/*
-	 * Block signals. Since sched_start_mainloop() is called before any
-	 * other thread is created, this will be inherited by all threads in
-	 * the system.
+	 * Block signals. Since sched_start_mainloop() is called before any other
+	 * thread is created, this will be inherited by all threads in the system.
 	 */
 	sigemptyset(&sched_sigset);
 	sigaddset(&sched_sigset, SIGHUP);
@@ -103,6 +102,7 @@
 		perror("sched_start_mainloop: pthread_mutex_lock()");
 		return -1;
 	}
+
 	/*
 	 * Start the scheduler thread
 	 */
@@ -111,6 +111,7 @@
 		perror("sched_start_mainloop: pthread_create()");
 		return -1;
 	}
+
 	/*
 	 * When the scheduler is ready, he'll signal the scheduler cond
 	 */
@@ -119,6 +120,7 @@
 		perror("sched_start_mainloop: pthread_cond_wait()");
 		return -1;
 	}
+
 	/*
 	 * Release the scheduler lock
 	 */
@@ -127,6 +129,7 @@
 		perror("sched_start_mainloop: pthread_mutex_unlock()");
 		return -1;
 	}
+
 	/*
 	 * Check for errors
 	 */
@@ -210,9 +213,10 @@
 		pthread_mutex_unlock(&sched_master_lock);
 		return -1;
 	}
+
 	/*
-	 * Remember the event we're waiting for and add the database
-	 * connection to the fdset(s)
+	 * Remember the event we're waiting for and add the database connection to
+	 * the fdset(s)
 	 */
 	conn->condition = condition;
 	if (condition & SCHED_WAIT_SOCK_READ)
@@ -226,8 +230,8 @@
 	DLLIST_ADD_HEAD(sched_waitqueue_head, sched_waitqueue_tail, conn);
 
 	/*
-	 * Give the scheduler thread a heads up, release the master lock and
-	 * wait for it to tell us that the event we're waiting for happened.
+	 * Give the scheduler thread a heads up, release the master lock and wait
+	 * for it to tell us that the event we're waiting for happened.
 	 */
 	if (write(sched_wakeuppipe[1], "x", 1) < 0)
 	{
@@ -300,7 +304,8 @@
 	{
 		snprintf(dummyconn_name, 64, "msleep_node_%d", node->no_id);
 		conn = slon_make_dummyconn(dummyconn_name);
-	} else
+	}
+	else
 		conn = slon_make_dummyconn("msleep_local");
 
 	rc = sched_wait_time(conn, 0, msec);
@@ -397,8 +402,8 @@
 	int             i;
 
 	/*
-	 * Grab the scheduler master lock. This will wait until the main
-	 * thread acutally blocks on the master cond.
+	 * Grab the scheduler master lock. This will wait until the main thread
+	 * acutally blocks on the master cond.
 	 */
 	pthread_mutex_lock(&sched_master_lock);
 
@@ -409,8 +414,8 @@
 	FD_ZERO(&sched_fdset_write);
 
 	/*
-	 * Create a pipe used by the main thread to cleanly wakeup the
-	 * scheduler on signals.
+	 * Create a pipe used by the main thread to cleanly wakeup the scheduler
+	 * on signals.
 	 */
 	if (pipe(sched_wakeuppipe) < 0)
 	{
@@ -449,9 +454,9 @@
 		}
 
 		/*
-		 * Check if any of the connections in the wait queue have
-		 * reached there timeout. While doing so, we also remember
-		 * the closest timeout in the future.
+		 * Check if any of the connections in the wait queue have reached
+		 * there timeout. While doing so, we also remember the closest timeout
+		 * in the future.
 		 */
 		tv = NULL;
 		gettimeofday(&now, NULL);
@@ -462,8 +467,7 @@
 			if (conn->condition & SCHED_WAIT_CANCEL)
 			{
 				/*
-				 * Some other thread wants this thread to
-				 * wake up.
+				 * Some other thread wants this thread to wake up.
 				 */
 				DLLIST_REMOVE(sched_waitqueue_head,
 					      sched_waitqueue_tail, conn);
@@ -485,8 +489,8 @@
 			if (conn->condition & SCHED_WAIT_TIMEOUT)
 			{
 				/*
-				 * This connection has a timeout. Calculate
-				 * the time until that.
+				 * This connection has a timeout. Calculate the time until
+				 * that.
 				 */
 				timeout.tv_sec = conn->timeout.tv_sec - now.tv_sec;
 				timeout.tv_usec = conn->timeout.tv_usec - now.tv_usec;
@@ -503,11 +507,9 @@
 				    (timeout.tv_sec == 0 && timeout.tv_usec < 20000))
 				{
 					/*
-					 * Remove the connection from the
-					 * wait queue. We consider everything
-					 * closer than 20 msec being elapsed
-					 * to avoid a full scheduler round
-					 * just for one kernel tick.
+					 * Remove the connection from the wait queue. We consider
+					 * everything closer than 20 msec being elapsed to avoid a
+					 * full scheduler round just for one kernel tick.
 					 */
 					DLLIST_REMOVE(sched_waitqueue_head,
 						sched_waitqueue_tail, conn);
@@ -522,11 +524,11 @@
 					pthread_mutex_lock(&(conn->conn_lock));
 					pthread_cond_signal(&(conn->conn_cond));
 					pthread_mutex_unlock(&(conn->conn_lock));
-				} else
+				}
+				else
 				{
 					/*
-					 * Timeout not elapsed. Remember the
-					 * nearest.
+					 * Timeout not elapsed. Remember the nearest.
 					 */
 					if (tv == NULL ||
 					    timeout.tv_sec < min_timeout.tv_sec ||
@@ -558,6 +560,7 @@
 			sched_status = SCHED_STATUS_ERROR;
 			break;
 		}
+
 		/*
 		 * Check the special pipe for a heads up.
 		 */
@@ -573,9 +576,10 @@
 				break;
 			}
 		}
+
 		/*
-		 * Check all remaining connections if the IO condition the
-		 * thread is waiting for has occured.
+		 * Check all remaining connections if the IO condition the thread is
+		 * waiting for has occured.
 		 */
 		conn = sched_waitqueue_head;
 		while (rc > 0 && conn)
@@ -635,10 +639,10 @@
 	}
 
 	/*
-	 * If we reach here the scheduler runmode has been changed by by the
-	 * main threads signal handler. We currently hold the master lock.
-	 * First we close the scheduler heads-up socket pair so nobody will
-	 * think we're listening any longer.
+	 * If we reach here the scheduler runmode has been changed by by the main
+	 * threads signal handler. We currently hold the master lock. First we
+	 * close the scheduler heads-up socket pair so nobody will think we're
+	 * listening any longer.
 	 */
 	close(sched_wakeuppipe[0]);
 	close(sched_wakeuppipe[1]);
@@ -699,6 +703,7 @@
 		slon_log(SLON_FATAL, "sched_sighandler: called in non-main thread\n");
 		slon_abort();
 	}
+
 	/*
 	 * Set the scheduling status to shutdown
 	 */
@@ -720,6 +725,7 @@
 		pthread_mutex_unlock(&sched_master_lock);
 		exit(-1);
 	}
+
 	/*
 	 * Unlock the master mutex
 	 */
Index: conf-file.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/conf-file.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lsrc/slon/conf-file.h -Lsrc/slon/conf-file.h -u -w -r1.1 -r1.2
Index: remote_worker.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -Lsrc/slon/remote_worker.c -Lsrc/slon/remote_worker.c -u -w -r1.69 -r1.70
--- src/slon/remote_worker.c
+++ src/slon/remote_worker.c
@@ -220,27 +220,22 @@
 int last_sync_length;
 int max_sync;
 int min_sync;
+
 /*
  * ---------- Local functions ----------
  */
-static void 
-adjust_provider_info(SlonNode * node,
+static void adjust_provider_info(SlonNode * node,
 		     WorkerGroupData * wd, int cleanup);
-static int 
-query_execute(SlonNode * node, PGconn * dbconn,
+static int query_execute(SlonNode * node, PGconn *dbconn,
 	      SlonDString * dsp);
-static void 
-query_append_event(SlonDString * dsp,
+static void query_append_event(SlonDString * dsp,
 		   SlonWorkMsg_event * event);
-static void 
-store_confirm_forward(SlonNode * node, SlonConn * conn,
+static void store_confirm_forward(SlonNode * node, SlonConn * conn,
 		      SlonWorkMsg_confirm * confirm);
 static int64    get_last_forwarded_confirm(int origin, int receiver);
-static int 
-copy_set(SlonNode * node, SlonConn * local_conn, int set_id,
+static int copy_set(SlonNode * node, SlonConn * local_conn, int set_id,
 	 SlonWorkMsg_event * event);
-static int 
-sync_event(SlonNode * node, SlonConn * local_conn,
+static int sync_event(SlonNode * node, SlonConn * local_conn,
 	   WorkerGroupData * wd, SlonWorkMsg_event * event);
 static void    *sync_helper(void *cdata);
 
@@ -271,6 +266,7 @@
 	slon_log(SLON_DEBUG1,
 		 "remoteWorkerThread_%d: thread starts\n",
 		 node->no_id);
+
 	/*
 	 * Initialize local data
 	 */
@@ -318,8 +314,8 @@
 	while (true)
 	{
 		/*
-		 * If we got the special WMSG_WAKEUP, check the current
-		 * runmode of the scheduler and the status of our node.
+		 * If we got the special WMSG_WAKEUP, check the current runmode of the
+		 * scheduler and the status of our node.
 		 */
 		if (sched_get_status() != SCHED_STATUS_OK)
 			break;
@@ -341,9 +337,10 @@
 
 			check_config = false;
 		}
+
 		/*
-		 * Receive the next message from the queue. If there is no
-		 * one present, wait on the condition variable.
+		 * Receive the next message from the queue. If there is no one
+		 * present, wait on the condition variable.
 		 */
 		pthread_mutex_lock(&(node->message_lock));
 		if (node->message_head == NULL)
@@ -363,8 +360,7 @@
 		pthread_mutex_unlock(&(node->message_lock));
 
 		/*
-		 * Process WAKEUP messages by simply setting the check_config
-		 * flag.
+		 * Process WAKEUP messages by simply setting the check_config flag.
 		 */
 		if (msg->msg_type == WMSG_WAKEUP)
 		{
@@ -375,6 +371,7 @@
 			check_config = true;
 			continue;
 		}
+
 		/*
 		 * Process confirm messages.
 		 */
@@ -388,6 +385,7 @@
 			free(msg);
 			continue;
 		}
+
 		/*
 		 * This must be an event message then.
 		 */
@@ -408,12 +406,11 @@
 			 event->ev_type);
 
 		/*
-		 * Construct the queries to begin a transaction, notify on
-		 * the event and confirm relations, insert the event into our
-		 * local sl_event table and confirm it in our local
-		 * sl_confirm table. When this transaction commits, every
-		 * other remote node listening for events with us as a
-		 * provider will pick up the news.
+		 * Construct the queries to begin a transaction, notify on the event
+		 * and confirm relations, insert the event into our local sl_event
+		 * table and confirm it in our local sl_confirm table. When this
+		 * transaction commits, every other remote node listening for events
+		 * with us as a provider will pick up the news.
 		 */
 		slon_mkquery(&query1,
 			     "begin transaction; "
@@ -452,11 +449,17 @@
 					(sync_end.tv_usec - sync_start.tv_usec) / 1000;
 
 				/* Force last_sync_length to a reasonable range */
-				if ((last_sync_length < 10) || (last_sync_length > 1000000)) {
+				if ((last_sync_length < 10) || (last_sync_length > 1000000))
+				{
 						/* sync_length seems to be trash - force group size to 1 */
 					next_sync_group_size = 1;
-				} else {
-					/* Estimate an "ideal" number of syncs based on how long they took last time */
+				}
+				else
+				{
+					/*
+					 * Estimate an "ideal" number of syncs based on how long
+					 * they took last time
+					 */
 					ideal_sync = (last_sync_group_size * desired_sync_time) / last_sync_length;
 					max_sync = ((last_sync_group_size * 110) / 100 ) + 1;
 					next_sync_group_size = ideal_sync;
@@ -488,16 +491,15 @@
 			while (true)
 			{
 				/*
-				 * Execute the forwarding and notify stuff,
-				 * but do not commit the transaction yet.
+				 * Execute the forwarding and notify stuff, but do not commit
+				 * the transaction yet.
 				 */
 				if (query_execute(node, local_dbconn, &query1) < 0)
 					slon_abort();
 
 				/*
-				 * Process the sync and apply the replication
-				 * data. If successful, exit this loop and
-				 * commit the transaction.
+				 * Process the sync and apply the replication data. If
+				 * successful, exit this loop and commit the transaction.
 				 */
 				seconds = sync_event(node, local_conn, wd, event);
 				if (seconds == 0)
@@ -505,9 +507,10 @@
 					rc = SCHED_STATUS_OK;
 					break;
 				}
+
 				/*
-				 * Something went wrong. Rollback and try
-				 * again after the specified timeout.
+				 * Something went wrong. Rollback and try again after the
+				 * specified timeout.
 				 */
 				slon_mkquery(&query2, "rollback transaction");
 				if (query_execute(node, local_dbconn, &query2) < 0)
@@ -520,10 +523,9 @@
 				break;
 
 			/*
-			 * replace query1 with the forwarding of all the
-			 * grouped sync events and a commit. Also free all
-			 * the WMSG structres except the last one (it's freed
-			 * further down).
+			 * replace query1 with the forwarding of all the grouped sync
+			 * events and a commit. Also free all the WMSG structres except
+			 * the last one (it's freed further down).
 			 */
 			dstring_reset(&query1);
 			last_sync_group_size = 0;
@@ -538,22 +540,21 @@
 
 			if (query_execute(node, local_dbconn, &query1) < 0)
 				slon_abort();
-		} else
+		}
+		else
 		{
 			/*
-			 * Avoid deadlock problems during configuration
-			 * changes by locking the central confiuration lock
-			 * right from the start.
+			 * Avoid deadlock problems during configuration changes by locking
+			 * the central confiuration lock right from the start.
 			 */
 			slon_appendquery(&query1,
 					 "lock table %s.sl_config_lock; ",
 					 rtcfg_namespace);
 
 			/*
-			 * Simple configuration events. Call the
-			 * corresponding runtime config function, add the
-			 * query to call the configuration event specific
-			 * stored procedure.
+			 * Simple configuration events. Call the corresponding runtime
+			 * config function, add the query to call the configuration event
+			 * specific stored procedure.
 			 */
 			if (strcmp(event->ev_type, "STORE_NODE") == 0)
 			{
@@ -570,7 +571,8 @@
 						 no_id, no_comment, no_spool);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "ENABLE_NODE") == 0)
+			}
+			else if (strcmp(event->ev_type, "ENABLE_NODE") == 0)
 			{
 				int             no_id = (int)strtol(event->ev_data1, NULL, 10);
 
@@ -583,7 +585,8 @@
 						 no_id);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "DROP_NODE") == 0)
+			}
+			else if (strcmp(event->ev_type, "DROP_NODE") == 0)
 			{
 				int             no_id = (int)strtol(event->ev_data1, NULL, 10);
 
@@ -596,11 +599,10 @@
 						 no_id);
 
 				/*
-				 * If this is our own nodeid, then calling
-				 * disableNode_int() will destroy the whole
-				 * configuration including the entire schema.
-				 * Make sure we call just that and get out of
-				 * here ASAP!
+				 * If this is our own nodeid, then calling disableNode_int()
+				 * will destroy the whole configuration including the entire
+				 * schema. Make sure we call just that and get out of here
+				 * ASAP!
 				 */
 				if (no_id == rtcfg_nodeid)
 				{
@@ -623,16 +625,17 @@
 
 					slon_abort();
 				}
+
 				/*
-				 * this is a remote node. Arrange for daemon
-				 * restart.
+				 * this is a remote node. Arrange for daemon restart.
 				 */
 				slon_appendquery(&query1,
 						 "notify \"_%s_Restart\"; ",
 						 rtcfg_cluster_name);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "STORE_PATH") == 0)
+			}
+			else if (strcmp(event->ev_type, "STORE_PATH") == 0)
 			{
 				int             pa_server = (int)strtol(event->ev_data1, NULL, 10);
 				int             pa_client = (int)strtol(event->ev_data2, NULL, 10);
@@ -648,7 +651,8 @@
 						 pa_server, pa_client, pa_conninfo, pa_connretry);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "DROP_PATH") == 0)
+			}
+			else if (strcmp(event->ev_type, "DROP_PATH") == 0)
 			{
 				int             pa_server = (int)strtol(event->ev_data1, NULL, 10);
 				int             pa_client = (int)strtol(event->ev_data2, NULL, 10);
@@ -662,7 +666,8 @@
 						 pa_server, pa_client);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "STORE_LISTEN") == 0)
+			}
+			else if (strcmp(event->ev_type, "STORE_LISTEN") == 0)
 			{
 				int             li_origin = (int)strtol(event->ev_data1, NULL, 10);
 				int             li_provider = (int)strtol(event->ev_data2, NULL, 10);
@@ -675,7 +680,8 @@
 				  "select %s.storeListen_int(%d, %d, %d); ",
 						 rtcfg_namespace,
 				       li_origin, li_provider, li_receiver);
-			} else if (strcmp(event->ev_type, "DROP_LISTEN") == 0)
+			}
+			else if (strcmp(event->ev_type, "DROP_LISTEN") == 0)
 			{
 				int             li_origin = (int)strtol(event->ev_data1, NULL, 10);
 				int             li_provider = (int)strtol(event->ev_data2, NULL, 10);
@@ -688,7 +694,8 @@
 				   "select %s.dropListen_int(%d, %d, %d); ",
 						 rtcfg_namespace,
 				       li_origin, li_provider, li_receiver);
-			} else if (strcmp(event->ev_type, "STORE_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "STORE_SET") == 0)
 			{
 				int             set_id = (int)strtol(event->ev_data1, NULL, 10);
 				int             set_origin = (int)strtol(event->ev_data2, NULL, 10);
@@ -701,7 +708,8 @@
 				   "select %s.storeSet_int(%d, %d, '%q'); ",
 						 rtcfg_namespace,
 					   set_id, set_origin, set_comment);
-			} else if (strcmp(event->ev_type, "DROP_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "DROP_SET") == 0)
 			{
 				int             set_id = (int)strtol(event->ev_data1, NULL, 10);
 
@@ -710,7 +718,8 @@
 				slon_appendquery(&query1,
 					      "select %s.dropSet_int(%d); ",
 						 rtcfg_namespace, set_id);
-			} else if (strcmp(event->ev_type, "MERGE_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "MERGE_SET") == 0)
 			{
 				int             set_id = (int)strtol(event->ev_data1, NULL, 10);
 				int             add_id = (int)strtol(event->ev_data2, NULL, 10);
@@ -721,37 +730,40 @@
 					 "select %s.mergeSet_int(%d, %d); ",
 						 rtcfg_namespace,
 						 set_id, add_id);
-			} else if (strcmp(event->ev_type, "SET_ADD_TABLE") == 0)
+			}
+			else if (strcmp(event->ev_type, "SET_ADD_TABLE") == 0)
 			{
 				/*
-				 * Nothing to do ATM ... we don't support
-				 * adding tables to subscribed sets yet and
-				 * table information is not maintained in the
-				 * runtime configuration.
+				 * Nothing to do ATM ... we don't support adding tables to
+				 * subscribed sets yet and table information is not maintained
+				 * in the runtime configuration.
 				 */
-			} else if (strcmp(event->ev_type, "SET_ADD_SEQUENCE") == 0)
+			}
+			else if (strcmp(event->ev_type, "SET_ADD_SEQUENCE") == 0)
 			{
 				/*
-				 * Nothing to do ATM ... we don't support
-				 * adding sequences to subscribed sets yet
-				 * and sequences information is not
+				 * Nothing to do ATM ... we don't support adding sequences to
+				 * subscribed sets yet and sequences information is not
 				 * maintained in the runtime configuration.
 				 */
-			} else if (strcmp(event->ev_type, "SET_DROP_TABLE") == 0) 
+			}
+			else if (strcmp(event->ev_type, "SET_DROP_TABLE") == 0)
 			{
 				int tab_id = (int) strtol(event->ev_data1, NULL, 10);
 
 				slon_appendquery(&query1, "select %s.setDropTable_int(%d);", 
 						rtcfg_namespace,
 						tab_id);
-			} else if (strcmp(event->ev_type, "SET_DROP_SEQUENCE") == 0)
+			}
+			else if (strcmp(event->ev_type, "SET_DROP_SEQUENCE") == 0)
 			{
 				int seq_id = (int) strtol(event->ev_data1, NULL, 10);
 
 				slon_appendquery(&query1, "select %s.setDropSequence_int(%d);", 
 						rtcfg_namespace,
 						seq_id);
-			} else if (strcmp(event->ev_type, "SET_MOVE_TABLE") == 0) 
+			}
+			else if (strcmp(event->ev_type, "SET_MOVE_TABLE") == 0)
 			{
 				int tab_id = (int) strtol(event->ev_data1, NULL, 10);
 				int new_set_id = (int) strtol(event->ev_data2, NULL, 10);
@@ -759,7 +771,8 @@
 				slon_appendquery(&query1, "select %s.setMoveTable_int(%d, %d);", 
 						rtcfg_namespace,
 						tab_id, new_set_id);
-			} else if (strcmp(event->ev_type, "SET_MOVE_SEQUENCE") == 0)
+			}
+			else if (strcmp(event->ev_type, "SET_MOVE_SEQUENCE") == 0)
 			{
 				int seq_id = (int) strtol(event->ev_data1, NULL, 10);
 				int new_set_id = (int) strtol(event->ev_data2, NULL, 10);
@@ -767,7 +780,8 @@
 				slon_appendquery(&query1, "select %s.setMoveSequence_int(%d, %d);", 
 						rtcfg_namespace,
 						seq_id, new_set_id);
-			} else if (strcmp(event->ev_type, "STORE_TRIGGER") == 0)
+			}
+			else if (strcmp(event->ev_type, "STORE_TRIGGER") == 0)
 			{
 				int             trig_tabid = (int)strtol(event->ev_data1, NULL, 10);
 				char           *trig_tgname = event->ev_data2;
@@ -776,7 +790,8 @@
 				   "select %s.storeTrigger_int(%d, '%q'); ",
 						 rtcfg_namespace,
 						 trig_tabid, trig_tgname);
-			} else if (strcmp(event->ev_type, "DROP_TRIGGER") == 0)
+			}
+			else if (strcmp(event->ev_type, "DROP_TRIGGER") == 0)
 			{
 				int             trig_tabid = (int)strtol(event->ev_data1, NULL, 10);
 				char           *trig_tgname = event->ev_data2;
@@ -785,7 +800,8 @@
 				    "select %s.dropTrigger_int(%d, '%q'); ",
 						 rtcfg_namespace,
 						 trig_tabid, trig_tgname);
-			} else if (strcmp(event->ev_type, "MOVE_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "MOVE_SET") == 0)
 			{
 				int             set_id = (int)strtol(event->ev_data1, NULL, 10);
 				int             old_origin = (int)strtol(event->ev_data2, NULL, 10);
@@ -794,11 +810,10 @@
 				PGresult       *res;
 
 				/*
-				 * Move set is a little more tricky. The
-				 * stored proc does a lot of rearranging in
-				 * the provider chain. To catch up with that,
-				 * we need to execute it now and select the
-				 * resulting provider for us.
+				 * Move set is a little more tricky. The stored proc does a
+				 * lot of rearranging in the provider chain. To catch up with
+				 * that, we need to execute it now and select the resulting
+				 * provider for us.
 				 */
 				slon_appendquery(&query1,
 				      "select %s.moveSet_int(%d, %d, %d); ",
@@ -835,7 +850,8 @@
 				dstring_reset(&query1);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "FAILOVER_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "FAILOVER_SET") == 0)
 			{
 				int             failed_node = (int)strtol(event->ev_data1, NULL, 10);
 				int             backup_node = (int)strtol(event->ev_data2, NULL, 10);
@@ -849,7 +865,8 @@
 					  failed_node, backup_node, set_id);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "SUBSCRIBE_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "SUBSCRIBE_SET") == 0)
 			{
 				int             sub_set = (int)strtol(event->ev_data1, NULL, 10);
 				int             sub_provider = (int)strtol(event->ev_data2, NULL, 10);
@@ -865,7 +882,8 @@
 						 sub_set, sub_provider, sub_receiver, sub_forward);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "ENABLE_SUBSCRIPTION") == 0)
+			}
+			else if (strcmp(event->ev_type, "ENABLE_SUBSCRIPTION") == 0)
 			{
 				int             sub_set = (int)strtol(event->ev_data1, NULL, 10);
 				int             sub_provider = (int)strtol(event->ev_data2, NULL, 10);
@@ -873,8 +891,8 @@
 				char           *sub_forward = event->ev_data4;
 
 				/*
-				 * Do the actual enabling of the set only if
-				 * we are the receiver.
+				 * Do the actual enabling of the set only if we are the
+				 * receiver.
 				 */
 				if (sub_receiver == rtcfg_nodeid &&
 				    event->ev_origin == node->no_id)
@@ -888,10 +906,8 @@
 					while (true)
 					{
 						/*
-						 * If we received this event
-						 * from another node than the
-						 * data provider, wait until
-						 * the data provider has
+						 * If we received this event from another node than
+						 * the data provider, wait until the data provider has
 						 * synced up far enough.
 						 */
 						if (event->event_provider != sub_provider)
@@ -917,19 +933,17 @@
 								continue;
 							}
 						}
+
 						/*
-						 * Execute the config changes
-						 * so far, but don't commit
-						 * the transaction yet. We
-						 * have to copy the data now
+						 * Execute the config changes so far, but don't commit
+						 * the transaction yet. We have to copy the data now
 						 * ...
 						 */
 						if (query_execute(node, local_dbconn, &query1) < 0)
 							slon_abort();
 
 						/*
-						 * If the copy succeeds, exit
-						 * the loop and let the
+						 * If the copy succeeds, exit the loop and let the
 						 * transaction commit.
 						 */
 						if (copy_set(node, local_conn, sub_set, event) == 0)
@@ -942,11 +956,10 @@
 							sched_rc = SCHED_STATUS_OK;
 							break;
 						}
+
 						/*
-						 * Data copy for new enabled
-						 * set has failed. Rollback
-						 * the transaction, sleep and
-						 * try again.
+						 * Data copy for new enabled set has failed. Rollback
+						 * the transaction, sleep and try again.
 						 */
 						if (query_execute(node, local_dbconn, &query2) < 0)
 							slon_abort();
@@ -964,11 +977,11 @@
 						if (sleeptime < 60)
 							sleeptime *= 2;
 					}
-				} else
+				}
+				else
 				{
 					/*
-					 * Somebody else got enabled, just
-					 * remember it
+					 * Somebody else got enabled, just remember it
 					 */
 					slon_appendquery(&query1,
 							 "select %s.enableSubscription(%d, %d, %d); ",
@@ -977,15 +990,15 @@
 				}
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "UNSUBSCRIBE_SET") == 0)
+			}
+			else if (strcmp(event->ev_type, "UNSUBSCRIBE_SET") == 0)
 			{
 				int             sub_set = (int)strtol(event->ev_data1, NULL, 10);
 				int             sub_receiver = (int)strtol(event->ev_data2, NULL, 10);
 
 				/*
-				 * All the real work is done when the config
-				 * utility calls unsubscribeSet() itself.
-				 * Just propagate the event here.
+				 * All the real work is done when the config utility calls
+				 * unsubscribeSet() itself. Just propagate the event here.
 				 */
 				slon_appendquery(&query1,
 				   "select %s.unsubscribeSet_int(%d, %d); ",
@@ -993,7 +1006,8 @@
 						 sub_set, sub_receiver);
 
 				need_reloadListen = true;
-			} else if (strcmp(event->ev_type, "DDL_SCRIPT") == 0)
+			}
+			else if (strcmp(event->ev_type, "DDL_SCRIPT") == 0)
 			{
 				int             ddl_setid = (int)strtol(event->ev_data1, NULL, 10);
 				char           *ddl_script = event->ev_data2;
@@ -1003,7 +1017,8 @@
 				  "select %s.ddlScript_int(%d, '%q', %d); ",
 						 rtcfg_namespace,
 				   ddl_setid, ddl_script, ddl_only_on_node);
-			} else if (strcmp(event->ev_type, "RESET_CONFIG") == 0)
+			}
+			else if (strcmp(event->ev_type, "RESET_CONFIG") == 0)
 			{
 				int	reset_config_setid = (int)strtol(event->ev_data1, NULL, 10);
 				int	reset_configonly_on_node = (int)strtol(event->ev_data2, NULL, 10);
@@ -1012,21 +1027,23 @@
 				  "select %s.updateReloid(%d, '%q', %d); ",
 						rtcfg_namespace,
 				  reset_config_setid, reset_configonly_on_node);
-			} else
+			}
+			else
 			{
 				printf("TODO: ********** remoteWorkerThread: node %d - EVENT %d," INT64_FORMAT " %s - unknown event type\n",
 				       node->no_id, event->ev_origin, event->ev_seqno, event->ev_type);
 			}
 
 			/*
-			 * All simple configuration events fall through here.
-			 * Commit the transaction.
+			 * All simple configuration events fall through here. Commit the
+			 * transaction.
 			 */
 			if (event_ok)
 			{
 				query_append_event(&query1, event);
 				slon_appendquery(&query1, "commit transaction;");
-			} else
+			}
+			else
 			{
 				slon_mkquery(&query1, "rollback transaction;");
 			}
@@ -1047,8 +1064,8 @@
 	}
 
 	/*
-	 * Thread exit time has arrived. Disconnect from all data providers
-	 * and free memory
+	 * Thread exit time has arrived. Disconnect from all data providers and
+	 * free memory
 	 */
 	adjust_provider_info(node, wd, true);
 
@@ -1101,8 +1118,8 @@
 	for (provider = wd->provider_head; provider; provider = provider->next)
 	{
 		/*
-		 * We create a lock here and keep it until we made our final
-		 * decision about what to do with the helper thread.
+		 * We create a lock here and keep it until we made our final decision
+		 * about what to do with the helper thread.
 		 */
 		pthread_mutex_lock(&(provider->helper_lock));
 
@@ -1121,9 +1138,9 @@
 	 * Step 2.
 	 * 
 	 * Add all currently replicated sets (back) to the providers adding new
-	 * providers as necessary. This step is skippen in cleanup mode,
-	 * causing all providers to become obsolete and thus the whole
-	 * provider info extinct.
+	 * providers as necessary. This step is skippen in cleanup mode, causing
+	 * all providers to become obsolete and thus the whole provider info
+	 * extinct.
 	 */
 	if (!cleanup)
 	{
@@ -1131,8 +1148,8 @@
 		     rtcfg_set = rtcfg_set->next)
 		{
 			/*
-			 * We're only interested in the set's that origin on
-			 * the remote node this worker is replicating.
+			 * We're only interested in the set's that origin on the remote
+			 * node this worker is replicating.
 			 */
 			if (rtcfg_set->set_origin != node->no_id)
 				continue;
@@ -1141,8 +1158,8 @@
 			    rtcfg_set->sub_active)
 			{
 				/*
-				 * We need to replicate this set. Find or add
-				 * the provider to our in-thread data.
+				 * We need to replicate this set. Find or add the provider to
+				 * our in-thread data.
 				 */
 				for (provider = wd->provider_head; provider;
 				     provider = provider->next)
@@ -1153,8 +1170,7 @@
 				if (provider == NULL)
 				{
 					/*
-					 * No provider entry found. Create a
-					 * new one.
+					 * No provider entry found. Create a new one.
 					 */
 					provider = (ProviderInfo *)
 						malloc(sizeof(ProviderInfo));
@@ -1163,9 +1179,8 @@
 					provider->wd = wd;
 
 					/*
-					 * Also create a helper thread for
-					 * this provider, which will actually
-					 * run the log data selection for us.
+					 * Also create a helper thread for this provider, which
+					 * will actually run the log data selection for us.
 					 */
 					pthread_mutex_init(&(provider->helper_lock), NULL);
 					pthread_mutex_lock(&(provider->helper_lock));
@@ -1185,8 +1200,7 @@
 					      node->no_id, provider->no_id);
 
 					/*
-					 * Add more workgroup data lines to
-					 * the pool.
+					 * Add more workgroup data lines to the pool.
 					 */
 					for (i = 0; i < SLON_WORKLINES_PER_HELPER; i++)
 					{
@@ -1206,8 +1220,8 @@
 							provider);
 
 					/*
-					 * Copy the runtime configurations
-					 * conninfo into the provider info.
+					 * Copy the runtime configurations conninfo into the
+					 * provider info.
 					 */
 					rtcfg_node = rtcfg_findNode(provider->no_id);
 					if (rtcfg_node != NULL)
@@ -1218,9 +1232,9 @@
 								strdup(rtcfg_node->pa_conninfo);
 					}
 				}
+
 				/*
-				 * Add the set to the list of sets we get
-				 * from this provider.
+				 * Add the set to the list of sets we get from this provider.
 				 */
 				pset = (ProviderSet *)
 					malloc(sizeof(ProviderSet));
@@ -1237,6 +1251,7 @@
 			}
 		}
 	}
+
 	/*
 	 * Step 3.
 	 * 
@@ -1249,15 +1264,14 @@
 		provnext = provider->next;
 
 		/*
-		 * If the list of currently replicated sets we receive from
-		 * this provider is empty, we don't need to maintain a
-		 * connection to it.
+		 * If the list of currently replicated sets we receive from this
+		 * provider is empty, we don't need to maintain a connection to it.
 		 */
 		if (provider->set_head == NULL)
 		{
 			/*
-			 * Tell this helper thread to exit, join him and
-			 * destroy thread related data.
+			 * Tell this helper thread to exit, join him and destroy thread
+			 * related data.
 			 */
 			provider->helper_status = SLON_WG_EXIT;
 			pthread_cond_signal(&(provider->helper_cond));
@@ -1299,6 +1313,7 @@
 				slon_disconnectdb(provider->conn);
 				provider->conn = NULL;
 			}
+
 			/*
 			 * Free other resources
 			 */
@@ -1314,6 +1329,7 @@
 
 			continue;
 		}
+
 		/*
 		 * If the connection info has changed, we have to reconnect.
 		 */
@@ -1337,9 +1353,9 @@
 			else
 				provider->pa_conninfo = strdup(rtcfg_node->pa_conninfo);
 		}
+
 		/*
-		 * Unlock the helper thread ... he should now go and wait for
-		 * work.
+		 * Unlock the helper thread ... he should now go and wait for work.
 		 */
 		pthread_mutex_unlock(&(provider->helper_lock));
 	}
@@ -1390,6 +1406,7 @@
 		 "remoteWorker_event: ignore new events due to shutdown\n");
 		return;
 	}
+
 	/*
 	 * Find the node, make sure it is active and that this event is not
 	 * already queued or processed.
@@ -1423,20 +1440,21 @@
 			 ev_origin, ev_seqno);
 		return;
 	}
+
 	/*
-	 * We lock the worker threads message queue before bumping the nodes
-	 * last known event sequence to avoid that another listener queues a
-	 * later message before we can insert this one.
+	 * We lock the worker threads message queue before bumping the nodes last
+	 * known event sequence to avoid that another listener queues a later
+	 * message before we can insert this one.
 	 */
 	pthread_mutex_lock(&(node->message_lock));
 	node->last_event = ev_seqno;
 	rtcfg_unlock();
 
 	/*
-	 * Compute the message length and allocate memory. The allocated
-	 * memory only needs to be zero-initialized in the structure size.
-	 * The following additional space for the event payload data is
-	 * overwritten completely anyway.
+	 * Compute the message length and allocate memory. The allocated memory
+	 * only needs to be zero-initialized in the structure size. The following
+	 * additional space for the event payload data is overwritten completely
+	 * anyway.
 	 */
 	len = offsetof(SlonWorkMsg_event, raw_data)
 		+ (len_timestamp = strlen(ev_timestamp) + 1)
@@ -1531,9 +1549,10 @@
 		strcpy(cp, ev_data8);
 		cp += len_data8;
 	}
+
 	/*
-	 * Add the message to the queue and trigger the condition variable in
-	 * case the worker is idle.
+	 * Add the message to the queue and trigger the condition variable in case
+	 * the worker is idle.
 	 */
 	DLLIST_ADD_TAIL(node->message_head, node->message_tail,
 			(SlonWorkMsg *) msg);
@@ -1555,8 +1574,8 @@
 	SlonWorkMsg    *msg;
 
 	/*
-	 * Can't wakeup myself, can I? No, we never have a "remote" worker
-	 * for our own node ID.
+	 * Can't wakeup myself, can I? No, we never have a "remote" worker for our
+	 * own node ID.
 	 */
 	if (no_id == rtcfg_nodeid)
 		return;
@@ -1642,8 +1661,8 @@
 	pthread_mutex_lock(&(node->message_lock));
 
 	/*
-	 * Look if we already have a confirm message for this origin+received
-	 * node pair.
+	 * Look if we already have a confirm message for this origin+received node
+	 * pair.
 	 */
 	for (oldmsg = (SlonWorkMsg_confirm *) (node->message_head);
 	     oldmsg; oldmsg = (SlonWorkMsg_confirm *) (oldmsg->next))
@@ -1654,9 +1673,8 @@
 			    oldmsg->con_received == con_received)
 			{
 				/*
-				 * Existing message found. Change it if new
-				 * seqno is greater than old. Otherwise just
-				 * ignore this confirm.
+				 * Existing message found. Change it if new seqno is greater
+				 * than old. Otherwise just ignore this confirm.
 				 */
 				if (oldmsg->con_seqno < con_seqno)
 				{
@@ -1685,8 +1703,8 @@
 			(SlonWorkMsg *) msg);
 
 	/*
-	 * Send a condition signal to the worker thread in case it is waiting
-	 * for new messages.
+	 * Send a condition signal to the worker thread in case it is waiting for
+	 * new messages.
 	 */
 	pthread_cond_signal(&(node->message_cond));
 	pthread_mutex_unlock(&(node->message_lock));
@@ -1734,6 +1752,7 @@
 query_append_event(SlonDString * dsp, SlonWorkMsg_event * event)
 {
 	char            seqbuf[64];
+
 	sprintf(seqbuf, INT64_FORMAT, event->ev_seqno);
 
 	slon_appendquery(dsp,
@@ -1822,15 +1841,14 @@
 			if (cstat->con_seqno >= confirm->con_seqno)
 			{
 				/*
-				 * Confirm status is newer or equal, ignore
-				 * message.
+				 * Confirm status is newer or equal, ignore message.
 				 */
 				pthread_mutex_unlock(&node_confirm_lock);
 				return;
 			}
+
 			/*
-			 * Set the confirm status to the new seqno and
-			 * continue below.
+			 * Set the confirm status to the new seqno and continue below.
 			 */
 			cstat_found = true;
 			cstat->con_seqno = confirm->con_seqno;
@@ -1949,8 +1967,10 @@
 	char           *ssy_xip = NULL;
 	SlonDString     ssy_action_list;
 	char            seqbuf[64];
+
 #ifdef HAVE_PQPUTCOPYDATA
 	char           *copydata = NULL;
+
 #else
 	char            copybuf[8192];
 	int             copydone;
@@ -2026,8 +2046,8 @@
 	sprintf(seqbuf, INT64_FORMAT, event->ev_seqno);
 
 	/*
-	 * Listen on the special relation telling what node daemon this
-	 * connection belongs to.
+	 * Listen on the special relation telling what node daemon this connection
+	 * belongs to.
 	 */
 	slon_mkquery(&query1,
 		     "listen \"_%s_Node_%d\"; ",
@@ -2038,15 +2058,16 @@
 		dstring_free(&query1);
 		return -1;
 	}
+
 	/*
-	 * Begin a serialized transaction and check if our xmin in the
-	 * snapshot is > than ev_maxxid. This ensures that all transactions
-	 * that have been in progress when the subscription got enabled
-	 * (which is after the triggers on the tables have been defined),
-	 * have finished. Otherwise a long running open transaction would not
-	 * have the trigger definitions yet, and an insert would not get
-	 * logged. But if it still runs when we start to copy the set, then
-	 * we don't see the row either and it would get lost.
+	 * Begin a serialized transaction and check if our xmin in the snapshot is
+	 * > than ev_maxxid. This ensures that all transactions that have been in
+	 * progress when the subscription got enabled (which is after the triggers
+	 * on the tables have been defined), have finished. Otherwise a long
+	 * running open transaction would not have the trigger definitions yet,
+	 * and an insert would not get logged. But if it still runs when we start
+	 * to copy the set, then we don't see the row either and it would get
+	 * lost.
 	 */
 	if (sub_provider == set_origin)
 	{
@@ -2077,7 +2098,8 @@
 			return -1;
 		}
 		PQclear(res1);
-	} else
+	}
+	else
 	{
 		slon_mkquery(&query1,
 			     "start transaction; "
@@ -2091,8 +2113,7 @@
 	}
 
 	/*
-	 * Select the list of all tables the provider currently has in the
-	 * set.
+	 * Select the list of all tables the provider currently has in the set.
 	 */
 	slon_mkquery(&query1,
 		     "select T.tab_id, "
@@ -2137,8 +2158,8 @@
 			 node->no_id, tab_fqname);
 
 		/*
-		 * Find out if the table we're copying has the special slony
-		 * serial number key on the provider DB
+		 * Find out if the table we're copying has the special slony serial
+		 * number key on the provider DB
 		 */
 		slon_mkquery(&query1,
 			     "select %s.tableHasSerialKey('%q');",
@@ -2161,8 +2182,7 @@
 		if (rc)
 		{
 			/*
-			 * It has, check if the table has this on the local
-			 * DB too.
+			 * It has, check if the table has this on the local DB too.
 			 */
 			slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: "
 				 "table %s requires Slony-I serial key\n",
@@ -2202,13 +2222,15 @@
 				slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: "
 				"table %s Slony-I serial key added local\n",
 					 node->no_id, tab_fqname);
-			} else
+			}
+			else
 			{
 				slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: "
 					 "local table %s already has Slony-I serial key\n",
 					 node->no_id, tab_fqname);
 			}
-		} else
+		}
+		else
 		{
 			slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: "
 			   "table %s does not require Slony-I serial key\n",
@@ -2217,9 +2239,9 @@
 
 
 		/*
-		 * Call the setAddTable_int() stored procedure. Up to now,
-		 * while we have not been subscribed to the set, this should
-		 * have been suppressed.
+		 * Call the setAddTable_int() stored procedure. Up to now, while we
+		 * have not been subscribed to the set, this should have been
+		 * suppressed.
 		 */
 		slon_mkquery(&query1,
 		    "select %s.setAddTable_int(%d, %d, '%q', '%q', '%q'); ",
@@ -2232,6 +2254,7 @@
 			dstring_free(&query1);
 			return -1;
 		}
+
 		/*
 		 * Copy the content of sl_trigger for this table
 		 */
@@ -2289,6 +2312,7 @@
 			dstring_free(&query1);
 			return -1;
 		}
+
 		/*
 		 * Begin a COPY to stdout for the table on the provider DB
 		 */
@@ -2314,6 +2338,7 @@
 			dstring_free(&query1);
 			return -1;
 		}
+
 		/*
 		 * Copy the data over
 		 */
@@ -2359,9 +2384,10 @@
 			dstring_free(&query1);
 			return -1;
 		}
+
 		/*
-		 * Check that the COPY to stdout on the provider node
-		 * finished successful.
+		 * Check that the COPY to stdout on the provider node finished
+		 * successful.
 		 */
 		res3 = PQgetResult(pro_dbconn);
 		if (PQresultStatus(res3) != PGRES_COMMAND_OK)
@@ -2418,7 +2444,8 @@
 			    copybuf[2] == '\0')
 			{
 				copydone = true;
-			} else
+			}
+			else
 			{
 				switch (rc)
 				{
@@ -2457,8 +2484,8 @@
 		PQclear(res3);
 
 		/*
-		 * Check that the COPY to stdout on the provider node
-		 * finished successful.
+		 * Check that the COPY to stdout on the provider node finished
+		 * successful.
 		 */
 
 		/*
@@ -2595,15 +2622,15 @@
 		      node->no_id, seql_seqid, seq_fqname, seql_last_value);
 
 		/*
-		 * sequence with ID 0 is a nodes rowid ... only remember in
-		 * seqlog.
+		 * sequence with ID 0 is a nodes rowid ... only remember in seqlog.
 		 */
 		if (strtol(seql_seqid, NULL, 10) != 0)
 		{
 			slon_mkquery(&query1,
 			       "select \"pg_catalog\".setval('%q', '%s'); ",
 				     seq_fqname, seql_last_value);
-		} else
+		}
+		else
 			dstring_reset(&query1);
 		slon_appendquery(&query1,
 				 "insert into %s.sl_seqlog "
@@ -2633,18 +2660,18 @@
 	gettimeofday(&tv_start2, NULL);
 
 	/*
-	 * It depends on who is our data provider how we construct the
-	 * initial setsync status.
+	 * It depends on who is our data provider how we construct the initial
+	 * setsync status.
 	 */
 	if (set_origin == node->no_id)
 	{
 		/*
-		 * Our provider is the origin, so we have to construct the
-		 * setsync from scratch.
+		 * Our provider is the origin, so we have to construct the setsync
+		 * from scratch.
 		 * 
-		 * The problem at hand is that the data is something between two
-		 * SYNC points. So to get to the next sync point, we'll have
-		 * to take this and all
+		 * The problem at hand is that the data is something between two SYNC
+		 * points. So to get to the next sync point, we'll have to take this
+		 * and all
 		 */
 		slon_mkquery(&query1,
 			     "select max(ev_seqno) as ssy_seqno "
@@ -2675,8 +2702,8 @@
 		if (PQgetisnull(res1, 0, 0))
 		{
 			/*
-			 * No SYNC event found, so we initialize the setsync
-			 * to the event point of the ENABLE_SUBSCRIPTION
+			 * No SYNC event found, so we initialize the setsync to the event
+			 * point of the ENABLE_SUBSCRIPTION
 			 */
 			ssy_seqno = seqbuf;
 			ssy_minxid = event->ev_minxid_c;
@@ -2694,12 +2721,12 @@
 				 "from %s.sl_log_2 where log_origin = %d; ",
 				     rtcfg_namespace, node->no_id,
 				     rtcfg_namespace, node->no_id);
-		} else
+		}
+		else
 		{
 			/*
-			 * Use the last SYNC's snapshot information and set
-			 * the action sequence list to all actions after
-			 * that.
+			 * Use the last SYNC's snapshot information and set the action
+			 * sequence list to all actions after that.
 			 */
 			slon_mkquery(&query1,
 			    "select ev_seqno, ev_minxid, ev_maxxid, ev_xip "
@@ -2757,8 +2784,8 @@
 		}
 
 		/*
-		 * query1 now contains the selection for the ssy_action_list
-		 * selection from both log tables. Fill the dstring.
+		 * query1 now contains the selection for the ssy_action_list selection
+		 * from both log tables. Fill the dstring.
 		 */
 		res2 = PQexec(pro_dbconn, dstring_data(&query1));
 		if (PQresultStatus(res2) != PGRES_TUPLES_OK)
@@ -2789,11 +2816,12 @@
 		}
 		dstring_terminate(&ssy_action_list);
 		PQclear(res2);
-	} else
+	}
+	else
 	{
 		/*
-		 * Our provider is another subscriber, so we can copy the
-		 * existing setsync from him.
+		 * Our provider is another subscriber, so we can copy the existing
+		 * setsync from him.
 		 */
 		slon_mkquery(&query1,
 			     "select ssy_seqno, ssy_minxid, ssy_maxxid, "
@@ -2888,6 +2916,7 @@
 	ProviderInfo   *provider;
 	ProviderSet    *pset;
 	char            conn_symname[64];
+
 	/* TODO: tab_forward array to know if we need to store the log */
 	PGconn         *local_dbconn = local_conn->dbconn;
 	PGresult       *res1;
@@ -2940,9 +2969,9 @@
 				dstring_free(&query);
 				return provider->pa_connretry;
 			}
+
 			/*
-			 * Listen on the special relation telling our node
-			 * relationship
+			 * Listen on the special relation telling our node relationship
 			 */
 			slon_mkquery(&query,
 				     "listen \"_%s_Node_%d\"; ",
@@ -2962,15 +2991,14 @@
 	}
 
 	/*
-	 * Check that all these providers have processed at least up to the
-	 * SYNC event we're handling here.
+	 * Check that all these providers have processed at least up to the SYNC
+	 * event we're handling here.
 	 */
 	for (provider = wd->provider_head; provider; provider = provider->next)
 	{
 		/*
-		 * We only need to explicitly check this if the data provider
-		 * is neither the set origin, nor the node we received this
-		 * event from.
+		 * We only need to explicitly check this if the data provider is
+		 * neither the set origin, nor the node we received this event from.
 		 */
 		if (event->ev_origin != provider->no_id &&
 		    event->event_provider != provider->no_id)
@@ -3063,9 +3091,8 @@
 		PQclear(res1);
 
 		/*
-		 * Start listening on the special relation that will cause
-		 * our local connection to be killed when the provider node
-		 * fails.
+		 * Start listening on the special relation that will cause our local
+		 * connection to be killed when the provider node fails.
 		 */
 		slon_mkquery(&query,
 			     "listen \"_%s_Node_%d\"; ",
@@ -3108,8 +3135,8 @@
 			     node->no_id);
 
 		/*
-		 * Select all sets we receive from this provider and which
-		 * are not synced better than this SYNC already.
+		 * Select all sets we receive from this provider and which are not
+		 * synced better than this SYNC already.
 		 */
 		slon_mkquery(&query,
 			     "select SSY.ssy_setid, SSY.ssy_seqno, "
@@ -3136,6 +3163,7 @@
 			dstring_free(&query);
 			return 60;
 		}
+
 		/*
 		 * For every set we receive from this provider
 		 */
@@ -3192,22 +3220,23 @@
 				PQclear(res2);
 				continue;
 			}
+
 			/*
 			 * ... and build up a query qualification that is
 			 * 
 			 * and ( (log_tableid in (<tables_in_set>) and
-			 * (<snapshot_qual_of_new_sync>) and
-			 * (<snapshot_qual_of_setsync>) ) OR (
-			 * <next_set_from_this_provider> ) )
+			 * (<snapshot_qual_of_new_sync>) and (<snapshot_qual_of_setsync>)
+			 * ) OR ( <next_set_from_this_provider> ) )
 			 * 
-			 * If we were using AND's there then no rows will ever
-			 * end up being selected when you have multiple sets.
+			 * If we were using AND's there then no rows will ever end up being
+			 * selected when you have multiple sets.
 			 */
 
 			if (added_or_to_provider)
 			{
 				slon_appendquery(provider_qual, "or (\n    log_tableid in (");
-			} else
+			}
+			else
 			{
 				slon_appendquery(provider_qual, " (\n log_tableid in (");
 				added_or_to_provider = 1;
@@ -3221,9 +3250,8 @@
 				SlonSet        *rtcfg_set;
 
 				/*
-				 * Remember the fully qualified table name on
-				 * the fly. This might have to become a
-				 * hashtable someday.
+				 * Remember the fully qualified table name on the fly. This
+				 * might have to become a hashtable someday.
 				 */
 				while (tab_id >= wd->tab_fqname_size)
 				{
@@ -3240,8 +3268,7 @@
 				wd->tab_fqname[tab_id] = strdup(PQgetvalue(res2, tupno2, 2));
 
 				/*
-				 * Also remember if the tables log data needs
-				 * to be forwarded.
+				 * Also remember if the tables log data needs to be forwarded.
 				 */
 				for (rtcfg_set = rtcfg_set_list_head; rtcfg_set;
 				     rtcfg_set = rtcfg_set->next)
@@ -3288,14 +3315,15 @@
 		PQclear(res1);
 
 		/*
-		 * We didn't add anything good in the provider clause. That
-		 * shouldn't be!
+		 * We didn't add anything good in the provider clause. That shouldn't
+		 * be!
 		 */
 		if (added_or_to_provider)
 		{
 			/* close out our OR block */
 			slon_appendquery(provider_qual, ")");
-		} else
+		}
+		else
 		{
 			slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: Didn't add or to provider\n", node->no_id);
 		}
@@ -3304,8 +3332,7 @@
 	dstring_free(&new_qual);
 
 	/*
-	 * If we have found no sets needing sync at all, why bother the
-	 * helpers?
+	 * If we have found no sets needing sync at all, why bother the helpers?
 	 */
 	if (num_sets == 0)
 	{
@@ -3315,6 +3342,7 @@
 		dstring_free(&query);
 		return 0;
 	}
+
 	/*
 	 * Time to get the helpers busy.
 	 */
@@ -3394,7 +3422,8 @@
 							 dstring_data(&(wgline->data)),
 							 dstring_data(&(wgline->provider->helper_qualification)));
 						num_errors++;
-					} else
+						}
+						else
 						slon_log(SLON_DEBUG4, "remoteWorkerThread_%d: %s\n",
 							 node->no_id, dstring_data(&(wgline->data)));
 				}
@@ -3459,6 +3488,7 @@
 
 	slon_log(SLON_DEBUG4, "remoteWorkerThread_%d: cleanup\n",
 		 node->no_id);
+
 	/*
 	 * Cleanup
 	 */
@@ -3482,9 +3512,10 @@
 			 node->no_id);
 		return 10;
 	}
+
 	/*
-	 * Light's are still green ... update the setsync status of all the
-	 * sets we've just replicated ...
+	 * Light's are still green ... update the setsync status of all the sets
+	 * we've just replicated ...
 	 */
 	slon_mkquery(&query,
 		     "update %s.sl_setsync set "
@@ -3528,9 +3559,8 @@
 	for (provider = wd->provider_head; provider; provider = provider->next)
 	{
 		/*
-		 * Stop listening on the special relations that will cause
-		 * our local connection to be killed when the provider node
-		 * fails.
+		 * Stop listening on the special relations that will cause our local
+		 * connection to be killed when the provider node fails.
 		 */
 		slon_mkquery(&query,
 			     "unlisten \"_%s_Node_%d\"; ",
@@ -3642,6 +3672,7 @@
 			pthread_mutex_unlock(&(provider->helper_lock));
 			continue;
 		}
+
 		/*
 		 * OK, we got work to do.
 		 */
@@ -3662,11 +3693,12 @@
 				errors++;
 				break;
 			}
+
 			/*
 			 * Open a cursor that reads the log data.
 			 * 
-			 * TODO: need to change this into a conditional sl_log_n
-			 * selection depending on the logstatus.
+			 * TODO: need to change this into a conditional sl_log_n selection
+			 * depending on the logstatus.
 			 */
 			slon_mkquery(&query,
 				     "declare LOG cursor for select "
@@ -3684,26 +3716,26 @@
 				errors++;
 				break;
 			}
+
 			/*
-			 * Now fetch the log data and forward it via the line
-			 * pool to the main worker who pushes it into the
-			 * local database.
+			 * Now fetch the log data and forward it via the line pool to the
+			 * main worker who pushes it into the local database.
 			 */
 			alloc_lines = 0;
 			while (errors == 0)
 			{
 				/*
-				 * Allocate at least some lines - ideally the
-				 * whole fetch size.
+				 * Allocate at least some lines - ideally the whole fetch
+				 * size.
 				 */
 				while (alloc_lines == 0 && !errors)
 				{
 					slon_log(SLON_DEBUG4,
 						 "remoteHelperThread_%d_%d: allocate lines\n",
 					      node->no_id, provider->no_id);
+
 					/*
-					 * Wait until there are lines
-					 * available in the pool.
+					 * Wait until there are lines available in the pool.
 					 */
 					pthread_mutex_lock(&(wd->workdata_lock));
 					while (wd->linepool_head == NULL &&
@@ -3713,9 +3745,8 @@
 					}
 
 					/*
-					 * If any error occured somewhere in
-					 * the group, the main worker will
-					 * set the status to ABORT.
+					 * If any error occured somewhere in the group, the main
+					 * worker will set the status to ABORT.
 					 */
 					if (wd->workgroup_status != SLON_WG_BUSY)
 					{
@@ -3726,9 +3757,9 @@
 						errors++;
 						break;
 					}
+
 					/*
-					 * So far so good. Fill our array of
-					 * lines from the pool.
+					 * So far so good. Fill our array of lines from the pool.
 					 */
 					while (alloc_lines < SLON_DATA_FETCH_SIZE &&
 					       wd->linepool_head != NULL)
@@ -3749,9 +3780,8 @@
 				 node->no_id, provider->no_id, alloc_lines);
 
 				/*
-				 * Now that we have allocated some buffer
-				 * space, try to fetch that many rows from
-				 * the cursor.
+				 * Now that we have allocated some buffer space, try to fetch
+				 * that many rows from the cursor.
 				 */
 				slon_mkquery(&query, "fetch %d from LOG; ",
 				      alloc_lines * SLON_COMMANDS_PER_LINE);
@@ -3776,9 +3806,10 @@
 
 					first_fetch = false;
 				}
+
 				/*
-				 * Fill the line buffers with queries from
-				 * the retrieved log rows.
+				 * Fill the line buffers with queries from the retrieved log
+				 * rows.
 				 */
 				line_no = 0;
 				ntuples = PQntuples(res);
@@ -3802,14 +3833,12 @@
 						line->provider = provider;
 						dstring_reset(&(line->data));
 					}
+
 					/*
-					 * This can happen if the table
-					 * belongs to a set that already has
-					 * a better sync status than the
-					 * event we're currently processing
-					 * as a result from another SYNC
-					 * occuring before we had started
-					 * processing the copy_set.
+					 * This can happen if the table belongs to a set that
+					 * already has a better sync status than the event we're
+					 * currently processing as a result from another SYNC
+					 * occuring before we had started processing the copy_set.
 					 */
 					if (log_tableid >= wd->tab_fqname_size ||
 					wd->tab_fqname[log_tableid] == NULL)
@@ -3854,9 +3883,8 @@
 				PQclear(res);
 
 				/*
-				 * Now put all the line buffers back. Filled
-				 * ones into the repldata, unused ones into
-				 * the pool.
+				 * Now put all the line buffers back. Filled ones into the
+				 * repldata, unused ones into the pool.
 				 */
 				pthread_mutex_lock(&(wd->workdata_lock));
 				for (tupno = 0; tupno < alloc_lines; tupno++)
@@ -3908,6 +3936,7 @@
 			pthread_cond_broadcast(&(wd->linepool_cond));
 			pthread_mutex_unlock(&(wd->workdata_lock));
 		}
+
 		/*
 		 * Close the cursor and rollback the transaction.
 		 */
@@ -3927,8 +3956,8 @@
 			 TIMEVAL_DIFF(&tv_start, &tv_now));
 
 		/*
-		 * Change our helper status to DONE and tell the worker
-		 * thread about it.
+		 * Change our helper status to DONE and tell the worker thread about
+		 * it.
 		 */
 		slon_log(SLON_DEBUG4,
 		  "remoteHelperThread_%d_%d: change helper thread status\n",
Index: remote_listen.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_listen.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lsrc/slon/remote_listen.c -Lsrc/slon/remote_listen.c -u -w -r1.19 -r1.20
--- src/slon/remote_listen.c
+++ src/slon/remote_listen.c
@@ -47,18 +47,14 @@
 /*
  * ---------- Local functions ----------
  */
-static void 
-remoteListen_adjust_listat(SlonNode * node,
+static void remoteListen_adjust_listat(SlonNode * node,
 			   struct listat ** listat_head,
 			   struct listat ** listat_tail);
-static void 
-remoteListen_cleanup(struct listat ** listat_head,
+static void remoteListen_cleanup(struct listat **listat_head,
 		     struct listat ** listat_tail);
-static int 
-remoteListen_forward_confirm(SlonNode * node,
+static int remoteListen_forward_confirm(SlonNode * node,
 			     SlonConn * conn);
-static int 
-remoteListen_receive_events(SlonNode * node,
+static int remoteListen_receive_events(SlonNode * node,
 			    SlonConn * conn, struct listat * listat);
 
 
@@ -111,15 +107,14 @@
 		if (last_config_seq != (new_config_seq = rtcfg_seq_get()))
 		{
 			/*
-			 * Lock the configuration and check if we are (still)
-			 * supposed to exist.
+			 * Lock the configuration and check if we are (still) supposed to
+			 * exist.
 			 */
 			rtcfg_lock();
 
 			/*
-			 * If we have a database connection to the remote
-			 * node, check if there was a change in the
-			 * connection information.
+			 * If we have a database connection to the remote node, check if
+			 * there was a change in the connection information.
 			 */
 			if (conn != NULL)
 			{
@@ -137,6 +132,7 @@
 					conn_conninfo = NULL;
 				}
 			}
+
 			/*
 			 * Check our node's listen_status
 			 */
@@ -151,10 +147,9 @@
 				node->listen_status = SLON_TSTAT_RUNNING;
 
 			/*
-			 * Adjust the listat list and see if there is
-			 * anything to listen for. If not, sleep for a while
-			 * and check again, some node reconfiguration must be
-			 * going on here.
+			 * Adjust the listat list and see if there is anything to listen
+			 * for. If not, sleep for a while and check again, some node
+			 * reconfiguration must be going on here.
 			 */
 			remoteListen_adjust_listat(node, &listat_head, &listat_tail);
 
@@ -173,6 +168,7 @@
 			}
 			rtcfg_unlock();
 		}
+
 		/*
 		 * Check if we have a database connection
 		 */
@@ -198,9 +194,10 @@
 
 				continue;
 			}
+
 			/*
-			 * Try to establish a database connection to the
-			 * remote node's database.
+			 * Try to establish a database connection to the remote node's
+			 * database.
 			 */
 			conn_conninfo = strdup(node->pa_conninfo);
 			pa_connretry = node->pa_connretry;
@@ -226,8 +223,7 @@
 			dbconn = conn->dbconn;
 
 			/*
-			 * Listen on the connection for events and
-			 * confirmations
+			 * Listen on the connection for events and confirmations
 			 */
 			slon_mkquery(&query1,
 				     "listen \"_%s_Event\"; "
@@ -296,6 +292,7 @@
 				 node->no_id, conn_conninfo);
 
 		}
+
 		/*
 		 * Receive events from the provider node
 		 */
@@ -313,10 +310,11 @@
 
 			continue;
 		}
+
 		/*
-		 * If the remote node notified for new confirmations, read
-		 * them and queue them into the remote worker for storage in
-		 * our local database.
+		 * If the remote node notified for new confirmations, read them and
+		 * queue them into the remote worker for storage in our local
+		 * database.
 		 */
 		if (forward_confirm)
 		{
@@ -336,6 +334,7 @@
 			}
 			forward_confirm = false;
 		}
+
 		/*
 		 * Wait for notification.
 		 */
@@ -346,8 +345,8 @@
 			break;
 
 		/*
-		 * Set the forward_confirm flag if there was any Confirm
-		 * notification sent.
+		 * Set the forward_confirm flag if there was any Confirm notification
+		 * sent.
 		 */
 		PQconsumeInput(dbconn);
 		while ((notification = PQnotifies(dbconn)) != NULL)
@@ -402,8 +401,8 @@
 	int             found;
 
 	/*
-	 * Remove listat entries for event origins that this remote node
-	 * stopped providing for us, or where the origin got disabled.
+	 * Remove listat entries for event origins that this remote node stopped
+	 * providing for us, or where the origin got disabled.
 	 */
 	for (listat = *listat_head; listat;)
 	{
@@ -413,8 +412,8 @@
 		for (listen = node->listen_head; listen; listen = listen->next)
 		{
 			/*
-			 * Check if the sl_listen entry still exists and that
-			 * the li_origin is active.
+			 * Check if the sl_listen entry still exists and that the
+			 * li_origin is active.
 			 */
 			if (listen->li_origin == listat->li_origin)
 			{
@@ -529,8 +528,8 @@
 	dstring_init(&query);
 
 	/*
-	 * Select the max(con_seqno) grouped by con_origin and con_received
-	 * from the sl_confirm table.
+	 * Select the max(con_seqno) grouped by con_origin and con_received from
+	 * the sl_confirm table.
 	 */
 	slon_mkquery(&query,
 		     "select con_origin, con_received, "
@@ -551,9 +550,10 @@
 		PQclear(res);
 		return -1;
 	}
+
 	/*
-	 * We actually do not do the forwarding ourself here. We send a
-	 * special message to the remote worker for that node.
+	 * We actually do not do the forwarding ourself here. We send a special
+	 * message to the remote worker for that node.
 	 */
 	ntuples = PQntuples(res);
 	for (tupno = 0; tupno < ntuples; tupno++)
@@ -597,15 +597,14 @@
 	dstring_init(&query);
 
 	/*
-	 * In the runtime configuration info for the node, we remember the
-	 * last event sequence that we actually have received. If the remote
-	 * worker thread has processed it yet or it isn't important, we have
-	 * it in the message queue at least and don't need to select it
-	 * again.
+	 * In the runtime configuration info for the node, we remember the last
+	 * event sequence that we actually have received. If the remote worker
+	 * thread has processed it yet or it isn't important, we have it in the
+	 * message queue at least and don't need to select it again.
 	 * 
 	 * So the query we construct contains a qualification (ev_origin =
-	 * <remote_node> and ev_seqno > <last_seqno>) per remote node we're
-	 * listen for here.
+	 * <remote_node> and ev_seqno > <last_seqno>) per remote node we're listen
+	 * for here.
 	 */
 	slon_mkquery(&query,
 		     "select ev_origin, ev_seqno, ev_timestamp, "
Index: sync_thread.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/sync_thread.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lsrc/slon/sync_thread.c -Lsrc/slon/sync_thread.c -u -w -r1.14 -r1.15
--- src/slon/sync_thread.c
+++ src/slon/sync_thread.c
@@ -66,15 +66,15 @@
 	dbconn = conn->dbconn;
 	
 	/*
-	 * We don't initialize the last known action sequence to the actual
-	 * value. This causes that we create a SYNC event allways on startup,
-	 * just in case.
+	 * We don't initialize the last known action sequence to the actual value.
+	 * This causes that we create a SYNC event allways on startup, just in
+	 * case.
 	 */
 	last_actseq_buf[0] = '\0';
 	
 	/*
-	 * Build the query that starts a transaction and retrieves the last
-	 * value from the action sequence.
+	 * Build the query that starts a transaction and retrieves the last value
+	 * from the action sequence.
 	 */
 	dstring_init(&query1);
 	slon_mkquery(&query1,
@@ -96,8 +96,8 @@
 	while (sched_wait_time(conn, SCHED_WAIT_SOCK_READ, sync_interval) == SCHED_STATUS_OK)
 	{
 		/*
-		 * Start a serializable transaction and get the last value
-		 * from the action sequence number.
+		 * Start a serializable transaction and get the last value from the
+		 * action sequence number.
 		 */
 		res = PQexec(dbconn, dstring_data(&query1));
 		if (PQresultStatus(res) != PGRES_TUPLES_OK)
@@ -109,9 +109,10 @@
 			slon_abort();
 			break;
 		}
+
 		/*
-		 * Check if it's identical to the last known seq or if the
-		 * sync interval timeout has arrived.
+		 * Check if it's identical to the last known seq or if the sync
+		 * interval timeout has arrived.
 		 */
 		if (sync_interval_timeout != 0)
 			timeout_count -= sync_interval;
@@ -120,9 +121,8 @@
 		    timeout_count < 0)
 		{
 			/*
-			 * Action sequence has changed, generate a SYNC event
-			 * and read the resulting currval of the event
-			 * sequence.
+			 * Action sequence has changed, generate a SYNC event and read the
+			 * resulting currval of the event sequence.
 			 */
 			strcpy(last_actseq_buf, PQgetvalue(res, 0, 0));
 
@@ -161,7 +161,8 @@
 			 */
 			timeout_count = (sync_interval_timeout == 0) ? 0 :
 				sync_interval_timeout - sync_interval;
-		} else
+		}
+		else
 		{
 			/*
 			 * No database activity detected - rollback.
Index: slon.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -Lsrc/slon/slon.h -Lsrc/slon/slon.h -u -w -r1.42 -r1.43
--- src/slon/slon.h
+++ src/slon/slon.h
@@ -46,7 +46,8 @@
 #define SLON_VACUUM_FREQUENCY		1		/* vacuum every 3rd cleanup */
 
 
-typedef enum {
+typedef enum
+{
 	SLON_TSTAT_NONE,
 	SLON_TSTAT_RUNNING,
 	SLON_TSTAT_SHUTDOWN,
@@ -72,7 +73,8 @@
  * SlonNode
  * ----------
  */
-struct SlonNode_s {
+struct SlonNode_s
+{
 	int					no_id;			/* node ID */
 	int					no_active;		/* it's active state */
 	char			   *no_comment;		/* comment field */
@@ -105,7 +107,8 @@
  * SlonListen
  * ----------
  */
-struct SlonListen_s {
+struct SlonListen_s
+{
 	int					li_origin;		/* origin of events */
 
 	SlonListen		   *prev;
@@ -116,7 +119,8 @@
  * SlonSet
  * ----------
  */
-struct SlonSet_s {
+struct SlonSet_s
+{
 	int					set_id;			/* set ID */
 	int					set_origin;		/* set origin */
 	char			   *set_comment;	/* set comment */
@@ -134,7 +138,8 @@
  * SlonConn
  * ----------
  */
-struct SlonConn_s {
+struct SlonConn_s
+{
 	char			   *symname;		/* Symbolic name of connection */
 	struct SlonNode_s  *node;			/* remote node this belongs to */
 	PGconn			   *dbconn;			/* database connection */
@@ -497,7 +502,6 @@
  * ----------
  */
 extern int		slon_log_level;
-
 #endif /*  SLON_H_INCLUDED */
 
 
Index: runtime_config.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/runtime_config.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lsrc/slon/runtime_config.c -Lsrc/slon/runtime_config.c -u -w -r1.22 -r1.23
--- src/slon/runtime_config.c
+++ src/slon/runtime_config.c
@@ -117,6 +117,7 @@
 		rtcfg_unlock();
 		return;
 	}
+
 	/*
 	 * Add the new node to our in-memory configuration.
 	 */
@@ -166,9 +167,11 @@
 		{
 			node->last_event = event_seq;
 			retval = event_seq;
-		} else
+		}
+		else
 			retval = 0;
-	} else
+	}
+	else
 		retval = -1;
 
 	rtcfg_unlock();
@@ -196,7 +199,8 @@
 	if ((node = rtcfg_findNode(no_id)) != NULL)
 	{
 		retval = node->last_event;
-	} else
+	}
+	else
 		retval = -1;
 
 	rtcfg_unlock();
@@ -225,6 +229,7 @@
 		slon_abort();
 		return;
 	}
+
 	/*
 	 * Activate the node
 	 */
@@ -259,6 +264,7 @@
 		slon_abort();
 		return;
 	}
+
 	/*
 	 * Deactivate the node
 	 */
@@ -316,6 +322,7 @@
 		rtcfg_lock();
 		node = rtcfg_findNode(pa_server);
 	}
+
 	/*
 	 * Store the (new) conninfo to the node
 	 */
@@ -360,9 +367,10 @@
 
 		return;
 	}
+
 	/*
-	 * Drop all listen information as well at this provider. Without a
-	 * path we cannot listen.
+	 * Drop all listen information as well at this provider. Without a path we
+	 * cannot listen.
 	 */
 	while (node->listen_head != NULL)
 	{
@@ -401,7 +409,8 @@
 {
 	SlonDString		query;
 	PGresult	   *res;
-	int				i, n;
+	int			i	  ,
+				n;
 	SlonNode       *node;
 	SlonListen     *listen;
 
@@ -750,9 +759,9 @@
 			set->sub_forward = (*sub_forward == 't');
 			rtcfg_unlock();
 			rtcfg_seq_bump();
+
 			/*
-			 * Wakeup the worker threads for the old and new
-			 * provider
+			 * Wakeup the worker threads for the old and new provider
 			 */
 			if (old_provider >= 0 && old_provider != sub_provider)
 				sched_wakeup_node(old_provider);
@@ -835,9 +844,9 @@
 			set->sub_forward = false;
 			rtcfg_unlock();
 			rtcfg_seq_bump();
+
 			/*
-			 * Wakeup the worker threads for the old and new
-			 * provider
+			 * Wakeup the worker threads for the old and new provider
 			 */
 			if (old_provider >= 0)
 				sched_wakeup_node(old_provider);
@@ -890,7 +899,8 @@
 		default:
 			printf("TODO: ********** rtcfg_startStopNodeThread: restart node worker\n");
 		}
-	} else
+	}
+	else
 	{
 		/*
 		 * Make sure there is no node worker
@@ -954,7 +964,8 @@
 			node->listen_status = SLON_TSTAT_NONE;
 			break;
 		}
-	} else
+	}
+	else
 	{
 		/*
 		 * Node specific listen thread not required
Index: misc.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/misc.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lsrc/slon/misc.c -Lsrc/slon/misc.c -u -w -r1.15 -r1.16
--- src/slon/misc.c
+++ src/slon/misc.c
@@ -63,7 +63,6 @@
 #else
 
 #define Use_syslog 0
-
 #endif   /* HAVE_SYSLOG */
 
 
@@ -200,8 +199,8 @@
 	int             sign = 1;
 
 	/*
-	 * Do our own scan, rather than relying on sscanf which might be
-	 * broken for long long.
+	 * Do our own scan, rather than relying on sscanf which might be broken
+	 * for long long.
 	 */
 
 	/* skip leading spaces */
@@ -215,9 +214,8 @@
 		sign = -1;
 
 		/*
-		 * Do an explicit check for INT64_MIN.	Ugly though this is,
-		 * it's cleaner than trying to get the loop below to handle
-		 * it portably.
+		 * Do an explicit check for INT64_MIN.	Ugly though this is, it's
+		 * cleaner than trying to get the loop below to handle it portably.
 		 */
 #ifndef INT64_IS_BUSTED
 		if (strcmp(ptr, "9223372036854775808") == 0)
@@ -226,7 +224,8 @@
 			return true;
 		}
 #endif
-	} else if (*ptr == '+')
+	}
+	else if (*ptr == '+')
 		ptr++;
 
 	/* require at least one digit */
@@ -353,5 +352,5 @@
                 syslog(level, "[%lu] %s", seq, line);
         }
 }
-#endif   /* HAVE_SYSLOG */
 
+#endif   /* HAVE_SYSLOG */
Index: local_listen.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/local_listen.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -Lsrc/slon/local_listen.c -Lsrc/slon/local_listen.c -u -w -r1.28 -r1.29
--- src/slon/local_listen.c
+++ src/slon/local_listen.c
@@ -114,16 +114,16 @@
 	PQclear(res);
 
 	/*
-	 * Flag the main thread that the coast is clear and he
-	 * can launch all other threads.
+	 * Flag the main thread that the coast is clear and he can launch all
+	 * other threads.
 	 */
 	pthread_mutex_lock(&slon_wait_listen_lock);
 	pthread_cond_signal(&slon_wait_listen_cond);
 	pthread_mutex_unlock(&slon_wait_listen_lock);
 			
 	/*
-	 * Process all events, then wait for notification and repeat
-	 * until shutdown time has arrived.
+	 * Process all events, then wait for notification and repeat until
+	 * shutdown time has arrived.
 	 */
 	while (true)
 	{
@@ -261,8 +261,8 @@
 				rtcfg_disableNode(no_id);
 
 				/*
-				 * And cause the replication daemon to restart to get
-				 * rid of it.
+				 * And cause the replication daemon to restart to get rid of
+				 * it.
 				 */
 				snprintf(notify_query, sizeof(notify_query),
 						"notify \"_%s_Restart\";",
@@ -393,9 +393,8 @@
 				 */
 
 				/*
-				 * Nothing to do ATM ... we don't support
-				 * adding tables to subscribed sets and
-				 * table information is not maintained in
+				 * Nothing to do ATM ... we don't support adding tables to
+				 * subscribed sets and table information is not maintained in
 				 * the runtime configuration.
 				 */
 			}
@@ -406,9 +405,8 @@
 				 */
 
 				/*
-				 * Nothing to do ATM ... we don't support
-				 * adding sequences to subscribed sets and
-				 * table information is not maintained in
+				 * Nothing to do ATM ... we don't support adding sequences to
+				 * subscribed sets and table information is not maintained in
 				 * the runtime configuration.
 				 */
 			}
@@ -417,10 +415,10 @@
 				/*
 				 * SET_DROP_TABLE
 				 */
+
 				/*
-				 * Nothing to do ATM ... 
-				 * table information is not maintained in
-				 * the runtime configuration.
+				 * Nothing to do ATM ... table information is not maintained
+				 * in the runtime configuration.
 				 */
 			}
 			else if (strcmp(ev_type, "SET_DROP_SEQUENCE") == 0)
@@ -428,10 +426,10 @@
 				/*
 				 * SET_DROP_SEQUENCE
 				 */
+
 				/*
-				 * Nothing to do ATM ... 
-				 * table information is not maintained in
-				 * the runtime configuration.
+				 * Nothing to do ATM ... table information is not maintained
+				 * in the runtime configuration.
 				 */
 			}
 			else if (strcmp(ev_type, "SET_MOVE_TABLE") == 0)
@@ -439,10 +437,10 @@
 				/*
 				 * SET_MOVE_TABLE
 				 */
+
 				/*
-				 * Nothing to do ATM ... 
-				 * table information is not maintained in
-				 * the runtime configuration.
+				 * Nothing to do ATM ... table information is not maintained
+				 * in the runtime configuration.
 				 */
 			}
 			else if (strcmp(ev_type, "SET_MOVE_SEQUENCE") == 0)
@@ -450,10 +448,10 @@
 				/*
 				 * SET_MOVE_SEQUENCE
 				 */
+
 				/*
-				 * Nothing to do ATM ... 
-				 * table information is not maintained in
-				 * the runtime configuration.
+				 * Nothing to do ATM ... table information is not maintained
+				 * in the runtime configuration.
 				 */
 			}
 			else if (strcmp(ev_type, "ADJUST_SEQ") == 0)
@@ -499,8 +497,8 @@
 				new_origin	= (int) strtol(PQgetvalue(res, tupno, 8), NULL, 10);
 
 				/*
-				 * We have been the old origin of the set, so according
-				 * to the rules we must have a provider now.
+				 * We have been the old origin of the set, so according to the
+				 * rules we must have a provider now.
 				 */
 				dstring_init(&query2);
 				slon_mkquery(&query2,
@@ -543,8 +541,8 @@
 				 */
 
 				/*
-				 * Nothing to do. The stored procedure will restart
-				 * this daemon anyway.
+				 * Nothing to do. The stored procedure will restart this
+				 * daemon anyway.
 				 */
 			}
 			else if (strcmp(ev_type, "SUBSCRIBE_SET") == 0)
@@ -668,8 +666,8 @@
 	}
 
 	/*
-	 * The scheduler asked us to shutdown. Free memory
-	 * and close the DB connection.
+	 * The scheduler asked us to shutdown. Free memory and close the DB
+	 * connection.
 	 */
 	dstring_free(&query1);
 	slon_disconnectdb(conn);
Index: cleanup_thread.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/cleanup_thread.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -Lsrc/slon/cleanup_thread.c -Lsrc/slon/cleanup_thread.c -u -w -r1.18 -r1.19
--- src/slon/cleanup_thread.c
+++ src/slon/cleanup_thread.c
@@ -52,7 +52,8 @@
 	PGresult       *res2;
 	struct timeval  tv_start;
 	struct timeval  tv_end;
-	int             n, t;
+	int			n	  ,
+				t;
 	int             vac_count = 0;
 
 	slon_log(SLON_DEBUG1, "cleanupThread: thread starts\n");
@@ -68,8 +69,7 @@
 	dbconn = conn->dbconn;
 
 	/*
-	 * Build the query string for calling the cleanupEvent() stored
-	 * procedure
+	 * Build the query string for calling the cleanupEvent() stored procedure
 	 */
 	dstring_init(&query1);
 	slon_mkquery(&query1, "select %s.cleanupEvent(); ", rtcfg_namespace);
@@ -167,9 +167,10 @@
 		if (vac_frequency != 0 && ++vac_count >= vac_frequency)
 		{
 			vac_count = 0;
+
 			/*
-			 * Build the query string for vacuuming replication
-			 * runtime data and event tables
+			 * Build the query string for vacuuming replication runtime data
+			 * and event tables
 			 */
 			dstring_init(&query3);
 			slon_mkquery(&query3,
@@ -204,6 +205,7 @@
 			slon_log(SLON_DEBUG2,
 			     "cleanupThread: %8.3f seconds for vacuuming\n",
 				 TIMEVAL_DIFF(&tv_start, &tv_end));
+
 			/*
 			 * Free Resources
 			 */
Index: confoptions.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/confoptions.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lsrc/slon/confoptions.c -Lsrc/slon/confoptions.c -u -w -r1.9 -r1.10
--- src/slon/confoptions.c
+++ src/slon/confoptions.c
@@ -36,8 +36,7 @@
 		struct config_bool *conf = &ConfigureNamesBool[i];
 
 		/*
-		 * Rather than requiring vartype to be filled in by hand, do
-		 * this:
+		 * Rather than requiring vartype to be filled in by hand, do this:
 		 */
 		conf->gen.vartype = SLON_C_BOOL;
 		num_vars++;
@@ -46,6 +45,7 @@
 	for (i = 0; ConfigureNamesInt[i].gen.name; i++)
 	{
 		struct config_int *conf = &ConfigureNamesInt[i];
+
 		conf->gen.vartype = SLON_C_INT;
 		num_vars++;
 	}
@@ -53,6 +53,7 @@
 	for (i = 0; ConfigureNamesReal[i].gen.name; i++)
 	{
 		struct config_real *conf = &ConfigureNamesReal[i];
+
 		conf->gen.vartype = SLON_C_REAL;
 		num_vars++;
 	}
@@ -60,6 +61,7 @@
 	for (i = 0; ConfigureNamesString[i].gen.name; i++)
 	{
 		struct config_string *conf = &ConfigureNamesString[i];
+
 		conf->gen.vartype = SLON_C_STRING;
 		num_vars++;
 	}
@@ -118,7 +120,8 @@
 			size_vars = 100;
 			conf_vars = (struct config_generic **)
 				malloc(size_vars * sizeof(struct config_generic *));
-		} else
+		}
+		else
 		{
 			conf_vars = (struct config_generic **)
 				realloc(conf_variables, size_vars * sizeof(struct config_generic *));
@@ -155,18 +158,21 @@
 		case SLON_C_BOOL:
 			{
 				struct config_bool *conf = (struct config_bool *) gconf;
+
 				*conf->variable = conf->default_val;
 				break;
 			}
 		case SLON_C_INT:
 			{
 				struct config_int *conf = (struct config_int *) gconf;
+
 				*conf->variable = conf->default_val;
 				break;
 			}
 		case SLON_C_REAL:
 			{
 				struct config_real *conf = (struct config_real *) gconf;
+
 				*conf->variable = conf->default_val;
 				break;
 			}
@@ -174,6 +180,7 @@
 			{
 				char           *str;
 				struct config_string *conf = (struct config_string *) gconf;
+
 				*conf->variable = NULL;
 				if (conf->default_val)
 				{
@@ -203,49 +210,57 @@
 		{
 			*result = true;
 		}
-	} else if (strncasecmp(value, "false", len) == 0)
+	}
+	else if (strncasecmp(value, "false", len) == 0)
 	{
 		if (result)
 		{
 			*result = false;
 		}
-	} else if (strncasecmp(value, "yes", len) == 0)
+	}
+	else if (strncasecmp(value, "yes", len) == 0)
 	{
 		if (result)
 		{
 			*result = true;
 		}
-	} else if (strncasecmp(value, "no", len) == 0)
+	}
+	else if (strncasecmp(value, "no", len) == 0)
 	{
 		if (result)
 		{
 			*result = false;
 		}
-	} else if (strncasecmp(value, "on", len) == 0)
+	}
+	else if (strncasecmp(value, "on", len) == 0)
 	{
 		if (result)
 		{
 			*result = true;
 		}
-	} else if (strncasecmp(value, "off", len) == 0)
+	}
+	else if (strncasecmp(value, "off", len) == 0)
 	{
 		if (result)
 		{
 			*result = false;
 		}
-	} else if (strncasecmp(value, "1", len) == 0)
+	}
+	else if (strncasecmp(value, "1", len) == 0)
 	{
 		if (result)
 		{
 			*result = true;
 		}
-	} else if (strncasecmp(value, "o", len) == 0)
+	}
+	else if (strncasecmp(value, "o", len) == 0)
 	{
 		if (result)
 		{
 			*result = false;
 		}
-	} else
+	}
+	else
 	{
 		return false;
 	}
@@ -334,9 +349,9 @@
 conf_name_compare(const char *namea, const char *nameb)
 {
 	/*
-	 * The temptation to use strcasecmp() here must be resisted, because
-	 * the array ordering has to remain stable across setlocale() calls.
-	 * So, build our own with a simple ASCII-only downcasing.
+	 * The temptation to use strcasecmp() here must be resisted, because the
+	 * array ordering has to remain stable across setlocale() calls. So, build
+	 * our own with a simple ASCII-only downcasing.
 	 */
 	while (*namea && *nameb)
 	{
@@ -357,14 +372,16 @@
 	return 0;
 }
 
-void *get_config_option(const char *name)
+void *
+get_config_option(const char *name)
 {
 	struct config_generic *record;
 	int	elevel;
 
 	record = find_option(name, elevel);
 	if (record == NULL)
-	{	slon_log(elevel, "unrecognized configuration parameter \"%s\"\n", name);
+	{
+		slon_log(elevel, "unrecognized configuration parameter \"%s\"\n", name);
 		return NULL;
 	}
 	switch (record->vartype)
@@ -372,24 +389,28 @@
 		case SLON_C_BOOL:
 		{
 			struct config_bool *conf = (struct config_bool *) record;
+
 			return (void *)conf->variable;
 			break;
 		}
 		case SLON_C_INT:
 		{
 			struct config_int *conf = (struct config_int *) record;
+
 			return (void *)conf->variable;
 			break;
 		}
 		case SLON_C_REAL:
 		{
 			struct config_real *conf = (struct config_real *) record;
+
 			return (void *)conf->variable;
 			break;			
 		}
 		case SLON_C_STRING:
 		{
 			struct config_string *conf = (struct config_string *)record;
+
 			return (void *)*conf->variable;
 			break;
 		}
@@ -418,6 +439,7 @@
 		{
 			struct config_bool *conf = (struct config_bool *) record;
 			bool            newval;
+
 			if (value)
 			{
 				if (!parse_bool(value, &newval))
@@ -425,7 +447,8 @@
 					slon_log(elevel, "parameter \"%s\" requires a Boolean value\n", name);
 					return false;
 				}
-			} else
+				}
+				else
 			{
 				slon_log(elevel, "parameter \"%s\"\n", name);
 			}
@@ -438,6 +461,7 @@
 		{
 			struct config_int *conf = (struct config_int *) record;
 			int             newval;
+
 			if (value)
 			{
 				if (!parse_int(value, &newval))
@@ -451,7 +475,8 @@
 					newval, name, conf->min, conf->max);
 					return false;
 				}
-			} else
+				}
+				else
 			{
 				slon_log(elevel, "parameter \"%s\"\n", name);
 			}
@@ -476,7 +501,8 @@
 					newval, name, conf->min, conf->max);
 					return false;
 				}
-			} else
+				}
+				else
 			{
 				slon_log(elevel, "parameter \"%s\"\n", name);
 			}
@@ -495,7 +521,8 @@
 				{
 					return false;
 				}
-			} else
+				}
+				else
 			{
 				slon_log(elevel, "parameter \"%s\"\n", name);
 				free(newval);
Index: dbutils.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/dbutils.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lsrc/slon/dbutils.c -Lsrc/slon/dbutils.c -u -w -r1.14 -r1.15
--- src/slon/dbutils.c
+++ src/slon/dbutils.c
@@ -73,6 +73,7 @@
 		PQfinish(dbconn);
 		return NULL;
 	}
+
 	/*
 	 * Embed it into a SlonConn structure used to exchange it with the
 	 * scheduler. On return this new connection object is locked.
@@ -99,8 +100,7 @@
 #endif
 
 	/*
-	 * Unlock and destroy the condition and mutex variables and free
-	 * memory.
+	 * Unlock and destroy the condition and mutex variables and free memory.
 	 */
 	slon_free_dummyconn(conn);
 }
@@ -195,6 +195,7 @@
 		PQclear(res);
 		return -1;
 	}
+
 	/*
 	 * Return the result as an integer value
 	 */
Index: slon.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -Lsrc/slon/slon.c -Lsrc/slon/slon.c -u -w -r1.40 -r1.41
--- src/slon/slon.c
+++ src/slon/slon.c
@@ -63,7 +63,8 @@
 	char           *cp2;
 	SlonDString     query;
 	PGresult       *res;
-	int             i, n;
+	int			i	  ,
+				n;
 	PGconn         *startup_conn;
 	int             c;
 	int             errors = 0;
@@ -125,6 +126,7 @@
 			break;
 		}
 	}
+
 	/*
 	 * Make sure the sync interval isn't too small.
 	 */
@@ -191,8 +193,7 @@
 
 	
 	/*
-	 * Connect to the local database for reading the initial
-	 * configuration
+	 * Connect to the local database for reading the initial configuration
 	 */
 
 
@@ -209,6 +210,7 @@
 		PQfinish(startup_conn);
 		slon_exit(-1);
 	}
+
 	/*
 	 * Get our local node ID
 	 */
@@ -300,7 +302,8 @@
 			 */
 			rtcfg_nodeactive = no_active;
 			rtcfg_nodecomment = strdup(no_comment);
-		} else
+		}
+		else
 		{
 			/*
 			 * Add a remote node
@@ -310,8 +313,8 @@
 			rtcfg_setNodeLastEvent(no_id, last_event);
 
 			/*
-			 * If it is active, remember for activation just
-			 * before we start processing events.
+			 * If it is active, remember for activation just before we start
+			 * processing events.
 			 */
 			if (no_active)
 				rtcfg_needActivate(no_id);
@@ -455,10 +458,10 @@
 	slon_log(SLON_CONFIG, "main: configuration complete - starting threads\n");
 
 	/*
-	 * Create the local event thread that is monitoring the local node
-	 * for administrative events to adjust the configuration at runtime.
-	 * We wait here until the local listen thread has checked that there
-	 * is no other slon daemon running.
+	 * Create the local event thread that is monitoring the local node for
+	 * administrative events to adjust the configuration at runtime. We wait
+	 * here until the local listen thread has checked that there is no other
+	 * slon daemon running.
 	 */
 	pthread_mutex_lock(&slon_wait_listen_lock);
 	if (pthread_create(&local_event_thread, NULL, localListenThread_main, NULL) < 0)
@@ -476,8 +479,8 @@
 	rtcfg_doActivate();
 
 	/*
-	 * Create the local cleanup thread that will remove old events and
-	 * log data.
+	 * Create the local cleanup thread that will remove old events and log
+	 * data.
 	 */
 	if (pthread_create(&local_cleanup_thread, NULL, cleanupThread_main, NULL) < 0)
 	{
@@ -485,9 +488,10 @@
 			 strerror(errno));
 		slon_abort();
 	}
+
 	/*
-	 * Create the local sync thread that will generate SYNC events if we
-	 * had local database updates.
+	 * Create the local sync thread that will generate SYNC events if we had
+	 * local database updates.
 	 */
 	if (pthread_create(&local_sync_thread, NULL, syncThread_main, NULL) < 0)
 	{
@@ -495,6 +499,7 @@
 			 strerror(errno));
 		slon_abort();
 	}
+
 	/*
 	 * Wait until the scheduler has shut down all remote connections
 	 */
@@ -541,6 +546,7 @@
 		"main: cannot restart via execvp(): %s\n", strerror(errno));
 		exit(-1);
 	}
+
 	/*
 	 * That's it.
 	 */
Index: slonik.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slonik/slonik.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lsrc/slonik/slonik.h -Lsrc/slonik/slonik.h -u -w -r1.22 -r1.23
--- src/slonik/slonik.h
+++ src/slonik/slonik.h
@@ -49,7 +49,8 @@
 typedef struct SlonikStmt_update_functions_s	SlonikStmt_update_functions;
 typedef struct SlonikStmt_wait_event_s			SlonikStmt_wait_event;
 
-typedef enum {
+typedef enum
+{
 	STMT_TRY = 1,
 	STMT_CREATE_SET,
 	STMT_DDL_SCRIPT,
@@ -87,7 +88,8 @@
 	STMT_ERROR
 } Slonik_stmttype;
 	
-struct SlonikScript_s {
+struct SlonikScript_s
+{
 	char			   *clustername;
 	char			   *filename;
 
@@ -97,7 +99,8 @@
 };
 
 
-struct SlonikAdmInfo_s {
+struct SlonikAdmInfo_s
+{
 	int					no_id;
 	char			   *stmt_filename;
 	int					stmt_lno;
@@ -113,7 +116,8 @@
 };
 
 
-struct SlonikStmt_s {
+struct SlonikStmt_s
+{
 	Slonik_stmttype		stmt_type;
 	char			   *stmt_filename;
 	int					stmt_lno;
@@ -122,7 +126,8 @@
 };
 
 
-struct SlonikStmt_try_s {
+struct SlonikStmt_try_s
+{
 	SlonikStmt			hdr;
 	SlonikStmt		   *try_block;
 	SlonikStmt		   *error_block;
@@ -130,24 +135,28 @@
 };
 
 
-struct SlonikStmt_echo_s {
+struct SlonikStmt_echo_s
+{
 	SlonikStmt			hdr;
 	char			   *str;
 };
 
 
-struct SlonikStmt_exit_s {
+struct SlonikStmt_exit_s
+{
 	SlonikStmt			hdr;
 	int					exitcode;
 };
 
 
-struct SlonikStmt_restart_node_s {
+struct SlonikStmt_restart_node_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 };
 
-struct SlonikStmt_repair_config_s {
+struct SlonikStmt_repair_config_s
+{
         SlonikStmt                      hdr;
         int                                     set_id;
         int                                     ev_origin;
@@ -155,14 +164,16 @@
 };
 
 
-struct SlonikStmt_init_cluster_s {
+struct SlonikStmt_init_cluster_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 	char			   *no_comment;
 };
 
 
-struct SlonikStmt_store_node_s {
+struct SlonikStmt_store_node_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 	char			   *no_comment;
@@ -171,27 +182,31 @@
 };
 
 
-struct SlonikStmt_drop_node_s {
+struct SlonikStmt_drop_node_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 	int					ev_origin;
 };
 
 
-struct SlonikStmt_failed_node_s {
+struct SlonikStmt_failed_node_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 	int					backup_node;
 };
 
 
-struct SlonikStmt_uninstall_node_s {
+struct SlonikStmt_uninstall_node_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 };
 
 
-struct SlonikStmt_store_path_s {
+struct SlonikStmt_store_path_s
+{
 	SlonikStmt			hdr;
 	int					pa_server;
 	int					pa_client;
@@ -200,7 +215,8 @@
 };
 
 
-struct SlonikStmt_drop_path_s {
+struct SlonikStmt_drop_path_s
+{
 	SlonikStmt			hdr;
 	int					pa_server;
 	int					pa_client;
@@ -208,7 +224,8 @@
 };
 
 
-struct SlonikStmt_store_listen_s {
+struct SlonikStmt_store_listen_s
+{
 	SlonikStmt			hdr;
 	int					li_origin;
 	int					li_receiver;
@@ -216,7 +233,8 @@
 };
 
 
-struct SlonikStmt_drop_listen_s {
+struct SlonikStmt_drop_listen_s
+{
 	SlonikStmt			hdr;
 	int					li_origin;
 	int					li_receiver;
@@ -224,7 +242,8 @@
 };
 
 
-struct SlonikStmt_create_set_s {
+struct SlonikStmt_create_set_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					set_origin;
@@ -232,14 +251,16 @@
 };
 
 
-struct SlonikStmt_drop_set_s {
+struct SlonikStmt_drop_set_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					set_origin;
 };
 
 
-struct SlonikStmt_merge_set_s {
+struct SlonikStmt_merge_set_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					add_id;
@@ -247,7 +268,8 @@
 };
 
 
-struct SlonikStmt_set_add_table_s {
+struct SlonikStmt_set_add_table_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					set_origin;
@@ -259,7 +281,8 @@
 };
 
 
-struct SlonikStmt_set_add_sequence_s {
+struct SlonikStmt_set_add_sequence_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					set_origin;
@@ -269,21 +292,24 @@
 };
 
 
-struct SlonikStmt_set_drop_table_s {
+struct SlonikStmt_set_drop_table_s
+{
 	SlonikStmt			hdr;
 	int					set_origin;
 	int					tab_id;
 };
 
 
-struct SlonikStmt_set_drop_sequence_s {
+struct SlonikStmt_set_drop_sequence_s
+{
 	SlonikStmt			hdr;
 	int					set_origin;
 	int					seq_id;
 };
 
 
-struct SlonikStmt_set_move_table_s {
+struct SlonikStmt_set_move_table_s
+{
 	SlonikStmt			hdr;
 	int					set_origin;
 	int					tab_id;
@@ -291,7 +317,8 @@
 };
 
 
-struct SlonikStmt_set_move_sequence_s {
+struct SlonikStmt_set_move_sequence_s
+{
 	SlonikStmt			hdr;
 	int					set_origin;
 	int					seq_id;
@@ -299,14 +326,16 @@
 };
 
 
-struct SlonikStmt_table_add_key_s {
+struct SlonikStmt_table_add_key_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 	char			   *tab_fqname;
 };
 
 
-struct SlonikStmt_store_trigger_s {
+struct SlonikStmt_store_trigger_s
+{
 	SlonikStmt			hdr;
 	int					trig_tabid;
 	char			   *trig_tgname;
@@ -314,7 +343,8 @@
 };
 
 
-struct SlonikStmt_drop_trigger_s {
+struct SlonikStmt_drop_trigger_s
+{
 	SlonikStmt			hdr;
 	int					trig_tabid;
 	char			   *trig_tgname;
@@ -322,7 +352,8 @@
 };
 
 
-struct SlonikStmt_subscribe_set_s {
+struct SlonikStmt_subscribe_set_s
+{
 	SlonikStmt			hdr;
 	int					sub_setid;
 	int					sub_provider;
@@ -331,28 +362,32 @@
 };
 
 
-struct SlonikStmt_unsubscribe_set_s {
+struct SlonikStmt_unsubscribe_set_s
+{
 	SlonikStmt			hdr;
 	int					sub_setid;
 	int					sub_receiver;
 };
 
 
-struct SlonikStmt_lock_set_s {
+struct SlonikStmt_lock_set_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					set_origin;
 };
 
 
-struct SlonikStmt_unlock_set_s {
+struct SlonikStmt_unlock_set_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					set_origin;
 };
 
 
-struct SlonikStmt_move_set_s {
+struct SlonikStmt_move_set_s
+{
 	SlonikStmt			hdr;
 	int					set_id;
 	int					old_origin;
@@ -360,7 +395,8 @@
 };
 
 
-struct SlonikStmt_ddl_script_s {
+struct SlonikStmt_ddl_script_s
+{
 	SlonikStmt			hdr;
 	int					ddl_setid;
 	char			   *ddl_fname;
@@ -370,13 +406,15 @@
 };
 
 
-struct SlonikStmt_update_functions_s {
+struct SlonikStmt_update_functions_s
+{
 	SlonikStmt			hdr;
 	int					no_id;
 };
 
 
-struct SlonikStmt_wait_event_s {
+struct SlonikStmt_wait_event_s
+{
 	SlonikStmt			hdr;
 	int					wait_origin;
 	int					wait_confirmed;
@@ -518,6 +556,7 @@
 
 #ifdef HAVE_PQSETNOTICERECEIVER
 void			db_notice_recv(void *arg, const PGresult *res);
+
 #else
 void			db_notice_recv(void *arg, const char *msg);
 #endif
Index: dbutil.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slonik/dbutil.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lsrc/slonik/dbutil.c -Lsrc/slonik/dbutil.c -u -w -r1.6 -r1.7
--- src/slonik/dbutil.c
+++ src/slonik/dbutil.c
@@ -101,7 +101,6 @@
 				db_notice_stmt->stmt_lno, msg);
 	}
 }
-
 #endif /* !HAVE_PQSETNOTICERECEIVER */
 
 /* ----------
@@ -612,12 +611,14 @@
 				fmt++;
 				switch(*fmt)
 				{
-					case 's':	s = va_arg(ap, char *);
+					case 's':
+						s = va_arg(ap, char *);
 								dstring_append(dsp, s);
 								fmt++;
 								break;
 
-					case 'q':	s = va_arg(ap, char *);
+					case 'q':
+						s = va_arg(ap, char *);
 								while (*s != '\0')
 								{
 									switch (*s)
@@ -637,24 +638,28 @@
 								fmt++;
 								break;
 
-					case 'd':	sprintf(buf, "%d", va_arg(ap, int));
+					case 'd':
+						sprintf(buf, "%d", va_arg(ap, int));
 								dstring_append(dsp, buf);
 								fmt++;
 								break;
 
-					default:	dstring_addchar(dsp, '%');
+					default:
+						dstring_addchar(dsp, '%');
 								dstring_addchar(dsp, *fmt);
 								fmt++;
 								break;
 				}
 				break;
 
-			case '\\':	fmt++;
+			case '\\':
+				fmt++;
 						dstring_addchar(dsp, *fmt);
 						fmt++;
 						break;
 
-			default:	dstring_addchar(dsp, *fmt);
+			default:
+				dstring_addchar(dsp, *fmt);
 						fmt++;
 						break;
 		}
@@ -664,5 +669,3 @@
 
 	return 0;
 }
-
-
Index: slonik.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slonik/slonik.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -Lsrc/slonik/slonik.c -Lsrc/slonik/slonik.c -u -w -r1.38 -r1.39
--- src/slonik/slonik.c
+++ src/slonik/slonik.c
@@ -74,14 +74,17 @@
 	{
 		switch(opt)
 		{
-			case 'h':	parser_errors++;
+			case 'h':
+				parser_errors++;
 						break;
 
-			case 'v':   printf("slonik version %s\n", SLONY_I_VERSION_STRING);
+			case 'v':
+				printf("slonik version %s\n", SLONY_I_VERSION_STRING);
 						exit(0);
 						break;
 
-			default:	printf("unknown option '%c'\n", opt);
+			default:
+				printf("unknown option '%c'\n", opt);
 						parser_errors++;
 						break;
 		}
@@ -95,6 +98,7 @@
 		while (optind < argc)
 		{
 			FILE *fp;
+
 			fp = fopen(argv[optind], "r");
 			scan_new_input_file(fp);
 			current_file = (char *)argv[optind++];
@@ -249,6 +253,7 @@
 				{
 					SlonikStmt_repair_config *stmt = 
 							(SlonikStmt_repair_config *)hdr;
+
 					if (stmt->ev_origin < 0)
 					{
 						stmt->ev_origin = 1;
@@ -475,8 +480,8 @@
 							(SlonikStmt_set_add_table *)hdr;
 
 					/*
-					 * Check that we have the set_id and set_origin
-					 * and that we can reach the origin.
+					 * Check that we have the set_id and set_origin and that
+					 * we can reach the origin.
 					 */
 					if (stmt->set_id < 0)
 					{
@@ -499,8 +504,8 @@
 					}
 
 					/*
-					 * Check that we have the table id, name
-					 * and what to use for the key.
+					 * Check that we have the table id, name and what to use
+					 * for the key.
 					 */
 					if (stmt->tab_id < 0)
 					{
@@ -536,8 +541,8 @@
 							(SlonikStmt_set_add_sequence *)hdr;
 
 					/*
-					 * Check that we have the set_id and set_origin
-					 * and that we can reach the origin.
+					 * Check that we have the set_id and set_origin and that
+					 * we can reach the origin.
 					 */
 					if (stmt->set_id < 0)
 					{
@@ -560,8 +565,8 @@
 					}
 
 					/*
-					 * Check that we have the table id, name
-					 * and what to use for the key.
+					 * Check that we have the table id, name and what to use
+					 * for the key.
 					 */
 					if (stmt->seq_id < 0)
 					{
@@ -589,8 +594,8 @@
 							(SlonikStmt_set_drop_table *)hdr;
 
 					/*
-					 * Check that we have the set_id and set_origin
-					 * and that we can reach the origin.
+					 * Check that we have the set_id and set_origin and that
+					 * we can reach the origin.
 					 */
 					if (stmt->set_origin < 0)
 					{
@@ -606,8 +611,8 @@
 					}
 
 					/*
-					 * Check that we have the table id, name
-					 * and what to use for the key.
+					 * Check that we have the table id, name and what to use
+					 * for the key.
 					 */
 					if (stmt->tab_id < 0)
 					{
@@ -625,8 +630,8 @@
 							(SlonikStmt_set_drop_sequence *)hdr;
 
 					/*
-					 * Check that we have the set_id and set_origin
-					 * and that we can reach the origin.
+					 * Check that we have the set_id and set_origin and that
+					 * we can reach the origin.
 					 */
 					if (stmt->set_origin < 0)
 					{
@@ -642,8 +647,8 @@
 					}
 
 					/*
-					 * Check that we have the table id, name
-					 * and what to use for the key.
+					 * Check that we have the table id, name and what to use
+					 * for the key.
 					 */
 					if (stmt->seq_id < 0)
 					{
@@ -661,8 +666,8 @@
 							(SlonikStmt_set_move_table *)hdr;
 
 					/*
-					 * Check that we have the set_id and set_origin
-					 * and that we can reach the origin.
+					 * Check that we have the set_id and set_origin and that
+					 * we can reach the origin.
 					 */
 					if (stmt->set_origin < 0)
 					{
@@ -703,8 +708,8 @@
 							(SlonikStmt_set_move_sequence *)hdr;
 
 					/*
-					 * Check that we have the set_id and set_origin
-					 * and that we can reach the origin.
+					 * Check that we have the set_id and set_origin and that
+					 * we can reach the origin.
 					 */
 					if (stmt->set_origin < 0)
 					{
@@ -745,8 +750,8 @@
 							(SlonikStmt_table_add_key *)hdr;
 
 					/*
-					 * Check that we have the node id and that
-					 * we can reach it.
+					 * Check that we have the node id and that we can reach
+					 * it.
 					 */
 					if (stmt->no_id < 0)
 					{
@@ -1101,8 +1106,7 @@
 						{
 							/*
 							 * Successfull execution of ON ERROR case block
-							 * suppressed setting the overall script on
-							 * error.
+							 * suppressed setting the overall script on error.
 							 */
 							if (script_exec_stmts(script, stmt->error_block) < 0)
 								errors++;
@@ -1110,8 +1114,8 @@
 						else
 						{
 							/*
-							 * The try-block has no ON ERROR action,
-							 * abort script execution.
+							 * The try-block has no ON ERROR action, abort
+							 * script execution.
 							 */
 							errors++;
 						}
@@ -1119,9 +1123,10 @@
 					else
 					{
 						script_commit_all(hdr, script);
+
 						/*
-						 * If the try block has an ON SUCCESS block, 
-						 * execute that.
+						 * If the try block has an ON SUCCESS block, execute
+						 * that.
 						 */
 						if (stmt->success_block)
 							if (script_exec_stmts(script, stmt->success_block) < 0)
@@ -1701,11 +1706,10 @@
 	}
 
 	/*
-	 * This little hoop is required because for some
-	 * reason, 7.3 returns total garbage as a result
-	 * code for such a big pile of commands. So we just
-	 * fire that off, and then do one extra select and
-	 * see if we have an aborted transaction.
+	 * This little hoop is required because for some reason, 7.3 returns total
+	 * garbage as a result code for such a big pile of commands. So we just
+	 * fire that off, and then do one extra select and see if we have an
+	 * aborted transaction.
 	 */
 	res = PQexec(adminfo->dbconn, dstring_data(&query));
 	dstring_free(&query);
@@ -2250,8 +2254,8 @@
 		PQclear(res);
 
 		/*
-		 * Set our own event seqno in case the node id was used before
-		 * and our confirms.
+		 * Set our own event seqno in case the node id was used before and our
+		 * confirms.
 		 */
 		slon_mkquery(&query,
 				"select ev_origin, max(ev_seqno) "
@@ -2298,8 +2302,7 @@
 		PQclear(res);
 
 		/*
-		 * If available, bump the rowid sequence to the last known
-		 * value.
+		 * If available, bump the rowid sequence to the last known value.
 		 */
 		slon_mkquery(&query,
 				"select max(seql_last_value) from \"_%s\".sl_seqlog "
@@ -2393,7 +2396,8 @@
 }
 
 
-typedef struct {
+typedef struct
+{
 	int				no_id;
 	SlonikAdmInfo  *adminfo;
 	int				has_slon;
@@ -2402,7 +2406,8 @@
 } failnode_node;
 
 
-typedef struct {
+typedef struct
+{
 	int				set_id;
 	int				num_subscribers;
 	failnode_node **subscribers;
@@ -2419,7 +2424,10 @@
 
 	int				num_nodes;
 	int				num_sets;
-	int				n, i, j, k;
+	int			n	  ,
+				i		 ,
+				j		 ,
+				k;
 
 	failnode_node  *nodeinfo;
 	failnode_set   *setinfo;
@@ -2443,8 +2451,8 @@
 	dstring_init(&query);
 
 	/*
-	 * On the backup node select a list of all active nodes except
-	 * for the failed node.
+	 * On the backup node select a list of all active nodes except for the
+	 * failed node.
 	 */
 	slon_mkquery(&query,
 			"select no_id from \"_%s\".sl_node "
@@ -2462,8 +2470,8 @@
 	num_nodes = PQntuples(res1);
 
 	/*
-	 * Get a list of all sets that are subscribed more than once
-	 * directly from the origin
+	 * Get a list of all sets that are subscribed more than once directly from
+	 * the origin
 	 */
 	slon_mkquery(&query,
 			"select S.set_id, count(S.set_id) "
@@ -2510,8 +2518,8 @@
 	}
 
 	/*
-	 * Connect to all these nodes and determine if there is a node
-	 * daemon running on that node.
+	 * Connect to all these nodes and determine if there is a node daemon
+	 * running on that node.
 	 */
 	for (i = 0; i < num_nodes; i++)
 	{
@@ -2556,8 +2564,7 @@
 	PQclear(res1);
 
 	/*
-	 * For every set we're interested in lookup the direct
-	 * subscriber nodes.
+	 * For every set we're interested in lookup the direct subscriber nodes.
 	 */
 	for (i = 0; i < num_sets; i++)
 	{
@@ -2612,8 +2619,8 @@
 	PQclear(res2);
 
 	/*
-	 * Execute the failedNode() procedure, first on the backup
-	 * node, then on all other nodes.
+	 * Execute the failedNode() procedure, first on the backup node, then on
+	 * all other nodes.
 	 */
 	slon_mkquery(&query,
 			"select \"_%s\".failedNode(%d, %d); ",
@@ -2652,8 +2659,8 @@
 	}
 
 	/*
-	 * Wait until all slon replication engines that where running
-	 * have restarted.
+	 * Wait until all slon replication engines that where running have
+	 * restarted.
 	 */
 	n = 0;
 	while (n < num_nodes)
@@ -2698,8 +2705,8 @@
 	}
 
 	/*
-	 * Determine the absolutely last event sequence known from the
-	 * failed node.
+	 * Determine the absolutely last event sequence known from the failed
+	 * node.
 	 */
 	slon_mkquery(&query,
 			"select max(ev_seqno) "
@@ -2730,8 +2737,8 @@
 	}
 
 	/*
-	 * For every set determine the direct subscriber with the highest
-	 * applied sync, preferring the backup node.
+	 * For every set determine the direct subscriber with the highest applied
+	 * sync, preferring the backup node.
 	 */
 	for (i = 0; i < num_sets; i++)
 	{
@@ -2793,8 +2800,8 @@
 	}
 
 	/*
-	 * Now switch the backup node to receive all sets from those
-	 * highest nodes.
+	 * Now switch the backup node to receive all sets from those highest
+	 * nodes.
 	 */
 	for (i = 0; i < num_sets; i++)
 	{
@@ -2836,15 +2843,14 @@
 	}
 
 	/*
-	 * Commit the transaction on the backup node to activate
-	 * those changes.
+	 * Commit the transaction on the backup node to activate those changes.
 	 */
 	if (db_commit_xact((SlonikStmt *)stmt, adminfo1) < 0)
 		rc = -1;
 
 	/*
-	 * Now execute all FAILED_NODE events on the node that
-	 * had the highest of all events alltogether.
+	 * Now execute all FAILED_NODE events on the node that had the highest of
+	 * all events alltogether.
 	 */
 	if (max_node_total != NULL)
 	{
@@ -3163,9 +3169,8 @@
 	dstring_init(&query);
 
 	/*
-	 * Determine the attkind of the table.
-	 * The stored procedure for KEY = SERIAL might actually
-	 * add a bigserial column to the table.
+	 * Determine the attkind of the table. The stored procedure for KEY =
+	 * SERIAL might actually add a bigserial column to the table.
 	 */
 	if (stmt->use_serial)
 	{
@@ -3277,7 +3282,8 @@
 				 "select \"_%s\".setDropTable(%d); ",
 				 stmt->hdr.script->clustername,		     
 				 stmt->tab_id);
-	if (db_exec_evcommand((SlonikStmt *)stmt, adminfo1, &query) < 0) {
+	if (db_exec_evcommand((SlonikStmt *) stmt, adminfo1, &query) < 0)
+	{
 		dstring_free(&query);
 		return -1;
 	}
@@ -3340,7 +3346,8 @@
 				 "select \"_%s\".setMoveTable(%d, %d); ",
 				 stmt->hdr.script->clustername,		     
 				 stmt->tab_id, stmt->new_set_id);
-	if (db_exec_evcommand((SlonikStmt *)stmt, adminfo1, &query) < 0) {
+	if (db_exec_evcommand((SlonikStmt *) stmt, adminfo1, &query) < 0)
+	{
 		dstring_free(&query);
 		return -1;
 	}
@@ -3368,7 +3375,8 @@
 				 "select \"_%s\".setMoveSequence(%d, %d); ",
 				 stmt->hdr.script->clustername,		     
 				 stmt->seq_id, stmt->new_set_id);
-	if (db_exec_evcommand((SlonikStmt *)stmt, adminfo1, &query) < 0) {
+	if (db_exec_evcommand((SlonikStmt *) stmt, adminfo1, &query) < 0)
+	{
 		dstring_free(&query);
 		return -1;
 	}
@@ -3574,8 +3582,7 @@
 	maxxid_lock = PQgetvalue(res1, 0, 0);
 
 	/*
-	 * Now we need to commit this already and wait until
-	 * xmin is >= that xmax
+	 * Now we need to commit this already and wait until xmin is >= that xmax
 	 */
 	if (db_commit_xact((SlonikStmt *)stmt, adminfo1) < 0)
 	{
@@ -3784,8 +3791,8 @@
 		return -1;
 
 	/*
-	 * Check if the currently loaded schema has the function
-	 * slonyVersion() defined.
+	 * Check if the currently loaded schema has the function slonyVersion()
+	 * defined.
 	 */
 	dstring_init(&query);
 	slon_mkquery(&query,
@@ -3803,8 +3810,8 @@
 	if (PQntuples(res) == 0)
 	{
 		/*
-		 * No - this must be a 1.0.2 or earlier. Generate a query to
-		 * call upgradeSchema() from 1.0.2.
+		 * No - this must be a 1.0.2 or earlier. Generate a query to call
+		 * upgradeSchema() from 1.0.2.
 		 */
 		PQclear(res);
 		slon_mkquery(&query,
@@ -3897,15 +3904,15 @@
 				adminfo; adminfo = adminfo->next)
 		{
 			/*
-			 * If a specific event origin is given, skip all other
-			 * nodes last_event.
+			 * If a specific event origin is given, skip all other nodes
+			 * last_event.
 			 */
 			if (stmt->wait_origin > 0 && stmt->wait_origin != adminfo->no_id)
 				continue;
 			
 			/*
-			 * If we have not generated any event on that node, there
-			 * is nothing to wait for.
+			 * If we have not generated any event on that node, there is
+			 * nothing to wait for.
 			 */
 			if (adminfo->last_event < 0)
 				continue;
@@ -3997,8 +4004,8 @@
 	int			sign = 1;
 
 	/*
-	 * Do our own scan, rather than relying on sscanf which might be
-	 * broken for long long.
+	 * Do our own scan, rather than relying on sscanf which might be broken
+	 * for long long.
 	 */
 
 	/* skip leading spaces */
@@ -4013,8 +4020,7 @@
 
 		/*
 		 * Do an explicit check for INT64_MIN.	Ugly though this is, it's
-		 * cleaner than trying to get the loop below to handle it
-		 * portably.
+		 * cleaner than trying to get the loop below to handle it portably.
 		 */
 #ifndef INT64_IS_BUSTED
 		if (strcmp(ptr, "9223372036854775808") == 0)
Index: slony1_funcs.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lsrc/backend/slony1_funcs.c -Lsrc/backend/slony1_funcs.c -u -w -r1.27 -r1.28
--- src/backend/slony1_funcs.c
+++ src/backend/slony1_funcs.c
@@ -79,7 +79,8 @@
  *	The per-cluster data to hold for functions and triggers.
  * ----
  */
-typedef struct slony_I_cluster_status {
+typedef struct slony_I_cluster_status
+{
 	NameData		clustername;
 	char		   *clusterident;
 	int32			localNodeId;
@@ -106,7 +107,8 @@
 
 
 static Slony_I_ClusterStatus   *clusterStatusList = NULL;
-static Slony_I_ClusterStatus   *getClusterStatus(Name cluster_name,
+static Slony_I_ClusterStatus *
+getClusterStatus(Name cluster_name,
 												int need_plan_mask);
 static char					   *slon_quote_literal(char *str);
 
@@ -136,8 +138,8 @@
 		elog(ERROR, "Slony-I: SPI_connect() failed in createEvent()");
 
 	/*
-	 * Get or create the cluster status information and make sure it
-	 * has the SPI plans that we need here.
+	 * Get or create the cluster status information and make sure it has the
+	 * SPI plans that we need here.
 	 */
 	cs = getClusterStatus(PG_GETARG_NAME(0), 
 						  PLAN_NOTIFY_EVENT | PLAN_INSERT_EVENT);
@@ -160,8 +162,8 @@
 	}
 
 	/*
-	 * Build the comma separated list of transactions in progress
-	 * as Text datum.
+	 * Build the comma separated list of transactions in progress as Text
+	 * datum.
 	 */
 	*(cp = buf) = '\0';
 	for (xcnt = 0; xcnt < SerializableSnapshot->xcnt; xcnt++)
@@ -206,8 +208,8 @@
 		elog(ERROR, "Slony-I: SPI_execp() failed for \"INSERT INTO sl_event ...\"");
 
 	/*
-	 * The INSERT plan also contains a SELECT currval('sl_event_seq'),
-	 * use the new sequence number as return value.
+	 * The INSERT plan also contains a SELECT currval('sl_event_seq'), use the
+	 * new sequence number as return value.
 	 */
 	if (SPI_processed != 1)
 		elog(ERROR, "Slony-I: INSERT plan did not return 1 result row");
@@ -215,8 +217,8 @@
 			SPI_tuptable->tupdesc, 1, &isnull));
 
 	/*
-	 * For SYNC and ENABLE_SUBSCRIPTION events, we also
-	 * remember all current sequence values.
+	 * For SYNC and ENABLE_SUBSCRIPTION events, we also remember all current
+	 * sequence values.
 	 */
 	if (PG_NARGS() > 1 && !PG_ARGISNULL(1))
 	{
@@ -417,8 +419,8 @@
 	attkind = tg->tg_trigger->tgargs[2];
 
 	/*
-	 * Get or create the cluster status information and make sure it
-	 * has the SPI plans that we need here.
+	 * Get or create the cluster status information and make sure it has the
+	 * SPI plans that we need here.
 	 */
 	cs = getClusterStatus(cluster_name, PLAN_INSERT_LOG);
 
@@ -470,17 +472,17 @@
 		/*
 		 * INSERT
 		 *
-		 *	cmdtype = 'I'
-		 *	cmddata = ("non-NULL-col" [, ...]) values ('value' [, ...])
+		 * cmdtype = 'I' cmddata = ("non-NULL-col" [, ...]) values ('value' [,
+		 * ...])
 		 */
 		cmdtype = cs->cmdtype_I;
 
 		/*
-		 * Allocate an array of char pointers to hold the values.
-		 * We need to go over the tuple descriptor 2 times, first
-		 * to add the column names of non-null columns, second to
-		 * add the values. But we can identify what's NULL only by
-		 * getting the value via SPI_getvalue() in the first pass.
+		 * Allocate an array of char pointers to hold the values. We need to
+		 * go over the tuple descriptor 2 times, first to add the column names
+		 * of non-null columns, second to add the values. But we can identify
+		 * what's NULL only by getting the value via SPI_getvalue() in the
+		 * first pass.
 		 */
 		col_value = (char **)palloc(sizeof(char *) * 
 				tg->tg_relation->rd_att->natts);
@@ -507,6 +509,7 @@
 			if (cs->cmddata_size < cmddata_need)
 			{
 				int		have = (cp - (char *)(cs->cmddata_buf));
+
 				while(cs->cmddata_size < cmddata_need)
 					cs->cmddata_size *= 2;
 				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
@@ -518,7 +521,8 @@
 			else
 				need_comma = true;
 
-			memcpy(cp, col_ident, len_ident); cp += len_ident;
+			memcpy(cp, col_ident, len_ident);
+			cp += len_ident;
 		}
 
 		/*
@@ -554,6 +558,7 @@
 			if (cs->cmddata_size < cmddata_need)
 			{
 				int		have = (cp - (char *)(cs->cmddata_buf));
+
 				while(cs->cmddata_size < cmddata_need)
 					cs->cmddata_size *= 2;
 				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
@@ -565,7 +570,8 @@
 			else
 				need_comma = true;
 
-			memcpy(cp, col_value[i], len_value); cp += len_value;
+			memcpy(cp, col_value[i], len_value);
+			cp += len_value;
 		}
 
 		/*
@@ -598,9 +604,8 @@
 		/*
 		 * UPDATE
 		 *
-		 *	cmdtype = 'U'
-		 *	cmddata = "col_ident"='value' [, ...] 
-		 *             where "pk_ident" = 'value' [ and ...]
+		 * cmdtype = 'U' cmddata = "col_ident"='value' [, ...] where "pk_ident" =
+		 * 'value' [ and ...]
 		 */
 		cmdtype = cs->cmdtype_U;
 		for (i = 0; i < tg->tg_relation->rd_att->natts; i++)
@@ -621,8 +626,8 @@
 				continue;
 
 			/*
-			 * If both are NOT NULL, we need to compare the values
-			 * and skip setting the column if equal
+			 * If both are NOT NULL, we need to compare the values and skip
+			 * setting the column if equal
 			 */
 			if (!old_isnull && !new_isnull)
 			{
@@ -630,8 +635,8 @@
 				FmgrInfo   *opr_finfo_p;
 
 				/*
-				 * Lookup the equal operators function call info
-				 * using the typecache if available
+				 * Lookup the equal operators function call info using the
+				 * typecache if available
 				 */
 #ifdef HAVE_TYPCACHE
 				TypeCacheEntry *type_cache;
@@ -656,10 +661,11 @@
 					opr_finfo_p = & opr_finfo;
 				}
 #endif
+
 				/*
 				 * If we have an equal operator, use that to do binary
-				 * comparision. Else get the string representation of
-				 * both attributes and do string comparision.
+				 * comparision. Else get the string representation of both
+				 * attributes and do string comparision.
 				 */
 				if (OidIsValid(opr_oid))
 				{
@@ -694,23 +700,26 @@
 			if (cs->cmddata_size < cmddata_need)
 			{
 				int		have = (cp - (char *)(cs->cmddata_buf));
+
 				while(cs->cmddata_size < cmddata_need)
 					cs->cmddata_size *= 2;
 				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
 				cp = (char *)(cs->cmddata_buf) + have;
 			}
 			
-			memcpy(cp, col_ident, len_ident); cp += len_ident;
+			memcpy(cp, col_ident, len_ident);
+			cp += len_ident;
 			*cp++ = '=';
-			memcpy(cp, col_value, len_value); cp += len_value;
+			memcpy(cp, col_value, len_value);
+			cp += len_value;
 		}
 
 		/*
-		 * It can happen that the only UPDATE an application does is
-		 * to set a column to the same value again. In that case, we'd
-		 * end up here with no columns in the SET clause yet. We add
-		 * the first key column here with it's old value to simulate
-		 * the same for the replication engine.
+		 * It can happen that the only UPDATE an application does is to set a
+		 * column to the same value again. In that case, we'd end up here with
+		 * no columns in the SET clause yet. We add the first key column here
+		 * with it's old value to simulate the same for the replication
+		 * engine.
 		 */
 		if (!need_comma)
 		{
@@ -732,15 +741,18 @@
 			if (cs->cmddata_size < cmddata_need)
 			{
 				int		have = (cp - (char *)(cs->cmddata_buf));
+
 				while(cs->cmddata_size < cmddata_need)
 					cs->cmddata_size *= 2;
 				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
 				cp = (char *)(cs->cmddata_buf) + have;
 			}
 			
-			memcpy(cp, col_ident, len_ident); cp += len_ident;
+			memcpy(cp, col_ident, len_ident);
+			cp += len_ident;
 			*cp++ = '=';
-			memcpy(cp, col_value, len_value); cp += len_value;
+			memcpy(cp, col_value, len_value);
+			cp += len_value;
 		}
 
 		*cp++ = ' ';
@@ -771,6 +783,7 @@
 			if (cs->cmddata_size < cmddata_need)
 			{
 				int		have = (cp - (char *)(cs->cmddata_buf));
+
 				while(cs->cmddata_size < cmddata_need)
 					cs->cmddata_size *= 2;
 				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
@@ -788,9 +801,11 @@
 			else
 				need_and = true;
 
-			memcpy(cp, col_ident, len_ident); cp += len_ident;
+			memcpy(cp, col_ident, len_ident);
+			cp += len_ident;
 			*cp++ = '=';
-			memcpy(cp, col_value, len_value); cp += len_value;
+			memcpy(cp, col_value, len_value);
+			cp += len_value;
 		}
 		*cp = '\0';
 		VARATT_SIZEP(cs->cmddata_buf) = 
@@ -811,8 +826,7 @@
 		/*
 		 * DELETE
 		 *
-		 *	cmdtype = 'D'
-		 *	cmddata = "pk_ident"='value' [and ...]
+		 * cmdtype = 'D' cmddata = "pk_ident"='value' [and ...]
 		 */
 		cmdtype = cs->cmdtype_D;
 
@@ -833,6 +847,7 @@
 			if (cs->cmddata_size < cmddata_need)
 			{
 				int		have = (cp - (char *)(cs->cmddata_buf));
+
 				while(cs->cmddata_size < cmddata_need)
 					cs->cmddata_size *= 2;
 				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
@@ -850,9 +865,11 @@
 			else
 				need_and = true;
 
-			memcpy(cp, col_ident, len_ident); cp += len_ident;
+			memcpy(cp, col_ident, len_ident);
+			cp += len_ident;
 			*cp++ = '=';
-			memcpy(cp, col_value, len_value); cp += len_value;
+			memcpy(cp, col_value, len_value);
+			cp += len_value;
 		}
 		*cp = '\0';
 		VARATT_SIZEP(cs->cmddata_buf) = 
@@ -913,8 +930,8 @@
 			CStringGetDatum(tg->tg_trigger->tgargs[0])));
 
 	/*
-	 * Get or create the cluster status information and make sure it
-	 * has the SPI plans that we need here.
+	 * Get or create the cluster status information and make sure it has the
+	 * SPI plans that we need here.
 	 */
 	cs = getClusterStatus(cluster_name, PLAN_INSERT_LOG);
 
@@ -1128,8 +1145,7 @@
 				NameGetDatum(cluster_name)) == true)
 		{
 			/*
-			 * Return it if all the requested SPI plans are
-			 * prepared already.
+			 * Return it if all the requested SPI plans are prepared already.
 			 */
 			if ((cs->have_plan & need_plan_mask) == need_plan_mask)
 				return cs;
@@ -1217,10 +1233,11 @@
 		xxid_typid = typenameTypeId(xxid_typename);
 
 		plan_types[0] = INT4OID;
+
 		/*
-		 * Create the saved plan. We lock the sl_event table in exclusive
-		 * mode in order to ensure that all events are really assigned
-		 * sequence numbers in the order they get committed.
+		 * Create the saved plan. We lock the sl_event table in exclusive mode
+		 * in order to ensure that all events are really assigned sequence
+		 * numbers in the order they get committed.
 		 */
 		sprintf(query,
 			"LOCK TABLE %s.sl_event IN EXCLUSIVE MODE; "
@@ -1254,8 +1271,8 @@
 			elog(ERROR, "Slony-I: SPI_prepare() failed");
 
 		/*
-		 * Also prepare the plan to remember sequence numbers
-		 * on certain events.
+		 * Also prepare the plan to remember sequence numbers on certain
+		 * events.
 		 */
 		sprintf(query,
 			"insert into %s.sl_seqlog "
@@ -1329,8 +1346,8 @@
 			elog(ERROR, "Slony-I: SPI_prepare() failed");
 
 		/*
-		 * Also create the 3 rather static text values for
-		 * the log_cmdtype parameter and initialize the cmddata_buf.
+		 * Also create the 3 rather static text values for the log_cmdtype
+		 * parameter and initialize the cmddata_buf.
 		 */
 		cs->cmdtype_I = malloc(VARHDRSZ + 1);
 		VARATT_SIZEP(cs->cmdtype_I) = VARHDRSZ + 1;
Index: xxid.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/xxid/xxid.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lsrc/xxid/xxid.c -Lsrc/xxid/xxid.c -u -w -r1.8 -r1.9
--- src/xxid/xxid.c
+++ src/xxid/xxid.c
@@ -27,7 +27,8 @@
 #endif
 
 
-typedef struct {
+typedef struct
+{
 	int32			varsz;
 	TransactionId	xmin;
 	TransactionId	xmax;
@@ -403,5 +404,3 @@
 
 	PG_RETURN_BOOL(false);
 }
-
-


More information about the Slony1-commit mailing list