debian/0000755000000000000000000000000012260652166007174 5ustar debian/tests/0000755000000000000000000000000012260651755010341 5ustar debian/tests/control0000644000000000000000000000014212260651755011741 0ustar Depends: @, postgresql-server-dev-all Tests: installcheck Restrictions: allow-stderr build-needed debian/tests/installcheck0000755000000000000000000000034012260651755012730 0ustar #!/bin/sh set -e for v in $(pg_buildext supported-versions); do if ! pg_virtualenv -v $v \ make installcheck PG_CONFIG=/usr/lib/postgresql/$v/bin/pg_config USE_PGXS=1; then cat regression.diffs exit 1 fi done debian/control0000644000000000000000000000421512260652166010601 0ustar Source: repmgr Section: database Priority: extra Maintainer: Marco Nenciarini Build-Depends: debhelper (>= 9), postgresql-server-dev-all, libedit-dev, libpam-dev, libxml2-dev, libxslt1-dev Standards-Version: 3.9.5.0 Homepage: http://www.repmgr.org/ Vcs-Git: git://anonscm.debian.org/collab-maint/repmgr.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/repmgr.git;a=summary XS-Testsuite: autopkgtest Package: repmgr Architecture: any Depends: postgresql-common (>= 26), rsync, ${misc:Depends}, ${shlibs:Depends} Description: replication manager for PostgreSQL Since version 9.0, PostgreSQL allow you to have replicated hot standby servers which you can query and/or use for high availability. While the main components of the feature are included with PostgreSQL, the user is expected to manage the high availability parts. . repmgr allows you to monitor and manage your replicated PostgreSQL databases as a single cluster. Package: repmgr-dbg Section: debug Architecture: any Depends: repmgr (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Description: debug symbols for repmgr Since version 9.0, PostgreSQL allow you to have replicated hot standby servers which you can query and/or use for high availability. While the main components of the feature are included with PostgreSQL, the user is expected to manage the high availability parts. . repmgr allows you to monitor and manage your replicated PostgreSQL databases as a single cluster. . This package contains debug symbols for repmgr. Package: postgresql-9.3-repmgr Architecture: any Depends: postgresql-9.3, ${misc:Depends}, ${shlibs:Depends} Description: replication manager support modules for PostgreSQL 9.3 Since version 9.0, PostgreSQL allow you to have replicated hot standby servers which you can query and/or use for high availability. While the main components of the feature are included with PostgreSQL, the user is expected to manage the high availability parts. . repmgr allows you to monitor and manage your replicated PostgreSQL databases as a single cluster. . This package contains the repmgr support module for PostgreSQL 9.3. debian/repmgrd.80000644000000000000000000000350212260651755010730 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH REPMGRD 8 "May 11, 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME repmgrd \- Replicator manager daemon for PostgreSQL. .SH SYNOPSIS .B repmgrd .RI [ options ] .SH DESCRIPTION This manual page documents briefly the .B repmgrd daemon. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBrepmgrd\fP is a management and monitoring daemon for repmgr that watches the cluster and can automate remote actions. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see README.rst file. .TP .B \-\-help Show summary of options. .TP .B \-\-version Show version information. .TP .B \-\-verbose Output verbose activity information. .TP .B \-f, \-\-config_file=PATH Path to configuration file. .SH SEE ALSO .BR repmgr (1), .BR rsync (1). .SH RESOURCES Homepage: http://www.repmgr.org .SH AUTHOR repmgr was written by 2ndQuadrant Limited . .PP This manual page was written by Krzysztof Gajdemski , for the Debian project (and may be used by others). debian/source/0000755000000000000000000000000012260651755010477 5ustar debian/source/format0000644000000000000000000000001412260651755011705 0ustar 3.0 (quilt) debian/compat0000644000000000000000000000000212260651755010375 0ustar 8 debian/manpages0000644000000000000000000000004112260651755010710 0ustar debian/repmgr.1 debian/repmgrd.8 debian/examples0000644000000000000000000000002312260651755010733 0ustar repmgr.conf.sample debian/pgversions0000644000000000000000000000002012260651755011311 0ustar 9.0 9.1 9.2 9.3 debian/copyright0000644000000000000000000000236612260651755011141 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: repmgr Source: http://www.repmgr.org/ Files: * Copyright: 2010-2012, 2ndQuadrant Limited License: GPL-3.0+ Files: debian/* Copyright: 2011-2012 Marco Nenciarini 2011-2012 2ndQuadrant Limited License: GPL-3.0+ Files: debian/repmgr.1 debian/repmgrd.8 Copyright: 2012 Krzysztof Gajdemski License: GPL-3.0+ License: GPL-3.0+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . . On Debian systems, the complete text of the GNU General Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". debian/repmgr.10000644000000000000000000000635012260651755010561 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH REPMGR 1 "May 11, 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME repmgr \- PostgreSQL replication manager .SH SYNOPSIS .B repmgr .RI [ options ] " master " {register} .br .B repmgr .RI [ options ] " standby " {register|clone|promote|follow} .br .B repmgr .RI [ options ] " cluster " show .SH DESCRIPTION This manual page documents briefly the .B repmgr command. .PP .\" TeX users may be more comfortable with the \fB\fP and .\" \fI\fP escape sequences to invode bold face and italics, .\" respectively. \fBrepmgr\fP is a command program that allows you to monitor and manage your replicated PostgreSQL as a single cluster. It performs some tasks like clone a node, promote it or making follow another node and then exits. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see README.rst file. .SS General options .TP .B \-\-help Show summary of options. .TP .B \-\-version Show version information. .TP .B \-\-verbose Output verbose activity information. .SS Connection options .TP .B \-d, \-\-dbname=DBNAME Database to connect to. .TP .B \-h, \-\-host=HOSTNAME Database server host or socket directory. .TP .B \-p, \-\-port=PORT Database server port. .TP .B \-U, \-\-username=USERNAME Database user name to connect as. .SS Configuration options .TP .B \-D, \-\-data-dir=DIR Local directory where the files will be copied to. .TP .B \-l, \-\-local-port=PORT Standby or witness server local port. .TP .B \-f, \-\-config_file=PATH Path to the configuration file. .TP .B \-R, \-\-remote-user=USERNAME Database server username for rsync. .TP .B \-w, \-\-wal-keep-segments=VALUE Minimum value for the GUC wal_keep_segments (default: 5000). .TP .B \-I, \-\-ignore-rsync-warning Ignore rsync partial transfer warning. .TP .B \-F, \-\-force Force potentially dangerous operations to happen. .SH COMMANDS .TP .B master register Registers the master in a cluster. .TP .B standby register Registers a standby in a cluster. .TP .B standby clone [node] Allows creation of a new standby. .TP .B standby promote Allows manual promotion of a specific standby into a new master in the event of a failover. .TP .B standby follow Allows the standby to re-point itself to a new master. .TP .B cluster show Print node information. .SH SEE ALSO .BR rsync (1), .BR repmgrd (8). .SH RESOURCES Homepage: http://www.repmgr.org .SH AUTHOR repmgr was written by 2ndQuadrant Limited . .PP This manual page was written by Krzysztof Gajdemski , for the Debian project (and may be used by others). debian/rules0000755000000000000000000000242712260651755010264 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 SRCDIR = . include /usr/share/postgresql-common/pgxs_debian_control.mk clean: debian/control .PHONY: debian/control CFLAGS += -g LDFLAGS += -Wl,--as-needed MAKEFLAGS += USE_PGXS=1 .PHONY: override_dh_auto_clean override_dh_auto_clean: $(MAKE) clean USE_PGXS=1 rm -rf regression.* results/ .PHONY: override_dh_strip override_dh_strip: dh_strip --dbg-package=repmgr-dbg .PHONY: override_dh_auto_install override_dh_auto_install: set -e ; \ for v in `pg_buildext supported-versions .` ; do \ echo "# $$v ##################################################################" ; \ PG_CONFIG=/usr/lib/postgresql/$$v/bin/pg_config ; \ BASE=$(CURDIR)/debian/postgresql-$$v-repmgr ; \ $(MAKE) clean PG_CONFIG=$$PG_CONFIG ; \ mkdir -p $$BASE/usr/share/postgresql/$$v/contrib ; \ $(MAKE) install_ext DESTDIR=$$BASE PG_CONFIG=$$PG_CONFIG ; \ done ; \ $(MAKE) all PG_CONFIG=$$PG_CONFIG ; \ BASE=$(CURDIR)/debian/repmgr ; \ mkdir -p $$BASE/usr/bin $$BASE/usr/lib/postgresql/$$v/bin ; \ $(MAKE) install_prog DESTDIR=$$BASE PG_CONFIG=$$PG_CONFIG ; \ mv $$BASE/usr/lib/postgresql/$$v/bin/* $$BASE/usr/bin ; \ rmdir -p --ignore-fail-on-non-empty $$BASE/usr/lib/postgresql/$$v/bin %: dh $@ debian/watch0000644000000000000000000000024212260651755010226 0ustar version=3 opts="uversionmangle=s/(alpha|beta|rc)/~$1/,filenamemangle=s/(repmgr-.+?)(alpha|beta|rc)/$1~$2/" \ http://www.repmgr.org/download/ repmgr-(.+)\.tar\.gz debian/docs0000644000000000000000000000004012260651755010044 0ustar README.rst TODO CREDITS HISTORY debian/control.in0000644000000000000000000000424412260651755011213 0ustar Source: repmgr Section: database Priority: extra Maintainer: Marco Nenciarini Build-Depends: debhelper (>= 9), postgresql-server-dev-all, libedit-dev, libpam-dev, libxml2-dev, libxslt1-dev Standards-Version: 3.9.5.0 Homepage: http://www.repmgr.org/ Vcs-Git: git://anonscm.debian.org/collab-maint/repmgr.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/repmgr.git;a=summary XS-Testsuite: autopkgtest Package: repmgr Architecture: any Depends: postgresql-common (>= 26), rsync, ${misc:Depends}, ${shlibs:Depends} Description: replication manager for PostgreSQL Since version 9.0, PostgreSQL allow you to have replicated hot standby servers which you can query and/or use for high availability. While the main components of the feature are included with PostgreSQL, the user is expected to manage the high availability parts. . repmgr allows you to monitor and manage your replicated PostgreSQL databases as a single cluster. Package: postgresql-PGVERSION-repmgr Architecture: any Depends: postgresql-PGVERSION, ${misc:Depends}, ${shlibs:Depends} Description: replication manager support modules for PostgreSQL PGVERSION Since version 9.0, PostgreSQL allow you to have replicated hot standby servers which you can query and/or use for high availability. While the main components of the feature are included with PostgreSQL, the user is expected to manage the high availability parts. . repmgr allows you to monitor and manage your replicated PostgreSQL databases as a single cluster. . This package contains the repmgr support module for PostgreSQL PGVERSION. Package: repmgr-dbg Section: debug Architecture: any Depends: repmgr (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} Description: debug symbols for repmgr Since version 9.0, PostgreSQL allow you to have replicated hot standby servers which you can query and/or use for high availability. While the main components of the feature are included with PostgreSQL, the user is expected to manage the high availability parts. . repmgr allows you to monitor and manage your replicated PostgreSQL databases as a single cluster. . This package contains debug symbols for repmgr. debian/gbp.conf0000644000000000000000000000005712260651755010620 0ustar [DEFAULT] pristine-tar = True sign-tags = True debian/patches/0000755000000000000000000000000012260651755010626 5ustar debian/patches/debian-makefile.patch0000644000000000000000000000271412260651755014650 0ustar From: Marco Nenciarini Date: Fri, 9 Nov 2012 18:12:03 +0100 Subject: debian makefile --- Makefile | 10 +++++++--- sql/Makefile | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ff46f28..cf41ea7 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,8 @@ repmgr: $(repmgr_OBJS) $(CC) $(CFLAGS) $(repmgr_OBJS) $(PG_LIBS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o repmgr ifdef USE_PGXS -PGXS := $(shell pg_config --pgxs) +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else subdir = contrib/repmgr @@ -32,11 +33,14 @@ endif # XXX: Try to use PROGRAM construct (see pgxs.mk) someday. Right now # is overriding pgxs install. -install: +install: install_prog install_ext + +install_prog: $(INSTALL_PROGRAM) repmgrd$(X) '$(DESTDIR)$(bindir)' $(INSTALL_PROGRAM) repmgr$(X) '$(DESTDIR)$(bindir)' - $(MAKE) -C sql install +install_ext: + $(MAKE) -C sql install ifneq (,$(DATA)$(DATA_built)) @for file in $(addprefix $(srcdir)/, $(DATA)) $(DATA_built); do \ echo "$(INSTALL_DATA) $$file '$(DESTDIR)$(datadir)/$(datamoduledir)'"; \ diff --git a/sql/Makefile b/sql/Makefile index d61848b..7d3472b 100644 --- a/sql/Makefile +++ b/sql/Makefile @@ -9,7 +9,8 @@ DATA=uninstall_repmgr_funcs.sql OBJS=repmgr_funcs.o ifdef USE_PGXS -PGXS := $(shell pg_config --pgxs) +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) else subdir = contrib/repmgr/sql debian/patches/format-attribute-check.patch0000644000000000000000000000514412260651755016217 0ustar From: Marco Nenciarini Date: Tue, 31 Dec 2013 16:31:09 +0100 Subject: format attribute check --- log.h | 2 +- repmgr.c | 2 +- strutil.c | 2 +- strutil.h | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/log.h b/log.h index 643b3f6..a134eab 100644 --- a/log.h +++ b/log.h @@ -25,7 +25,7 @@ #define REPMGR_SYSLOG 1 #define REPMGR_STDERR 2 -void stderr_log_with_level(const char *level_name, int level, const char *fmt, ...); +void stderr_log_with_level(const char *level_name, int level, const char *fmt, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 3, 4))); /* Standard error logging */ #define stderr_log_debug(...) stderr_log_with_level("DEBUG", LOG_DEBUG, __VA_ARGS__) diff --git a/repmgr.c b/repmgr.c index ea97358..09184cb 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1640,7 +1640,7 @@ do_witness_create(void) /* register ourselves in the master */ sqlquery_snprintf(sqlquery, "INSERT INTO %s.repl_nodes(id, cluster, name, conninfo, priority, witness) " "VALUES (%d, '%s', '%s', '%s', %d, true)", - repmgr_schema, options.node, options.cluster_name, options.node_name, options.conninfo); + repmgr_schema, options.node, options.cluster_name, options.node_name, options.conninfo, options.priority); log_debug(_("witness create: %s"), sqlquery); if (!PQexec(masterconn, sqlquery)) diff --git a/strutil.c b/strutil.c index aaa186d..ae76321 100644 --- a/strutil.c +++ b/strutil.c @@ -25,7 +25,7 @@ #include "log.h" #include "strutil.h" -static int xvsnprintf(char *str, size_t size, const char *format, va_list ap); +static int xvsnprintf(char *str, size_t size, const char *format, va_list ap) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 3, 0))); ; /* Add strnlen on platforms that don't have it, like OS X */ #ifndef strnlen diff --git a/strutil.h b/strutil.h index 75eb63a..cb3ee45 100644 --- a/strutil.h +++ b/strutil.h @@ -31,9 +31,9 @@ #define MAXCONNINFO 1024 -extern int xsnprintf(char *str, size_t size, const char *format, ...); -extern int sqlquery_snprintf(char *str, const char *format, ...); -extern int maxlen_snprintf(char *str, const char *format, ...); +extern int xsnprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 3, 4))); +extern int sqlquery_snprintf(char *str, const char *format, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 2, 3))); +extern int maxlen_snprintf(char *str, const char *format, ...) __attribute__ ((format (PG_PRINTF_ATTRIBUTE, 2, 3))); /* Add strnlen on platforms that don't have it, like OS X */ #ifndef strnlen debian/patches/regress.patch0000644000000000000000000000404312260651755013322 0ustar From: Christoph Berg Date: Tue, 31 Dec 2013 00:05:49 +0200 Subject: regress --- Makefile | 1 + expected/repmgr_funcs.out | 12 ++++++++++++ expected/repmgr_test.out | 12 ++++++++++++ sql/repmgr_test.sql | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 expected/repmgr_funcs.out create mode 100644 expected/repmgr_test.out create mode 100644 sql/repmgr_test.sql diff --git a/Makefile b/Makefile index cf41ea7..2963b2b 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ repmgrd_OBJS = dbutils.o config.o repmgrd.o log.o strutil.o repmgr_OBJS = dbutils.o check_dir.o config.o repmgr.o log.o strutil.o DATA = repmgr.sql uninstall_repmgr.sql +REGRESS = repmgr_funcs repmgr_test PG_CPPFLAGS = -I$(libpq_srcdir) PG_LIBS = $(libpq_pgport) diff --git a/expected/repmgr_funcs.out b/expected/repmgr_funcs.out new file mode 100644 index 0000000..954a779 --- /dev/null +++ b/expected/repmgr_funcs.out @@ -0,0 +1,12 @@ +/* + * repmgr_function.sql + * Copyright (c) 2ndQuadrant, 2010 + * + */ +-- SET SEARCH_PATH TO 'repmgr'; +CREATE FUNCTION repmgr_update_standby_location(text) RETURNS boolean +AS '$libdir/repmgr_funcs', 'repmgr_update_standby_location' +LANGUAGE C STRICT; +CREATE FUNCTION repmgr_get_last_standby_location() RETURNS text +AS '$libdir/repmgr_funcs', 'repmgr_get_last_standby_location' +LANGUAGE C STRICT; diff --git a/expected/repmgr_test.out b/expected/repmgr_test.out new file mode 100644 index 0000000..acb1915 --- /dev/null +++ b/expected/repmgr_test.out @@ -0,0 +1,12 @@ +select * from repmgr_update_standby_location(''); + repmgr_update_standby_location +-------------------------------- + f +(1 row) + +select * from repmgr_get_last_standby_location(); + repmgr_get_last_standby_location +---------------------------------- + +(1 row) + diff --git a/sql/repmgr_test.sql b/sql/repmgr_test.sql new file mode 100644 index 0000000..9fac465 --- /dev/null +++ b/sql/repmgr_test.sql @@ -0,0 +1,2 @@ +select * from repmgr_update_standby_location(''); +select * from repmgr_get_last_standby_location(); debian/patches/series0000644000000000000000000000010112260651755012033 0ustar debian-makefile.patch regress.patch format-attribute-check.patch debian/changelog0000644000000000000000000000261012260651755011050 0ustar repmgr (2.0~beta2-3) unstable; urgency=low [ Christoph Berg ] * Add basic regression tests and run them with autopkgtest [ Marco Nenciarini ] * Update debian-makefile patch to build repmgr_funcs.so against the right PostgreSQL version * Add format-attribute-check patch -- Marco Nenciarini Tue, 31 Dec 2013 20:27:06 +0100 repmgr (2.0~beta2-2) unstable; urgency=low * Fix missing reference to bug #724216 in 2.0~beta2-1 changelog -- Marco Nenciarini Fri, 27 Dec 2013 09:15:46 +0100 repmgr (2.0~beta2-1) unstable; urgency=low * Fix version mangling in debian/watch * Add Vcs-* fields in control file * Support PostgreSQL 9.3 version * Imported Upstream version 2.0~beta2 (Closes: #724216) * Removed lintian-spelling patch, fixed upstream. * Remove useless dh_auto_install call in override_dh_auto_install target from debian/rules * Bump standard version to 3.9.5.0 (no-chenges) * Canonicalize VCS-* field URI in debian/control -- Marco Nenciarini Thu, 26 Dec 2013 19:45:38 +0100 repmgr (2.0~beta1-2) unstable; urgency=low * Add debugging symbols package repmgr-dbg -- Marco Nenciarini Tue, 13 Nov 2012 11:40:12 +0100 repmgr (2.0~beta1-1) unstable; urgency=low * Initial release (Closes: #609719) -- Marco Nenciarini Wed, 07 Nov 2012 13:00:27 +0100