Commit Graph

255 Commits

Author SHA1 Message Date
trbs cc0c516810 added new lines to log messages 2011-03-03 09:21:38 -05:00
Greg Smith bf0bbd747b Fix typos in some logging messages 2011-02-24 19:05:03 -05:00
Greg Smith 459f14b594 Document repmgrd's role on each type of node. Add
logging (when run in verbose mode) showing what
decisions repmgrd is making after it determines
what type of node it is.
2011-02-24 18:58:03 -05:00
Greg Smith f928edf897 Improve parameter validation, logging, and error
handling in repmgrd
2011-02-24 18:13:16 -05:00
Greg Smith fee7da1ba7 Fix cast on WAL lag computation to (long long) 2011-02-22 07:43:02 -05:00
Greg Smith f6618a01c7 Post-merge astyle run 2011-02-15 00:14:13 -05:00
Greg Smith 20af4ffc2c Merge commit '3ef1fa126d9c9b9ba3b29deab7f67218cdf7ce10'
Conflicts:
	.gitignore
	Makefile
	README.rst
	check_dir.c
	config.c
	config.h
	dbutils.h
	repmgr.c
	repmgr.conf
	repmgr.h
	repmgrd.c
2011-02-15 00:06:01 -05:00
Greg Smith 3ef1fa126d astyle run against Heroku code 2011-02-14 21:51:14 -05:00
Greg Smith 0130420947 astyle cleanup run after recent merges 2011-02-10 18:55:51 -05:00
Greg Smith 1d32133d49 Update all the copyrights to add 2011 2011-02-10 18:33:02 -05:00
Greg Smith 1be62fa6b2 Fix use of "options" broken by recent merging 2011-02-10 18:26:44 -05:00
Charles Duffy b62ad056f1 repmgrd: log restored connection only after a break 2011-02-10 17:57:13 -05:00
Greg Smith ec30caef0f Merge commit '78b925ea54bb7a131e97c2f5d0a63f54ca58e26f' 2011-02-10 17:52:50 -05:00
Greg Smith 78b925ea54 Unify use of error codes across all exit statements 2011-02-10 17:49:34 -05:00
Charles Duffy 657aa3013b avoid double free on repmgrd exit as master 2011-02-10 16:40:00 -05:00
Gabriele Bartolini 3f1c6a5852 Removed any sprintf/strcpy call and use snprintf/strncpy - Fixed bug with tblspc_dir - added debug messages after every query 2011-02-10 16:08:07 -05:00
Gabriele Bartolini 716a0ae9d3 removed any malloc operation, added t_runtime_options struct 2011-02-10 16:05:03 -05:00
Gabriele Bartolini f6a6632169 Added new log system to both repmgr and repmgrd. Needs cleaning, but it is a good starting point 2011-02-10 15:58:55 -05:00
Gabriele Bartolini 2c1eafd7a9 first alpha version for syslog support 2011-02-10 15:56:10 -05:00
trbs 814863edf2 use struct for config file information 2011-02-10 15:06:09 -05:00
Dan Farina bfd3aed33b Fix a myriad of problems introduced by merging
Signed-off-by: Dan Farina <drfarina@acm.org>
2011-02-06 18:32:49 -08:00
Dan Farina c356f9e97f Merge remote-tracking branch 'tbrs/master' into heroku
Grab the configuration struct changes. It was expeditious to un-do
some of my by-hand line-wrapping that avoids 80 character limit,
though.

Conflicts:
	config.c
	config.h
	repmgr.c
	repmgr.h
	repmgrd.c
2011-02-04 18:35:56 -08:00
Dan Farina a52ebc412c Merge remote-tracking branch 'origin/master' into heroku
The Great Whitespace Reconciliation

Conflicts:
	check_dir.c
	config.c
	dbutils.c
	repmgr.c
	repmgr.h
	repmgrd.c

Signed-off-by: Dan Farina <drfarina@acm.org>
2011-02-04 18:27:28 -08:00
trbs fc2405f17d use struct for config file information 2011-01-07 01:36:46 +01:00
Jaime Casanova 170f519d84 Fixing a message, shouldn't show progname in the middle of a line.
Is one message not two.
2010-12-29 00:45:33 -05:00
Dan Farina f969dca821 Hack to get passwords in recovery.conf
Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-22 20:10:32 -08:00
Greg Smith 9843205a4f Reformat all source code using astyle
astyle --style=ansi --indent=tab
2010-12-22 19:07:01 -05:00
Greg Smith 1ddb78ddd8 Merge branch 'license' of https://github.com/gbartolini/repmgr into gbartolini-license 2010-12-22 19:02:50 -05:00
Dan Farina 7b0a142075 Merge remote branch 'gbartolini/gabriele-2010-12' into heroku
Conflicts:
	config.c
	dbutils.c
	dbutils.h
	repmgrd.c

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-21 16:08:07 -08:00
Dan Farina 309bb92d95 Prevent a double-free
This can occur because prior to this, there is a code path that looks
like this:

    primaryConn = myLocalConn

CloseConnections will subsequently try to free both with PQFinish.
I'm not sure if this is the right fix -- it's more of hack -- without
more information about design intention.

One reasonable alternative would be to have CloseConnections perform
this check itself. As-is I am pretty sure that this fix leaves a
signal-race (when CloseConnections is called, without the check, in
the interrupt handler) unfixed.

Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
2010-12-21 15:19:28 -08:00
Dan Farina 3f2094a242 Initialize connection pointers to NULL
This makes some bugs easier to find.

Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
2010-12-21 15:19:28 -08:00
Dan Farina 84b69b3bd4 Whitespace to adjust for longer snprintf identifier
This is done in a separate patch to try and reduce the sound and fury
of the patch that actually did the conversion from sprintf to
snprintf-alikes.

Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
2010-12-21 15:19:28 -08:00
Dan Farina 916c0492fb sprintf to snprintf conversion
Move out string operations to another file, and introduce a frontend
to snprintf for various situations.  This change is important for
catching and eliminating sprintf overflows, which are as of now many
times silently corrupting memory.

Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
2010-12-21 15:19:28 -08:00
Dan Farina af2edf10a0 Attack of whitespace pedantry
pgsql conventions (tabs, four-spaces-wide, etc) applied all around.

Also tried to fix some very tiny capitalization errors, auto-fill
problems, and some inter-block vertical whitespacing issues.

Long strings in repmgr.c were left intact, though. They are rather
numerous and are less of a problem than tiny bits of function calls
and comments wrapping over a line; the latter kind of problem has been
mostly fixed.

Signed-off-by: Dan Farina <drfarina@acm.org>
Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
2010-12-21 15:19:28 -08:00
Gabriele Bartolini d88783a4d9 Changed pg_version() prototype in order to remove the small memory leak 2010-12-16 22:48:19 +01:00
Gabriele Bartolini 9b7a078e0e Added license information in every source file 2010-12-16 21:50:15 +01:00
Greg Smith 046d3b6851 Correct log message formatting 2010-12-05 19:54:56 -05:00
Jaime Casanova b4d6966283 After 30 minutes of retry we are supposed to exit, so do that... 2010-11-10 13:41:05 -05:00
Jaime Casanova 3565fe1c3a Implement Martin's suggestion about how much we should try to
recover the connection instead of doing whatever a want.
2010-11-10 13:30:50 -05:00
Jaime Casanova d9eee72bf0 Make repmgrd retry connection to current master 3 times (every 5 min),
then try to get a new master 30 times (every 10 min) before exit.
It's not retrying forever because after some attempts it gives an
error of multiple files opened.
2010-11-10 13:13:53 -05:00
Jaime Casanova 508acf5931 Fix segmentation fault caused when trying to close a lost connection. 2010-10-28 08:24:06 -05:00
Jaime Casanova 4641ddcc3f Teach repmgrd that if the node is promoted it should exit 2010-10-23 20:19:09 -05:00
Jaime Casanova 219b4431b4 Replace the function is_supported_version() with the function pg_version()
the main difference is that this new function doesn't return a bool but
a string representing the current major version of the postgresql server
or an empty string if it's earlier than 9.0.
Teach all commands that could connect to master and standby that they
both should have the same major version.
2010-10-23 15:27:24 -05:00
Jaime Casanova e3d1580d76 In repmgrd there was the same problem that cause the segfault 2010-10-21 17:58:38 -05:00
Jaime Casanova 14ae59c6b2 Add a function that checks the parameters based on the action.
Refactor some actions and use repl_nodes to get connections to
master.
2010-10-21 00:48:04 -05:00
Jaime Casanova cd287f923a I failed to add the schema "repmgr_%s" in all places where the repl_*
tables are used.
2010-10-18 09:34:14 -05:00
Jaime Casanova 378bdd7bd4 Add MASTER REGISTER and STANDBY REGISTER commands. 2010-10-18 02:21:55 -05:00
Jaime Casanova 61687855bb improve documentation, also add CREATE DATABASE and CREATE USER
commands to repmgr.sql
2010-10-03 17:11:56 -05:00
Jaime Casanova d1d1232bef Add signals to repmgrd and teach it to clean things up when
signaled before exit
2010-10-03 15:52:49 -05:00
Jaime Casanova 5cd9e3957c A few changes from repmgrd and improve the SQL of the repl_status
view in order to actually show something useful
2010-10-01 14:44:08 -05:00