Chris Browne cbbrowne at lists.slony.info
Wed May 28 12:09:39 PDT 2008
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv20058

Modified Files:
	cleanup_thread.c remote_listen.c remote_worker.c scheduler.c 
	slon.h 
Log Message:
Changed a number of #defined lists of values to use enum; this permits
a bit more static validation of the C code.


Index: scheduler.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/scheduler.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** scheduler.c	27 Oct 2006 20:10:57 -0000	1.25
--- scheduler.c	28 May 2008 19:09:37 -0000	1.26
***************
*** 38,42 ****
   * ----------
   */
! static int	sched_status = SCHED_STATUS_OK;
  
  static int	sched_numfd = 0;
--- 38,42 ----
   * ----------
   */
! static ScheduleStatus	sched_status = SCHED_STATUS_OK;
  
  static int	sched_numfd = 0;
***************
*** 191,195 ****
  sched_wait_conn(SlonConn * conn, int condition)
  {
! 	int			rc;
  
  	/*
--- 191,195 ----
  sched_wait_conn(SlonConn * conn, int condition)
  {
! 	ScheduleStatus			rc;
  
  	/*
***************
*** 314,318 ****
  sched_get_status(void)
  {
! 	int			status;
  
  	pthread_mutex_lock(&sched_master_lock);
--- 314,318 ----
  sched_get_status(void)
  {
! 	ScheduleStatus			status;
  
  	pthread_mutex_lock(&sched_master_lock);

Index: slon.h
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/slon.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** slon.h	6 Feb 2008 18:04:02 -0000	1.67
--- slon.h	28 May 2008 19:09:37 -0000	1.68
***************
*** 313,321 ****
   * ----------
   */
! #define SCHED_STATUS_OK			0
! #define SCHED_STATUS_SHUTDOWN	1
! #define SCHED_STATUS_DONE		2
! #define SCHED_STATUS_CANCEL		3
! #define SCHED_STATUS_ERROR		4
  
  /* ----------
--- 313,324 ----
   * ----------
   */
! typedef enum
! {
! 		SCHED_STATUS_OK,
! 		SCHED_STATUS_SHUTDOWN,
! 		SCHED_STATUS_DONE,
! 		SCHED_STATUS_CANCEL,
! 		SCHED_STATUS_ERROR
! } ScheduleStatus;
  
  /* ----------

Index: cleanup_thread.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/cleanup_thread.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** cleanup_thread.c	23 Apr 2008 20:35:43 -0000	1.44
--- cleanup_thread.c	28 May 2008 19:09:37 -0000	1.45
***************
*** 106,113 ****
  	 * Loop until shutdown time arrived
  	 *
! 	 * Note the introduction of vac_bias and an up-to-100s random "fuzz"; this
! 	 * reduces the likelihood that having multiple slons hitting the same
! 	 * cluster will run into conflicts due to trying to vacuum pg_listener
! 	 * concurrently
  	 */
  	while (sched_wait_time(conn, SCHED_WAIT_SOCK_READ, SLON_CLEANUP_SLEEP * 1000 + vac_bias + (rand() % (SLON_CLEANUP_SLEEP * 166))) == SCHED_STATUS_OK)
--- 106,113 ----
  	 * Loop until shutdown time arrived
  	 *
! 	 * Note the introduction of vac_bias and an up-to-100s random
! 	 * "fuzz"; this reduces the likelihood that having multiple slons
! 	 * hitting the same cluster will run into conflicts due to trying
! 	 * to vacuum common tables * such as pg_listener concurrently
  	 */
  	while (sched_wait_time(conn, SCHED_WAIT_SOCK_READ, SLON_CLEANUP_SLEEP * 1000 + vac_bias + (rand() % (SLON_CLEANUP_SLEEP * 166))) == SCHED_STATUS_OK)

Index: remote_listen.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_listen.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** remote_listen.c	26 May 2008 21:09:48 -0000	1.45
--- remote_listen.c	28 May 2008 19:09:37 -0000	1.46
***************
*** 77,81 ****
  	char	   *conn_conninfo = NULL;
  	char		conn_symname[64];
! 	int			rc;
  	SlonDString query1;
  	PGconn	   *dbconn = NULL;
--- 77,81 ----
  	char	   *conn_conninfo = NULL;
  	char		conn_symname[64];
! 	ScheduleStatus			rc;
  	SlonDString query1;
  	PGconn	   *dbconn = NULL;
***************
*** 743,748 ****
  					slon_log(SLON_INFO, "remoteListenThread_%d: drew maximum # of events for %d iterations\n",
  							 node->no_id, sel_max_events);
- 					slon_log(SLON_INFO, "remoteListenThread_%d: sleep %ds, return to LISTEN mode\n",
- 							 node->no_id, 10+sel_max_events);
  					sched_msleep(node, 10000 + (1000 * sel_max_events));
  			} else {
--- 743,746 ----

Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -C2 -d -r1.169 -r1.170
*** remote_worker.c	26 May 2008 21:09:48 -0000	1.169
--- remote_worker.c	28 May 2008 19:09:37 -0000	1.170
***************
*** 38,44 ****
   * Internal message types
   */
! #define WMSG_EVENT		0
! #define WMSG_WAKEUP		1
! #define WMSG_CONFIRM	2
  
  
--- 38,47 ----
   * Internal message types
   */
! typedef enum
! {
! 		WMSG_EVENT,
! 		WMSG_WAKEUP,
! 		WMSG_CONFIRM
! } MessageType;
  
  
***************
*** 49,53 ****
  struct SlonWorkMsg_event_s
  {
! 	int			msg_type;
  	SlonWorkMsg_event *prev;
  	SlonWorkMsg_event *next;
--- 52,56 ----
  struct SlonWorkMsg_event_s
  {
! 	MessageType			msg_type;
  	SlonWorkMsg_event *prev;
  	SlonWorkMsg_event *next;
***************
*** 80,84 ****
  struct SlonWorkMsg_confirm_s
  {
! 	int			msg_type;
  	SlonWorkMsg_confirm *prev;
  	SlonWorkMsg_confirm *next;
--- 83,87 ----
  struct SlonWorkMsg_confirm_s
  {
! 	MessageType			msg_type;
  	SlonWorkMsg_confirm *prev;
  	SlonWorkMsg_confirm *next;
***************
*** 96,100 ****
  struct SlonWorkMsg_s
  {
! 	int			msg_type;
  	SlonWorkMsg *prev;
  	SlonWorkMsg *next;
--- 99,103 ----
  struct SlonWorkMsg_s
  {
! 	MessageType			msg_type;
  	SlonWorkMsg *prev;
  	SlonWorkMsg *next;
***************
*** 521,525 ****
  
  			int			seconds;
! 			int			rc;
  			int			i;
  
--- 524,528 ----
  
  			int			seconds;
! 			ScheduleStatus			rc;
  			int			i;
  
***************
*** 1149,1153 ****
  					event->ev_origin == node->no_id)
  				{
! 					int			sched_rc;
  					int			sleeptime = 15;
  
--- 1152,1156 ----
  					event->ev_origin == node->no_id)
  				{
! 					ScheduleStatus			sched_rc;
  					int			sleeptime = 15;
  
***************
*** 5335,5342 ****
   */
  
! #define START_STATE 1
! #define COLLECTING_DIGITS 2
! #define BETWEEN_NUMBERS 3
! #define DONE 4
  
  #define MINMAXINITIAL -1
--- 5338,5348 ----
   */
  
! typedef enum
! {
! 		START_STATE,
! 		COLLECTING_DIGITS,
! 		BETWEEN_NUMBERS,
! 		DONE
! } CompressState;
  
  #define MINMAXINITIAL -1
***************
*** 5349,5353 ****
  compress_actionseq(const char *ssy_actionlist, SlonDString *action_subquery)
  {
! 	int			state;
  	int			curr_number,
  				curr_min,
--- 5355,5359 ----
  compress_actionseq(const char *ssy_actionlist, SlonDString *action_subquery)
  {
! 	CompressState			state;
  	int			curr_number,
  				curr_min,



More information about the Slony1-commit mailing list