From 38c4b6f02fc8a2c524ef016aebf2f6ba4d601991 Mon Sep 17 00:00:00 2001 From: anastasia Date: Wed, 12 May 2021 18:23:03 +0300 Subject: [PATCH] Move postgres code related to zenith pageserver to contrib/zenith. - vendor/postgres changes - Respective changes in RUST code: upload shared library, use new GUC names. - Add contrib build to Makefile. --- Makefile | 6 +++++- control_plane/src/compute.rs | 13 ++++++++----- pageserver/src/walredo.rs | 2 ++ vendor/postgres | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0ffbc8acb4..0008f27e3b 100644 --- a/Makefile +++ b/Makefile @@ -32,10 +32,14 @@ postgres-headers: postgres-configure +@echo "Installing PostgreSQL headers" $(MAKE) -C tmp_install/build/src/include MAKELEVEL=0 install -# Compile and install PostgreSQL + +# Compile and install PostgreSQL and contrib/zenith postgres: postgres-configure +@echo "Compiling PostgreSQL" $(MAKE) -C tmp_install/build MAKELEVEL=0 install + +@echo "Compiling contrib/zenith" + (cd vendor/postgres/contrib/zenith && \ + $(MAKE) PG_CONFIG=$(abspath tmp_install)/bin/pg_config install USE_PGXS=1) postgres-clean: $(MAKE) -C tmp_install/build MAKELEVEL=0 clean diff --git a/control_plane/src/compute.rs b/control_plane/src/compute.rs index 1ce3050b01..4497ae2543 100644 --- a/control_plane/src/compute.rs +++ b/control_plane/src/compute.rs @@ -105,7 +105,8 @@ impl ComputeControlPlane { node.append_conf( "postgresql.conf", format!( - "callmemaybe_connstring = '{}'\n", // FIXME escaping + "shared_preload_libraries = zenith\n\ + zenith.callmemaybe_connstring = '{}'\n", // FIXME escaping node.connstr() ) .as_str(), @@ -132,7 +133,8 @@ impl ComputeControlPlane { node.append_conf( "postgresql.conf", format!( - "callmemaybe_connstring = '{}'\n", // FIXME escaping + "shared_preload_libraries = zenith\n\ + zenith.callmemaybe_connstring = '{}'\n", // FIXME escaping node.connstr() ) .as_str(), @@ -169,7 +171,7 @@ impl PostgresNode { lazy_static! { static ref CONF_PORT_RE: Regex = Regex::new(r"(?m)^\s*port\s*=\s*(\d+)\s*$").unwrap(); static ref CONF_TIMELINE_RE: Regex = - Regex::new(r"(?m)^\s*zenith_timeline\s*=\s*'(\w+)'\s*$").unwrap(); + Regex::new(r"(?m)^\s*zenith.zenith_timeline\s*=\s*'(\w+)'\s*$").unwrap(); } // parse data directory name @@ -312,8 +314,9 @@ impl PostgresNode { self.append_conf( "postgresql.conf", &format!( - "page_server_connstring = 'host={} port={}'\n\ - zenith_timeline='{}'\n", + "shared_preload_libraries = zenith \n\ + zenith.page_server_connstring = 'host={} port={}'\n\ + zenith.zenith_timeline='{}'\n", self.pageserver.address().ip(), self.pageserver.address().port(), self.timelineid diff --git a/pageserver/src/walredo.rs b/pageserver/src/walredo.rs index cf878c0a57..ae27bc7f7d 100644 --- a/pageserver/src/walredo.rs +++ b/pageserver/src/walredo.rs @@ -386,6 +386,8 @@ impl WalRedoProcess { .open(PathBuf::from(&datadir).join("postgresql.conf"))?; config.write_all(b"shared_buffers=128kB\n")?; config.write_all(b"fsync=off\n")?; + config.write_all(b"shared_preload_libraries=zenith\n")?; + config.write_all(b"zenith.wal_redo=on\n")?; } // Start postgres itself let mut child = Command::new("postgres") diff --git a/vendor/postgres b/vendor/postgres index 87080ddc02..a051307553 160000 --- a/vendor/postgres +++ b/vendor/postgres @@ -1 +1 @@ -Subproject commit 87080ddc02ad34881c4ccb5d45d903b6f86a6fa6 +Subproject commit a0513075536bbf3b569ee48c0abc015ae4d4ee14