Skip to content

Commit

Permalink
Build for pg16
Browse files Browse the repository at this point in the history
  • Loading branch information
ettanany committed Sep 29, 2023
1 parent c6d3db4 commit c35dc1a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
# Setup build deps
sudo apt-get install -y libsnappy-dev postgresql-10 postgresql-11 postgresql-12 postgresql-13 postgresql-14 postgresql-15
sudo apt-get install -y libsnappy-dev postgresql-10 postgresql-11 postgresql-12 postgresql-13 postgresql-14 postgresql-15 postgresql-16
# Setup common python dependencies
python -m pip install --upgrade pip
pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion pghoard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from pghoard.common import (extract_pg_command_version_string, pg_major_version, pg_version_string_to_number)
from pghoard.postgres_command import PGHOARD_HOST, PGHOARD_PORT

SUPPORTED_VERSIONS = ["14", "13", "12", "11", "10", "9.6", "9.5", "9.4", "9.3"]
SUPPORTED_VERSIONS = ["16", "15", "14", "13", "12", "11", "10", "9.6", "9.5", "9.4", "9.3"]


def get_cpu_count():
Expand Down
11 changes: 7 additions & 4 deletions pghoard/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,21 @@ def create_recovery_conf(
with open(os.path.join(dirpath, "PG_VERSION"), "r") as fp:
pg_version = LooseVersion(fp.read().strip())

if pg_version >= "12":
trigger_file_setting = "promote_trigger_file"
else:
trigger_file_setting = None
if pg_version < "12":
trigger_file_setting = "trigger_file"
elif pg_version < "16": # PG 16 has removed `promote_trigger_file` config param.
trigger_file_setting = "promote_trigger_file"

lines = [
"# pghoard created recovery.conf",
"recovery_target_timeline = 'latest'",
"{} = {}".format(trigger_file_setting, adapt("trigger_file")),
"restore_command = '{}'".format(" ".join(restore_command)),
]

if trigger_file_setting:
lines.append("{} = {}".format(trigger_file_setting, adapt("trigger_file")))

use_recovery_conf = (pg_version < "12") # no more recovery.conf in PG >= 12
if not restore_to_primary:
if use_recovery_conf:
Expand Down
1 change: 1 addition & 0 deletions pghoard/wal.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
0xD106: 130000,
0xD10D: 140000,
0xD110: 150000,
0xD113: 160000,
}
WAL_MAGIC_BY_VERSION = {value: key for key, value in WAL_MAGIC.items()}

Expand Down
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

logutil.configure_logging()

DEFAULT_PG_VERSIONS = ["15", "14", "13", "12", "11", "10"]
DEFAULT_PG_VERSIONS = ["16", "15", "14", "13", "12", "11", "10"]


def port_is_listening(hostname: str, port: int, timeout: float = 0.5) -> bool:
Expand Down

0 comments on commit c35dc1a

Please sign in to comment.