[cvs] / slony1-engine / src / slon / runtime_config.c Repository:

Log of /slony1-engine/src/slon/runtime_config.c

Parent Directory Parent Directory | View Revision Graph Revision Graph


Links to HEAD: (view) (download) (as text) (annotate)
Links to REL_1_1_0_BETA4: (view) (download) (as text) (annotate)
Sticky Tag:

Revision 1.24 - (view) (download) (as text) (annotate) - [select for diffs]
Thu Mar 10 23:11:26 2005 UTC (9 years, 1 month ago) by cbbrowne
Branch: MAIN
CVS Tags: REL_1_1_0, REL_1_1_0_BETA1, REL_1_1_0_BETA2, REL_1_1_0_BETA3, REL_1_1_0_BETA4, REL_1_1_0_BETA5, REL_1_1_0_RC1, REL_1_1_1, REL_1_1_2, REL_1_1_5_RC1, REL_1_1_5_RC2
Branch point for: REL_1_1_STABLE
Changes since 1.23: +3 -1 lines
Diff to previous 1.23 (colored)
signal handling watchdog using forked processes - Frank Thompson


Slony-I 1.1 Change Request:

	The problem at hand is related to signal handling differences
	in multithreaded programs between different operating
	systems. In the slon process, it is intended that only the
	"main" thread is dealing with signals and that it uses the
	regular thread communication like mutexes and condition
	variables to control all the other working threads.

	That mutex and condition var communication sometimes can lock
	up, which causes the entire slon daemon to freeze. This can in
	extreme cases even happen after one of the working threads
	sent the main thread a signal to restart the slon process.

	What I had in mind to fix this is to have the program to
	actually fork() very early on. The parent process will then be
	the only one dealing with signals, while the childs ignores
	all signals entirely. The parent and the master thread of the
	child (which is the current slon) will communicate over a pipe
	or a socketpair. This way, the parent could detect that the
	slon stopped responding altogether and can issue a signal 9 to
	cleanup the situation.

	In other words, building a watchdog process right into the
	slon executable.


Summary of Changes:

	slon main() will now fork() at the start and allow the parent
	process to handle cleanup, signal and termination of the child
	process.  The child process is the scheduler which will talk
	to the parent (watchdog) process and vice versa via two sets
	of socket pairs.  When shutting down the child process in the
	case of restart or termination, non blocking reads and writes
	are used to avoid lockups.  Failure to shutdown the scheduler
	process nicely, the parent will SIGKILL it to ensure timely
	operation within the signal handler.



	globals:

		slon.c
		------
		int watchdog_pipe[2];		// socket pair to talk with child process
		int	sched_wakeuppipe[2];	// socket pair to talk with scheduler and parent process

		runtime_config.c
		----------------
		pid_t slon_pid;				// current pid
		pid_t slon_ppid;			// parent pid
		pid_t slon_cpid;			// child pid

	macros:

		slon_abort() and slon_restart() will now observe which process
		in the tree they will act upon, parent or child

		#define slon_abort() \
		do { \
			kill((slon_ppid == 0 ? slon_pid : slon_ppid), SIGTERM); \
			pthread_exit(NULL); \
		} while (0)
		#define slon_restart() \
		do { \
			kill((slon_ppid == 0 ? slon_pid : slon_ppid), SIGHUP); \
		} while (0)

	functions:

		slon.c
		------
		static void sighandler(int signo);				// new slon parent process signal handler
		static void main_sigalrmhandler(int signo);		// new scheduler alarm signal handler
		static void slon_kill_child(void);				// new pipe notify based child termination function

Revision 1.23 - (view) (download) (as text) (annotate) - [select for diffs]
Wed Jan 12 17:27:11 2005 UTC (9 years, 3 months ago) by darcyb
Branch: MAIN
Changes since 1.22: +241 -230 lines
Diff to previous 1.22 (colored)
pgindent run

Revision 1.22 - (view) (download) (as text) (annotate) - [select for diffs]
Sat Nov 13 04:52:47 2004 UTC (9 years, 5 months ago) by wieck
Branch: MAIN
Changes since 1.21: +67 -1 lines
Diff to previous 1.21 (colored)
Here is a first full functional and activated rebuiltListenEntries().
Any change to sl_node, sl_path and sl_subscribe causes slon to reload
the listen configuration. The logic is slightly different from what
was first discussed and probably not in its final state. But it passes
various configurations without any need to restart slon.

Jan

Revision 1.21 - (view) (download) (as text) (annotate) - [select for diffs]
Wed Sep 29 22:15:23 2004 UTC (9 years, 6 months ago) by cbbrowne
Branch: MAIN
Changes since 1.20: +9 -2 lines
Diff to previous 1.20 (colored)
Implement SET DROP TABLE and SET DROP SEQUENCE.

1.  This adds to the slonik grammar
2.  This adds setdropsequence/setdroptable functions to
    the stored function repository
3.  This adds the SET_DROP_SEQUENCE and SET_DROP_TABLE events
    to those that need to be supported by slon.
4.  Documentation has been updated to reference the new
    functions and syntax.

Revision 1.20 - (view) (download) (as text) (annotate) - [select for diffs]
Fri Sep 24 22:12:36 2004 UTC (9 years, 6 months ago) by darcyb
Branch: MAIN
Changes since 1.19: +278 -309 lines
Diff to previous 1.19 (colored)
add syslog support, pid file writing and other bells

Revision 1.19 - (view) (download) (as text) (annotate) - [select for diffs]
Thu May 20 17:50:34 2004 UTC (9 years, 11 months ago) by wieck
Branch: MAIN
CVS Tags: REL_1_0_0, REL_1_0_0_BETA1, REL_1_0_0_BETA2, REL_1_0_0_BETA3, REL_1_0_0_RC1, REL_1_0_1, REL_1_0_2
Branch point for: REL_1_0_STABLE
Changes since 1.18: +36 -1 lines
Diff to previous 1.18 (colored)
Added DROP_SET and MERGE_SET with all required functionality.

Jan

Revision 1.18 - (view) (download) (as text) (annotate) - [select for diffs]
Tue Apr 13 20:00:20 2004 UTC (10 years ago) by wieck
Branch: MAIN
Changes since 1.17: +13 -5 lines
Diff to previous 1.17 (colored)
First time failover really worked.

Jan

Revision 1.17 - (view) (download) (as text) (annotate) - [select for diffs]
Tue Mar 23 12:38:56 2004 UTC (10 years ago) by wieck
Branch: MAIN
Changes since 1.16: +31 -4 lines
Diff to previous 1.16 (colored)
Implemented DROP_NODE and server side of the node uninstall.

Jan

Revision 1.16 - (view) (download) (as text) (annotate) - [select for diffs]
Sat Mar 20 02:25:47 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.15: +41 -1 lines
Diff to previous 1.15 (colored)
Added UNSUBSCRIBE_SET command.

Jan

Revision 1.15 - (view) (download) (as text) (annotate) - [select for diffs]
Wed Mar 17 22:35:19 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.14: +49 -1 lines
Diff to previous 1.14 (colored)
First part of MOVE_SET. We need another step that first disables
updates to the set on the origin. Otherwise we lose the transactions
that are in progress when moveSet() is called on the origin. They
become visible AFTER the sync created by moveSet(), and therefore
never get replicated.

Jan

Revision 1.14 - (view) (download) (as text) (annotate) - [select for diffs]
Mon Mar 15 20:08:10 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.13: +59 -1 lines
Diff to previous 1.13 (colored)
Implemented DROP_PATH

Jan

Revision 1.13 - (view) (download) (as text) (annotate) - [select for diffs]
Wed Mar 10 20:50:57 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
CVS Tags: Sample1
Changes since 1.12: +67 -5 lines
Diff to previous 1.12 (colored)
Implemented DROP LISTEN event and enhanced or fixed the
system so that a provider change for a subscribed set can
be done on the fly.

Jan

Revision 1.12 - (view) (download) (as text) (annotate) - [select for diffs]
Tue Mar 2 13:29:55 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)
Added PG 7.4.1's scanint8() function slightly modified and use
the INT64_FORMAT from pg_config.h for [s]printf().

Jan

Revision 1.11 - (view) (download) (as text) (annotate) - [select for diffs]
Sat Feb 28 04:16:10 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)
Fixed cascaded replication. The system is now capable of
hot install, hot subscribe and catch up, including cascaded
slaves.

Jan

Revision 1.10 - (view) (download) (as text) (annotate) - [select for diffs]
Fri Feb 27 16:57:54 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)
Cleanup of some logging levels.

Fixed remote worker to adjust configuration at subscription time
to catch up.

System can now hot join and replicate.

Jan

Revision 1.9 - (view) (download) (as text) (annotate) - [select for diffs]
Thu Feb 26 22:27:00 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.8: +14 -4 lines
Diff to previous 1.8 (colored)
Replicated some data ... not sure yet if everything was
consistent.

Jan

Revision 1.8 - (view) (download) (as text) (annotate) - [select for diffs]
Wed Feb 25 19:47:37 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.7: +15 -4 lines
Diff to previous 1.7 (colored)
Implemented SUBSCRIBE_SET and ENABLE_SUBSCRIPTION. Slon can now
subscribe to a set and copy over the initial data.

Jan

Revision 1.7 - (view) (download) (as text) (annotate) - [select for diffs]
Tue Feb 24 21:03:34 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.6: +61 -45 lines
Diff to previous 1.6 (colored)
Changed all printf()'s into slon_log calls and implemented
a rudimentary first version of that.

Jan

Revision 1.6 - (view) (download) (as text) (annotate) - [select for diffs]
Tue Feb 24 16:51:21 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.5: +69 -6 lines
Diff to previous 1.5 (colored)
Added the remote worker thread. The slon engine is now capable of
processing a few, simple configuration events, including event forwarding,
confirmation and cleanup.

Jan

Revision 1.5 - (view) (download) (as text) (annotate) - [select for diffs]
Sun Feb 22 23:53:25 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.4: +65 -21 lines
Diff to previous 1.4 (colored)
Macro cleanups and out of memory checking.

Jan

Revision 1.4 - (view) (download) (as text) (annotate) - [select for diffs]
Sun Feb 22 15:15:32 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.3: +40 -9 lines
Diff to previous 1.3 (colored)
Join all remote listen threads at shutdown

Revision 1.3 - (view) (download) (as text) (annotate) - [select for diffs]
Sun Feb 22 03:10:48 2004 UTC (10 years, 1 month ago) by wieck
Branch: MAIN
Changes since 1.2: +157 -53 lines
Diff to previous 1.2 (colored)
Changed slon.c to use slon_mkquery().

Added remote listen thead, listening and receiving for remote
events.

TODO: Add remote worker and default worker, message queue from
      listener to worker and processing events.

	  Retrieve and forward confirmations.

Jan

Revision 1.2 - (view) (download) (as text) (annotate) - [select for diffs]
Fri Feb 20 15:13:28 2004 UTC (10 years, 2 months ago) by wieck
Branch: MAIN
Changes since 1.1: +63 -27 lines
Diff to previous 1.1 (colored)
Adjusted copyright notice to 2004 and added some functionality in
runtime configuration processing.

Jan

Revision 1.1 - (view) (download) (as text) (annotate) - [select for diffs]
Thu Jan 22 21:26:51 2004 UTC (10 years, 2 months ago) by wieck
Branch: MAIN
Started restructuring the thread model according to
the implementation doc

Jan

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

ViewVC Help
Powered by ViewVC 1.0.3