From f5e57aa433d981c887e059a288f34e3e48592e35 Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Wed, 4 Jul 2012 10:07:31 -0500 Subject: [PATCH] Add an option for "no-history" mode, where repmgrd just checks the conectivity of master but don't INSERT any data into it --- repmgrd.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/repmgrd.c b/repmgrd.c index 94a49e9b..3b5c9ff0 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -65,6 +65,7 @@ const char *progname; char *config_file = DEFAULT_CONFIG_FILE; bool verbose = false; +bool no_history = false; char repmgr_schema[MAXLEN]; /* @@ -113,6 +114,7 @@ main(int argc, char **argv) { {"config", required_argument, NULL, 'f'}, {"verbose", no_argument, NULL, 'v'}, + {"no-history", no_argument, NULL, 'N'}, {NULL, 0, NULL, 0} }; @@ -137,7 +139,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "f:v", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "f:v:N", long_options, &optindex)) != -1) { switch (c) { @@ -147,6 +149,9 @@ main(int argc, char **argv) case 'v': verbose = true; break; + case 'N': + no_history = true; + break; default: usage(); exit(ERR_BAD_CONFIG); @@ -352,6 +357,10 @@ WitnessMonitor(void) exit(0); } + /* Fast path for the case where no history is requested */ + if (no_history) + return; + /* * Cancel any query that is still being executed, * so i can insert the current record @@ -469,6 +478,10 @@ StandbyMonitor(void) exit(ERR_PROMOTED); } + /* Fast path for the case where no history is requested */ + if (no_history) + return; + /* * Cancel any query that is still being executed, * so i can insert the current record