Skip to content

Commit

Permalink
Prepare/release 1.6.3 (#828)
Browse files Browse the repository at this point in the history
* Update borrowed Postgres code.

* Bump the version number to 1.6.3 and add a changelog entry.

* Review README and some docs.

* Improve a changelog entry wording.

* Fix Travis environment with using Ubuntu focal and Python: "3.7".
  • Loading branch information
DimCitus committed Nov 9, 2021
1 parent 56dd719 commit 31593a6
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 37 deletions.
15 changes: 7 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
sudo: required
dist: bionic
dist: focal
language: c
python:
- "3.6"
- "3.7"
cache:
apt: true
directories:
Expand Down Expand Up @@ -42,23 +42,22 @@ before_install:
- 'if [ -z "$LINTING" ]; then setup_apt; fi'
- 'if [ -z "$LINTING" ]; then nuke_pg; fi'
- python --version
- pyenv versions
- pyenv install -s 3.7
- pyenv global 3.7
- python3 --version
- sudo apt-get install liblz4-1
- sudo apt-get install liblz4-dev
- sudo apt-get install bridge-utils
- sudo apt-get install python3-pip
- sudo pip3 install --upgrade pip
- pip3 install --user pipenv
- sudo apt-get install python3-nose
- sudo apt-get install python3-psycopg2
- sudo apt-get install python3-setuptools
- sudo -H pip3 install pyroute2>=0.5.17
- pip3 install --user black
install:
- 'if [ -n "$LINTING" ]; then install_uncrustify; fi'
# cleanup uncrustify build files
- 'if [ -n "$LINTING" ]; then rm -rf uncrustify*; fi'
- 'if [ -z "$LINTING" ]; then install_pg; fi'
- 'if [ -z "$LINTING" ]; then install_custom_pg; fi'
- PIPENV_PIPFILE="${TRAVIS_BUILD_DIR}"/tests/Pipfile pipenv install --system --deploy
- env
- 'if [ -z "$LINTING" ]; then pg_config; fi'
- 'if [ -z "$LINTING" ]; then PATH=`pg_config --bindir`:$PATH which pg_ctl; fi'
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
### pg_auto_failover v1.6.3 (November 5, 2021) ###

This is a bug fix release for the 1.6 series.

This release also introduces a new ncurses interactive dashboard that makes
it easier to understand the current state (and transitions) of a formation.
The new command `pg_autoctl watch` can be used to monitor pg_auto_failover
activity.

#### Added
* New ncurses dashboard with command pg_autoctl watch (#809)

#### Changed
* Allow setting maximum-backup-rate on create postgres step (#812)

#### Fixed
* Work around pg_replication_slot_advance xmin maintenance bug. (#815)
* Fix "Current State" to "Reported State", and a docs cross-ref.
* Monitor config set postgresql.pg_ctl bug fix (#818)
* Fix how we clean-up our logs semaphore. (#811)
* Fix synchronous_standby_names return value when there is no primary (#807)

### pg_auto_failover v1.6.2 (September 8, 2021) ###

This is a bug fix release for the 1.6 series.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ AZURE_LOCATION ?= francecentral
# postgresql-${AZ_PG_VERSION}-auto-failover-${AZ_PGAF_DEB_VERSION}=${AZ_PGAF_VERSION}
AZ_PG_VERSION ?= 13
AZ_PGAF_DEB_VERSION ?= 1.6
AZ_PGAF_DEB_REVISION ?= 1.6.2-1
AZ_PGAF_DEB_REVISION ?= 1.6.3-1

export AZ_PG_VERSION
export AZ_PGAF_DEB_VERSION
Expand Down
34 changes: 30 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ the _replication quorum_ of Postgres.
## Dependencies

At runtime, pg_auto_failover depends on only Postgres. Postgres versions 10,
11, 12, and 13 are currently supported.
11, 12, 13, and 14 are currently supported.

At buildtime. pg_auto_failover depends on Postgres server development
package like any other Postgres extensions (the server development package
Expand All @@ -58,7 +58,21 @@ to guides and troubleshooting information.

## Installing pg_auto_failover from packages

Ubuntu or Debian:
Note that pg_auto_failover packages are also found in Postgres PGDG package
repositories. If you're using those repositories already, you can install
the packages from there.

### Ubuntu or Debian:

When using debian, two packages are provided for pg_auto_failover: the
monitor Postgres extension is packaged separately and depends on the
Postgres version you want to run for the monitor itself. The monitor's
extension package is named `postgresql-14-auto-failover` when targetting
Postgres 14.

Then another package is prepared that contains the `pg_autoctl` command, and
the name of the package is `pg-auto-failover-cli`. That's the package that
is needed for the Postgres nodes.

```bash
# Add the repository to your system
Expand All @@ -71,7 +85,7 @@ sudo apt-get install postgresql-11-auto-failover
/usr/bin/pg_autoctl --version
```

Fedora, CentOS, or Red Hat:
### Fedora, CentOS, or Red Hat:

```bash
# Add the repository to your system
Expand All @@ -93,7 +107,7 @@ install`.
Build dependencies example on debian for Postgres 11:

~~~ bash
$ sudo apt-get install postgresql-server-dev-11 libssl-dev libkrb5-dev
$ sudo apt-get install postgresql-server-dev-11 libssl-dev libkrb5-dev libncurses6
~~~

Then build pg_auto_failover from sources with the following instructions:
Expand All @@ -117,6 +131,18 @@ install the `pg_autoctl` binary command in the directory pointed to by

Once the building and installation is done, follow those steps:

0. If you're building from sources, and if you've already been using tmux,
then try the following command:

~~~ bash
$ make cluster
~~~

This creates a tmux session with multiple panes that are each running a
node for pg_auto_failover: the monitor, a first Postgres node, a second
Postgres node, and then there is another tmux pane for interactive
commands.

1. Install and run a monitor

~~~ bash
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, **options):
# The short X.Y version.
version = "1.6"
# The full version, including alpha/beta/rc tags.
release = "1.6.2"
release = "1.6.3"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
11 changes: 6 additions & 5 deletions docs/ref/pg_autoctl_watch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ your terminal window size changes:
the Node column contains the groupId and the nodeId, separated by a
colon, such as ``0:1`` for the first coordinator node.

- Reported Lag, or Lag(R)
- Last Report, or Report

Time interval between now and the last known time when a node has
reported to the monitor, using the ``node_active`` protocol.
Expand All @@ -84,14 +84,15 @@ your terminal window size changes:
increment when either the ``pg_autoctl run`` service is not running, or
when there is a network split.

- Health Lag, or Lag(H)
- Last Check, or Check

Time inverval between now and the last known time when the monitor could
connect to a node's Postgres instance, via its health check mechanism.

This value is expected to stay under 6s or abouts, and is known to
increment when either the Postgres service is not running on the target
node, or when there is a network split.
This value is known to increment when either the Postgres service is not
running on the target node, when there is a network split, or when the
internal machinery (the health check worker background process)
implements jitter.

- Host:Port

Expand Down
54 changes: 40 additions & 14 deletions src/bin/lib/pg/snprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 1983, 1995, 1996 Eric P. Allman
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -321,7 +321,7 @@ static bool find_arguments(const char *format, va_list args,
PrintfArgValue *argvalues);
static void fmtstr(const char *value, int leftjust, int minlen, int maxwidth,
int pointflag, PrintfTarget *target);
static void fmtptr(void *value, PrintfTarget *target);
static void fmtptr(const void *value, PrintfTarget *target);
static void fmtint(long long value, char type, int forcesign,
int leftjust, int minlen, int zpad, int precision, int pointflag,
PrintfTarget *target);
Expand Down Expand Up @@ -377,7 +377,7 @@ dopr(PrintfTarget *target, const char *format, va_list args)
int cvalue;
long long numvalue;
double fvalue;
char *strvalue;
const char *strvalue;
PrintfArgValue argvalues[PG_NL_ARGMAX + 1];

/*
Expand Down Expand Up @@ -422,7 +422,8 @@ dopr(PrintfTarget *target, const char *format, va_list args)
{
format++;
strvalue = va_arg(args, char *);
Assert(strvalue != NULL);
if (strvalue == NULL)
strvalue = "(null)";
dostr(strvalue, strlen(strvalue), target);
if (target->failed)
break;
Expand Down Expand Up @@ -653,8 +654,9 @@ dopr(PrintfTarget *target, const char *format, va_list args)
strvalue = argvalues[fmtpos].cptr;
else
strvalue = va_arg(args, char *);
/* Whine if someone tries to print a NULL string */
Assert(strvalue != NULL);
/* If string is NULL, silently substitute "(null)" */
if (strvalue == NULL)
strvalue = "(null)";
fmtstr(strvalue, leftjust, fieldwidth, precision, pointflag,
target);
break;
Expand All @@ -664,7 +666,7 @@ dopr(PrintfTarget *target, const char *format, va_list args)
strvalue = argvalues[fmtpos].cptr;
else
strvalue = va_arg(args, char *);
fmtptr((void *) strvalue, target);
fmtptr((const void *) strvalue, target);
break;
case 'e':
case 'E':
Expand Down Expand Up @@ -978,7 +980,7 @@ fmtstr(const char *value, int leftjust, int minlen, int maxwidth,
}

static void
fmtptr(void *value, PrintfTarget *target)
fmtptr(const void *value, PrintfTarget *target)
{
int vallen;
char convert[64];
Expand All @@ -996,8 +998,8 @@ fmtint(long long value, char type, int forcesign, int leftjust,
int minlen, int zpad, int precision, int pointflag,
PrintfTarget *target)
{
unsigned long long base;
unsigned long long uvalue;
int base;
int dosign;
const char *cvt = "0123456789abcdef";
int signvalue = 0;
Expand Down Expand Up @@ -1056,12 +1058,36 @@ fmtint(long long value, char type, int forcesign, int leftjust,
vallen = 0;
else
{
/* make integer string */
do
/*
* Convert integer to string. We special-case each of the possible
* base values so as to avoid general-purpose divisions. On most
* machines, division by a fixed constant can be done much more
* cheaply than a general divide.
*/
if (base == 10)
{
do
{
convert[sizeof(convert) - (++vallen)] = cvt[uvalue % 10];
uvalue = uvalue / 10;
} while (uvalue);
}
else if (base == 16)
{
convert[sizeof(convert) - (++vallen)] = cvt[uvalue % base];
uvalue = uvalue / base;
} while (uvalue);
do
{
convert[sizeof(convert) - (++vallen)] = cvt[uvalue % 16];
uvalue = uvalue / 16;
} while (uvalue);
}
else /* base == 8 */
{
do
{
convert[sizeof(convert) - (++vallen)] = cvt[uvalue % 8];
uvalue = uvalue / 8;
} while (uvalue);
}
}

zeropad = Max(0, precision - vallen);
Expand Down
2 changes: 0 additions & 2 deletions src/bin/lib/pg/strerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,8 @@ get_errno_symbol(int errnum)
#endif
case ESRCH:
return "ESRCH";
#ifdef ETIMEDOUT
case ETIMEDOUT:
return "ETIMEDOUT";
#endif
#ifdef ETXTBSY
case ETXTBSY:
return "ETXTBSY";
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pg_autoctl/azure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ azure_prepare_target_versions(KeyVal *env)
/* default values */
sformat(env->values[0], MAXCONNINFO, "13"); /* AZ_PG_VERSION */
sformat(env->values[1], MAXCONNINFO, "1.6"); /* AZ_PGAF_DEB_VERSION */
sformat(env->values[2], MAXCONNINFO, "1.6.2-1"); /* AZ_PGAF_DEB_REVISION */
sformat(env->values[2], MAXCONNINFO, "1.6.3-1"); /* AZ_PGAF_DEB_REVISION */

for (int i = 0; i < 3; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pg_autoctl/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define PG_AUTOCTL_STATE_VERSION 1

/* additional version information for printing version on CLI */
#define PG_AUTOCTL_VERSION "1.6.2"
#define PG_AUTOCTL_VERSION "1.6.3"

/* version of the extension that we requite to talk to on the monitor */
#define PG_AUTOCTL_EXTENSION_VERSION "1.6"
Expand Down

0 comments on commit 31593a6

Please sign in to comment.