Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of git://github.com/greg2ndQuadrant/repmgr

  • Loading branch information...
commit f6b062d4619edb54e26f3e626512571e3bfbbdd3 2 parents 10b89e1 + f824189
@trbs trbs authored
View
57 HISTORY
@@ -1,24 +1,35 @@
-1.0.0 2010-12-05 First public release
+1.0.0 2010-12-05
+ First public release
-1.1.0 2011-02-XX Fix missing "--force" option in help (Greg Smith)
- Correct warning message for wal_keep_segments (Bas van Oostveen)
- Add Debian build/usage docs (Bas, Hannu Krosing, Cedric Villemain)
- Add Debian .deb packaging (Hannu)
- Move configuration data into a structure (Bas, Gabriele Bartolini)
- Make rsync options configurable (Bas)
- Add syslog as alternate logging destination (Gabriele)
- Change from using malloc to static memory allocations (Gabriele)
- Add debugging messages after every query (Gabriele)
- Parameterize schema name used for repmgr (Gabriele)
- Avoid buffer overruns by using snprintf etc. (Gabriele)
- Fix use of database query after close (Gabriele)
- Add information about progress during "standby clone" (Gabriele)
- Fix double free error in repmgrd (Charles Duffy)
- Make repmgr exit with an error code when encountering an error (Charles)
- Standardize on error return codes, use in repmgrd too (Greg)
- Add [un]install actions/SQL like most contrib modules (Daniel Farina)
- Wrap all string construction and produce error on overflow (Daniel)
- Correct freeing of memory from first_wal_segment (Daniel)
- Allow creating recovery.conf file with a password (Daniel)
- Inform when STANDBY CLONE sees an unused config file (Daniel)
- Use 64-bit computation for WAL apply_lag (Greg)
+1.1.0b1 2011-02-24
+ Fix missing "--force" option in help (Greg Smith)
+ Correct warning message for wal_keep_segments (Bas van Oostveen)
+ Add Debian build/usage docs (Bas, Hannu Krosing, Cedric Villemain)
+ Add Debian .deb packaging (Hannu)
+ Move configuration data into a structure (Bas, Gabriele Bartolini)
+ Make rsync options configurable (Bas)
+ Add syslog as alternate logging destination (Gabriele)
+ Change from using malloc to static memory allocations (Gabriele)
+ Add debugging messages after every query (Gabriele)
+ Parameterize schema name used for repmgr (Gabriele)
+ Avoid buffer overruns by using snprintf etc. (Gabriele)
+ Fix use of database query after close (Gabriele)
+ Add information about progress during "standby clone" (Gabriele)
+ Fix double free errors in repmgrd (Charles Duffy, Greg)
+ Make repmgr exit with an error code when encountering an error (Charles)
+ Standardize on error return codes, use in repmgrd too (Greg)
+ Add [un]install actions/SQL like most contrib modules (Daniel Farina)
+ Wrap all string construction and produce error on overflow (Daniel)
+ Correct freeing of memory from first_wal_segment (Daniel)
+ Allow creating recovery.conf file with a password (Daniel)
+ Inform when STANDBY CLONE sees an unused config file (Daniel)
+ Use 64-bit computation for WAL apply_lag (Greg)
+ Add info messages for database and general work done (Greg)
+ Map old verbose flag into a useful setting for the new logger (Greg)
+ Document repmgrd startup restrictions and log info about them (Greg)
+
+1.1.0 2011-03-09
+ Make options -U, -R and -p not mandatory (Jaime)
+
+1.1.1 2011-XX-XX
+ Add --ignore-rsync-warning (Cédric)
View
1  README.rst
@@ -862,6 +862,7 @@ The output from this program looks like this::
-f, --config_file=PATH path to the configuration file
-R, --remote-user=USERNAME database server username for rsync
-w, --wal-keep-segments=VALUE minimum value for the GUC wal_keep_segments (default: 5000)
+ -I, --ignore-rsync-warning ignore rsync partial transfer warning
-F, --force force potentially dangerous operations to happen
repmgr performs some tasks like clone a node, promote it or making follow another node and then exits.
View
21 TODO
@@ -0,0 +1,21 @@
+Known issues in repmgr
+======================
+
+* The check for whether ``wal_keep_segments`` is considered large enough
+ does a string comparison rather than an integer one. It can give both
+ false positive (setting is large enough but flagged as too small) and
+ false negative (setting is too small but not noted as such) errors.
+
+* When running repmgr against a remote machine, operations that start
+ the database server using the ``pg_ctl`` command may accidentally
+ terminate after their associated ssh session ends.
+
+* After running repmgrd as a regular foreground application, hitting
+ control-C causes the program to crash.
+
+Planned feature improvements
+============================
+
+* Before running ``pg_start_backup()``, a sanity check that there is a
+ a working ssh connection to the destination would help find
+ configuration errors before disturbing the database.
View
6 check_dir.c
@@ -129,10 +129,10 @@ mkdir_p(char *path, mode_t omode)
{
struct stat sb;
mode_t numask,
- oumask;
+ oumask;
int first,
- last,
- retval;
+ last,
+ retval;
char *p;
p = path;
View
2  dbutils.h
@@ -27,7 +27,7 @@ PGconn *establishDBConnectionByParams(const char *keywords[],
bool is_standby(PGconn *conn);
char *pg_version(PGconn *conn, char* major_version);
bool guc_setted(PGconn *conn, const char *parameter, const char *op,
- const char *value);
+ const char *value);
const char *get_cluster_size(PGconn *conn);
PGconn *getMasterConnection(PGconn *standby_conn, int id, char *cluster,
int *master_id, char *master_conninfo_out);
View
43 repmgr.c
@@ -49,7 +49,7 @@
static void help(const char *progname);
static bool create_recovery_file(const char *data_dir, char *master_conninfo);
static int copy_remote_files(char *host, char *remote_user, char *remote_path,
- char *local_path, bool is_directory);
+ char *local_path, bool is_directory);
static bool check_parameters_for_action(const int action);
static void do_master_register(void);
@@ -71,7 +71,7 @@ bool need_a_node = true;
bool require_password = false;
/* Initialization of runtime options */
-t_runtime_options runtime_options = { "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, "" };
+t_runtime_options runtime_options = { "", "", "", "", "", "", DEFAULT_WAL_KEEP_SEGMENTS, false, false, false, "" };
t_configuration_options options = { "", -1, "", "", "" };
static char *server_mode = NULL;
@@ -91,6 +91,7 @@ main(int argc, char **argv)
{"remote-user", required_argument, NULL, 'R'},
{"wal-keep-segments", required_argument, NULL, 'w'},
{"force", no_argument, NULL, 'F'},
+ {"ignore-rsync-warning", no_argument, NULL, 'I'},
{"verbose", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
@@ -150,6 +151,9 @@ main(int argc, char **argv)
case 'F':
runtime_options.force = true;
break;
+ case 'I':
+ runtime_options.ignore_rsync_warn = true;
+ break;
case 'v':
runtime_options.verbose = true;
break;
@@ -256,7 +260,7 @@ main(int argc, char **argv)
parse_config(runtime_options.config_file, &options);
keywords[2] = "user";
- values[2] = runtime_options.username;
+ values[2] = (runtime_options.username[0]) ? runtime_options.username : NULL;
keywords[3] = "dbname";
values[3] = runtime_options.dbname;
keywords[4] = "application_name";
@@ -1336,6 +1340,7 @@ void help(const char *progname)
printf(_(" -f, --config_file=PATH path to the configuration file\n"));
printf(_(" -R, --remote-user=USERNAME database server username for rsync\n"));
printf(_(" -w, --wal-keep-segments=VALUE minimum value for the GUC wal_keep_segments (default: 5000)\n"));
+ printf(_(" -I, --ignore-rsync-warning ignore rsync partial transfer warning\n"));
printf(_(" -F, --force force potentially dangerous operations to happen\n"));
printf(_("\n%s performs some tasks like clone a node, promote it "), progname);
@@ -1379,7 +1384,8 @@ create_recovery_file(const char *data_dir, char *master_conninfo)
return false;
}
- maxlen_snprintf(line, "primary_conninfo = 'host=%s port=%s'\n", runtime_options.host, runtime_options.masterport);
+ maxlen_snprintf(line, "primary_conninfo = 'host=%s port=%s'\n", runtime_options.host,
+ (runtime_options.masterport[0]) ? runtime_options.masterport : "5432");
/*
* Template a password into the connection string in recovery.conf
@@ -1399,7 +1405,8 @@ create_recovery_file(const char *data_dir, char *master_conninfo)
{
maxlen_snprintf(line,
"primary_conninfo = 'host=%s port=%s password=%s'\n",
- runtime_options.host, runtime_options.masterport,
+ runtime_options.host,
+ (runtime_options.masterport[0]) ? runtime_options.masterport : "5432",
password);
}
else
@@ -1446,7 +1453,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
if (runtime_options.force)
strcat(rsync_flags, " --delete");
- if (remote_user == NULL)
+ if (!remote_user[0])
{
maxlen_snprintf(host_string, "%s", host);
}
@@ -1471,6 +1478,30 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
r = system(script);
+ /*
+ * If we are transfering a directory (data directory, tablespace directories)
+ * then we can ignore some rsync warnings. If we get some of those errors, we
+ * treat them as 0 only if passed the --ignore-rsync-warning command-line option.
+ *
+ * List of ignorable rsync errors:
+ * 24 Partial transfer due to vanished source files
+ */
+ if ((WEXITSTATUS(r) == 24) && is_directory)
+ {
+ if (runtime_options.ignore_rsync_warn)
+ {
+ r = 0;
+ log_info(_("rsync partial transfer warning ignored\n"));
+ }
+ else
+ log_warning( _("\nrsync completed with return code 24: "
+ "\"Partial transfer due to vanished source files\".\n"
+ "This can happen because of normal operation "
+ "on the master server, but it may indicate an "
+ "unexpected change during cloning. If you are certain "
+ "no changes were made to the master, try cloning "
+ "again using \"repmgr --force --ignore-rsync-warning\"."));
+ }
if (r != 0)
log_err(_("Can't rsync from remote file or directory (%s:%s)\n"),
host_string, remote_path);
View
1  repmgr.h
@@ -55,6 +55,7 @@ typedef struct
char wal_keep_segments[MAXLEN];
bool verbose;
bool force;
+ bool ignore_rsync_warn;
char masterport[MAXLEN];
Please sign in to comment.
Something went wrong with that request. Please try again.