Commit Graph

62 Commits

Author SHA1 Message Date
Daniel Farina
da82829659 Avoid checking config file when performing standby clone action
Signed-off-by: Daniel Farina <daniel@heroku.com>
2011-02-10 02:10:58 -08:00
Dan Farina
ebbb7c3a47 Fix more quoting: used an overly-quoted copy
Signed-off-by: Dan Farina <daniel@heroku.com>
2011-02-07 03:59:18 -08:00
Dan Farina
630d716819 Use the proper freeing method
As according to
http://www.postgresql.org/docs/9.0/static/libpq-exec.html#LIBPQ-EXEC-ESCAPE-STRING

Signed-off-by: Dan Farina <daniel@heroku.com>
2011-02-07 03:59:18 -08:00
Dan Farina
c1b84fe9fc Make some fast hacks to quote schema names
Signed-off-by: Dan Farina <drfarina@acm.org>
2011-02-07 03:59:18 -08: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
57169f51cf made rsync_options configurable 2011-01-08 01:46:39 +01:00
trbs
fc2405f17d use struct for config file information 2011-01-07 01:36:46 +01:00
trbs
cb1192b912 fix strformat order reversal in error message 2010-12-23 15:02:02 +01:00
Dan Farina
156714f3f1 Fix quoting misbehavior
Move the single quote in the formatting string to the end of the line.

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-23 01:04:05 -08:00
Dan Farina
dd5ac660bf Comments and cleanup
Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-23 00:55:39 -08:00
Dan Farina
3a430397dc Avoid overwriting the new password-in-recovery.conf formatting
Previously: did that work, then threw it away/overwrote it.

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-23 00:55:39 -08:00
Dan Farina
1f098c60ac Remove dead-ish code
This is a leftover after having fixed various problems in the verbose
output here.

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-23 00:55:39 -08:00
Dan Farina
0bae682a0d Fix off-by-one in passing buffer size to xsnprintf
This would cause a consistent panic (exit() call) without reason.
This should not enable any overruns (but check my work).

Signed-off-by: Dan Farina <drfarina@acm.org>
2010-12-23 00:55:32 -08: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
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
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
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
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
56c65acd99 Add force option to help and docs on help 2010-12-06 00:33:02 -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
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
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
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
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
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
ff511f19b4 Remove the second --port parameter, we now use repmgr.conf for get
conninfo of the standby
2010-10-21 01:04:23 -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
6779a96b0b The short option for --force is now -F, because i will use the other
to indicate a config file. also for simetry with repmgrd
2010-10-13 14:54:09 -05:00
Jaime Casanova
7dce793882 Add a --force option to upgrade an existing PostgreSQL instalation.
This could be useful, for readding recently failed nodes.
2010-10-08 02:55:52 -05:00
Jaime Casanova
d42f3e25f4 Fix a typo in the last commit that show the right directory in error messages 2010-10-07 00:29:10 -05:00
Jaime Casanova
f5e95dd46a Exclude pid files from standby clone 2010-10-06 01:04:30 -05:00
Jaime Casanova
172caf8968 When the directory for a tablespace cannot be created or exists
but is not empty, it was sending the message using dest_dir instead.
2010-10-05 21:20:20 -05:00