Commit Graph

86 Commits

Author SHA1 Message Date
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
Dan Farina
29c39c21f6 Avoid a use-after-free in verbose logging (again)
Previously, this print would use memory freed by PQClear previously.

Also allocate/free memory to prevent this tiny memory leak.

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-22 20:10:15 -08:00
Dan Farina
620974ba04 Fix unsafe string handling
It looks like the old code would overflow in some cases.

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-22 19:00:21 -08:00
Dan Farina
faddaed316 Avoid a use-after-free in verbose logging
Previously, this print would use memory freed by PQClear previously.

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-22 15:03:05 -08: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
ec73a07e2f Make various buffers larger
MAXLEN definitely needed to be bigger to properly format fairly common
connection strings.  In addition, the reliance on xsnprintf helps
detect cases where even this buffer is not long enough.

the buffer in parse_config has been made bigger in a bit of sloppy
programming, but what really needs to happen is reporting when a line
cannot be properly parsed/is too big for the buffer.  That is just a
kludge.

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
fc13d50e37 Canonicalize whitespace
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
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
6cea339697 Fix a use-after-free
A result is being cleared while there are still pointers that
refer to datums in it.

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
846c0b92e8 Install install/uninstall SQL also.
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
778303bb6e Split up install/uninstall actions more like a standard contrib
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
f2bec9a08f Some cosmetic changes 2010-12-16 22:31:26 +01:00
Gabriele Bartolini
05e88a2cc8 removed strncmp improper usage, initialise values asap 2010-12-16 22:21:27 +01:00
Gabriele Bartolini
763a1e8b3d Reviewed the code, fixed a small bug with option name detection 2010-12-16 22:14:18 +01:00
Gabriele Bartolini
c687d0d670 Reviewed the code, fixed a small bug with option name detection 2010-12-16 22:13:30 +01:00
Greg Smith
56c65acd99 Add force option to help and docs on help 2010-12-06 00:33:02 -05:00
Greg Smith
9c238f64c3 Update docs: requirements, walkthrough setup, copyediting v1.0.0 2010-12-05 21:09:48 -05:00
Greg Smith
046d3b6851 Correct log message formatting 2010-12-05 19:54:56 -05:00
Greg Smith
8d84d165ef Update README with Robert's walkthrough 2010-11-22 15:20:31 -05:00
Jaime Casanova
6c484409bb Added a --wal-keep-segments parameter which is the minimum value that the
PostgreSQL's GUC wal_keep_segments should have for "standby clone" to work
reliable. We default to 5000 but it could be changed for the user if it
knows what he is doing.
2010-11-19 08:36:15 -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
Greg Smith
3172ad97cf Add rsync remote user name option. Expand docs to
include command line help examples.
2010-11-08 15:29:53 -05:00
Greg Smith
2082a6acd4 Cleanup ReST code in README so PDF builds work 2010-10-30 16:41:55 -04:00
Greg Smith
a0bd377f0f Add RPM build against packaged install notes 2010-10-30 16:25:19 -04:00
Greg Smith
0cd21c3bdc Add intro to lag monitoring to the docs 2010-10-30 14:31:58 -04:00
Greg Smith
915eae9c12 Merged INSTALL into README.rst 2010-10-30 14:20:25 -04:00
Greg Smith
77dce1d456 Converted license to the GPL V3 2010-10-30 13:56:40 -04:00
Greg Smith
942ed7b518 Add default makefile target. Document building
with PGXS.  Convert README to be a .rst file, and
make it and INSTALL valid ReST markup in advance
of merging the two.
2010-10-29 15:13:23 -04:00
Jaime Casanova
58498389dc Temporarily remove the check if promote actually works, because
when the database is taking too long to recover and start it thinks
the database is not online.
2010-10-28 18:47:56 -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
a70a6d2912 Really fix STANDBY FOLLOW this time. 2010-10-24 19:20:25 -05:00
Jaime Casanova
f45aa077b1 Add message to remember we should REINDEX any hash indexes, i decided
not to do it myself because it could take a long time if the index is
big.
2010-10-23 20:44:05 -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
91276394e8 Check STANDBY PROMOTE actually promote the node 2010-10-23 19:54:45 -05:00
Jaime Casanova
028aeb452d Fix STANDBY FOLLOW to correctly recreate recovery.conf 2010-10-23 19:44:07 -05:00
Jaime Casanova
ed3038ef6b Fix a few typos in my last commit 2010-10-23 15:51:08 -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
8409727f0c A few more comments 2010-10-22 18:41:31 -05:00
Jaime Casanova
45fdbbb426 Another segmentation fault caused by an uninitialized string 2010-10-22 18:38:35 -05:00
Jaime Casanova
d0650fe199 Fix a segmentation fault that was happening in STANDBY PROMOTE and
STANDBY FOLLOW because getMasterConnection() was trying to close
a non existent connection
2010-10-22 14:27:15 -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
7ddc80ea92 I was having a segmentation fault because i was using a pointer to char
but never indicated a size for the compiler to reserve... malloc()
solves my problem
2010-10-21 14:49:26 -05:00
Jaime Casanova
c3595ad89e Specify that we can use -f option to indicate where the repmgr.conf
is
2010-10-21 01:15:21 -05:00