From 23f4c0a74229d111e7f77b7e6498ac22d55d680c Mon Sep 17 00:00:00 2001 From: Egor Suvorov Date: Tue, 12 Oct 2021 22:03:06 +0300 Subject: [PATCH] Rename `wal_acceptor` binary to `safekeeper` (#740), stage 1/2 * Rename wal_acceptor binary to safekeeper * Rename wal_acceptor.pid and wal_acceptor.log to safekeeper.pid and safekeeper.log * Change some mentions of WAL acceptor to safekeeper * Dockerfile: alias wal_acceptor to safekeeper temporarily until internal scripts are updated --- .circleci/config.yml | 2 +- Dockerfile | 4 +++- Dockerfile.alpine | 4 +++- docs/docker.md | 2 +- docs/multitenancy.md | 2 +- test_runner/fixtures/zenith_fixtures.py | 8 ++++---- walkeeper/src/bin/{wal_acceptor.rs => safekeeper.rs} | 12 ++++++------ walkeeper/src/send_wal.rs | 1 - walkeeper/src/timeline.rs | 2 +- walkeeper/src/wal_service.rs | 2 +- 10 files changed, 21 insertions(+), 18 deletions(-) rename walkeeper/src/bin/{wal_acceptor.rs => safekeeper.rs} (94%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 24d151f765..4fab11b1d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -260,7 +260,7 @@ jobs: when: always command: | du -sh /tmp/test_output/* - find /tmp/test_output -type f ! -name "pg.log" ! -name "pageserver.log" ! -name "wal_acceptor.log" ! -name "regression.diffs" ! -name "junit.xml" ! -name "*.filediff" ! -name "*.stdout" ! -name "*.stderr" -delete + find /tmp/test_output -type f ! -name "pg.log" ! -name "pageserver.log" ! -name "safekeeper.log" ! -name "regression.diffs" ! -name "junit.xml" ! -name "*.filediff" ! -name "*.stdout" ! -name "*.stderr" -delete du -sh /tmp/test_output/* - store_artifacts: path: /tmp/test_output diff --git a/Dockerfile b/Dockerfile index b38bac4480..0bbf03d13c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,9 @@ RUN apt-get update && apt-get -yq install libreadline-dev libseccomp-dev openssl mkdir zenith_install COPY --from=build /zenith/target/release/pageserver /usr/local/bin -COPY --from=build /zenith/target/release/wal_acceptor /usr/local/bin +COPY --from=build /zenith/target/release/safekeeper /usr/local/bin +# TODO: temporary alias for compatibility, see https://github.com/zenithdb/zenith/pull/740 +RUN ln -s /usr/local/bin/safekeeper /usr/local/bin/wal_acceptor COPY --from=build /zenith/target/release/proxy /usr/local/bin COPY --from=pg-build /zenith/tmp_install postgres_install COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/Dockerfile.alpine b/Dockerfile.alpine index a2a2fea1a4..e0b569de22 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -81,7 +81,9 @@ FROM alpine:3.13 RUN apk add --update openssl build-base libseccomp-dev RUN apk --no-cache --update --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing add rocksdb COPY --from=build /zenith/target/release/pageserver /usr/local/bin -COPY --from=build /zenith/target/release/wal_acceptor /usr/local/bin +COPY --from=build /zenith/target/release/safekeeper /usr/local/bin +# TODO: temporary alias for compatibility, see https://github.com/zenithdb/zenith/pull/740 +RUN ln -s /usr/local/bin/safekeeper /usr/local/bin/wal_acceptor COPY --from=build /zenith/target/release/proxy /usr/local/bin COPY --from=pg-build /zenith/tmp_install /usr/local COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/docs/docker.md b/docs/docker.md index 9a909ebfe3..14ba2146cb 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -4,7 +4,7 @@ Currently we build two main images: -- [zenithdb/zenith](https://hub.docker.com/repository/docker/zenithdb/zenith) — image with pre-built `pageserver`, `wal_acceptor` and `proxy` binaries and all the required runtime dependencies. Built from [/Dockerfile](/Dockerfile). +- [zenithdb/zenith](https://hub.docker.com/repository/docker/zenithdb/zenith) — image with pre-built `pageserver`, `safekeeper` and `proxy` binaries and all the required runtime dependencies. Built from [/Dockerfile](/Dockerfile). - [zenithdb/compute-node](https://hub.docker.com/repository/docker/zenithdb/compute-node) — compute node image with pre-built Postgres binaries from [zenithdb/postgres](https://github.com/zenithdb/postgres). And two intermediate images used either to reduce build time or to deliver some additional binary tools from other repos: diff --git a/docs/multitenancy.md b/docs/multitenancy.md index c9a95116c5..4f1d45e970 100644 --- a/docs/multitenancy.md +++ b/docs/multitenancy.md @@ -56,4 +56,4 @@ Tenant id is passed to postgres via GUC the same way as the timeline. Tenant id ### Safety -For now particular tenant can only appear on a particular pageserver. Set of WAL acceptors are also pinned to particular (tenantid, timeline) pair so there can only be one writer for particular (tenantid, timeline). +For now particular tenant can only appear on a particular pageserver. Set of safekeepers are also pinned to particular (tenantid, timeline) pair so there can only be one writer for particular (tenantid, timeline). diff --git a/test_runner/fixtures/zenith_fixtures.py b/test_runner/fixtures/zenith_fixtures.py index 597c39db0b..bf861f8b00 100644 --- a/test_runner/fixtures/zenith_fixtures.py +++ b/test_runner/fixtures/zenith_fixtures.py @@ -64,7 +64,7 @@ def pytest_configure(config): raise Exception('Too many workers configured. Cannot distrubute ports for services.') # does not use -c as it is not supported on macOS - cmd = ['pgrep', 'pageserver|postgres|wal_acceptor'] + cmd = ['pgrep', 'pageserver|postgres|safekeeper'] result = subprocess.run(cmd, stdout=subprocess.DEVNULL) if result.returncode == 0: # returncode of 0 means it found something. @@ -72,7 +72,7 @@ def pytest_configure(config): # result of the test. # NOTE this shows as an internal pytest error, there might be a better way raise Exception( - 'Found interfering processes running. Stop all Zenith pageservers, nodes, WALs, as well as stand-alone Postgres.' + 'Found interfering processes running. Stop all Zenith pageservers, nodes, safekeepers, as well as stand-alone Postgres.' ) @@ -843,7 +843,7 @@ class WalAcceptor: @property def pidfile(self) -> Path: - return self.data_dir / "wal_acceptor.pid" + return self.data_dir / "safekeeper.pid" def get_pid(self) -> Optional[int]: if not self.pidfile.exists(): @@ -895,7 +895,7 @@ class WalAcceptor: class WalAcceptorFactory: """ An object representing multiple running wal acceptors. """ def __init__(self, zenith_binpath: Path, data_dir: Path, pageserver_port: int, port_distributor: PortDistributor): - self.wa_bin_path = zenith_binpath / 'wal_acceptor' + self.wa_bin_path = zenith_binpath / 'safekeeper' self.data_dir = data_dir self.instances: List[WalAcceptor] = [] self.port_distributor = port_distributor diff --git a/walkeeper/src/bin/wal_acceptor.rs b/walkeeper/src/bin/safekeeper.rs similarity index 94% rename from walkeeper/src/bin/wal_acceptor.rs rename to walkeeper/src/bin/safekeeper.rs index f961c784d7..0a6448ffd3 100644 --- a/walkeeper/src/bin/wal_acceptor.rs +++ b/walkeeper/src/bin/safekeeper.rs @@ -1,5 +1,5 @@ // -// Main entry point for the wal_acceptor executable +// Main entry point for the safekeeper executable // use anyhow::Result; use clap::{App, Arg}; @@ -20,14 +20,14 @@ use walkeeper::WalAcceptorConf; fn main() -> Result<()> { zenith_metrics::set_common_metrics_prefix("safekeeper"); - let arg_matches = App::new("Zenith wal_acceptor") + let arg_matches = App::new("Zenith safekeeper") .about("Store WAL stream to local file system and push it to WAL receivers") .arg( Arg::with_name("datadir") .short("D") .long("dir") .takes_value(true) - .help("Path to the WAL acceptor data directory"), + .help("Path to the safekeeper data directory"), ) .arg( Arg::with_name("listen-pg") @@ -128,7 +128,7 @@ fn main() -> Result<()> { } fn start_wal_acceptor(conf: WalAcceptorConf) -> Result<()> { - let log_filename = conf.data_dir.join("wal_acceptor.log"); + let log_filename = conf.data_dir.join("safekeeper.log"); let log_file = logging::init(log_filename, conf.daemonize)?; let http_listener = TcpListener::bind(conf.listen_http_addr.clone()).map_err(|e| { @@ -136,7 +136,7 @@ fn start_wal_acceptor(conf: WalAcceptorConf) -> Result<()> { e })?; - info!("Starting wal acceptor on {}", conf.listen_pg_addr); + info!("Starting safekeeper on {}", conf.listen_pg_addr); let pg_listener = TcpListener::bind(conf.listen_pg_addr.clone()).map_err(|e| { error!("failed to bind to address {}: {}", conf.listen_pg_addr, e); e @@ -151,7 +151,7 @@ fn start_wal_acceptor(conf: WalAcceptorConf) -> Result<()> { let stderr = log_file; let daemonize = Daemonize::new() - .pid_file("wal_acceptor.pid") + .pid_file("safekeeper.pid") .working_directory(Path::new(".")) .stdout(stdout) .stderr(stderr); diff --git a/walkeeper/src/send_wal.rs b/walkeeper/src/send_wal.rs index e81b6c5eac..e458939b3c 100644 --- a/walkeeper/src/send_wal.rs +++ b/walkeeper/src/send_wal.rs @@ -20,7 +20,6 @@ use crate::timeline::CreateControlFile; /// Handler for streaming WAL from acceptor pub struct SendWalHandler { - /// wal acceptor configuration pub conf: WalAcceptorConf, /// assigned application name pub appname: Option, diff --git a/walkeeper/src/timeline.rs b/walkeeper/src/timeline.rs index f0d69bed10..5ee97a8a28 100644 --- a/walkeeper/src/timeline.rs +++ b/walkeeper/src/timeline.rs @@ -112,7 +112,7 @@ impl SharedState { } match opts.open(&control_file_path) { Ok(mut file) => { - // Lock file to prevent two or more active wal_acceptors + // Lock file to prevent two or more active safekeepers match file.try_lock_exclusive() { Ok(()) => {} Err(e) => { diff --git a/walkeeper/src/wal_service.rs b/walkeeper/src/wal_service.rs index 747c06a116..4a294e9c95 100644 --- a/walkeeper/src/wal_service.rs +++ b/walkeeper/src/wal_service.rs @@ -36,7 +36,7 @@ fn handle_socket(socket: TcpStream, conf: WalAcceptorConf) -> Result<()> { let mut conn_handler = SendWalHandler::new(conf); let pgbackend = PostgresBackend::new(socket, AuthType::Trust, None, false)?; - // libpq replication protocol between wal_acceptor and replicas/pagers + // libpq replication protocol between safekeeper and replicas/pagers pgbackend.run(&mut conn_handler)?; Ok(())