Commit Graph

35 Commits

Author SHA1 Message Date
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
Jaime Casanova
3b8e8183cc Changes when trying to compile:
- Fix Makefile to include check_dir.c
- Add function mkdir_p that was taken from initdb.c
- Replace some strcpy for assignment to const char * to keep compiler quite
- Add STANDBY_NORMAL to initialize action
- fix typos and add headers needed to compile
2010-09-29 05:13:23 -05:00
Jaime Casanova
ae628d0527 Changes in repmgr are:
- Add checks to test if the directories are useful for us (basically
  the checks follow the same approach as initdb does)
- Add connection parameters
- Better use of rsync
- Some more clean up of code

Changes in repmgrd are:
- Add a parameter to allow the user specify an repmgr.conf
- Change the name of the repl_status table for repl_monitor
- Create a repl_status view that also shows lag in time
- Some more clean up of code
2010-09-28 17:28:56 -05:00
postgres
93417715d4 Add docs, fix Makefile and fix some bugs and typos 2010-09-17 07:14:52 -05:00
postgres
707c501b24 Add repmgr client command. 2010-09-15 15:38:54 -05:00
postgres
98d7471d15 Change the name from repmgr to repmgrd. this is a daemon
that will do the monitoring.
2010-09-14 20:42:28 -05:00