diff --git a/Cargo.lock b/Cargo.lock index e93e73f087..a933b44356 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -381,13 +381,13 @@ dependencies = [ "postgres", "regex", "reqwest", + "safekeeper", "serde", "serde_with", "tar", "thiserror", "toml", "url", - "walkeeper", "workspace_hack", "zenith_utils", ] @@ -2290,6 +2290,45 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +[[package]] +name = "safekeeper" +version = "0.1.0" +dependencies = [ + "anyhow", + "byteorder", + "bytes", + "clap 3.0.14", + "const_format", + "crc32c", + "daemonize", + "etcd-client", + "fs2", + "hex", + "humantime", + "hyper", + "lazy_static", + "postgres", + "postgres-protocol", + "postgres_ffi", + "regex", + "rusoto_core", + "rusoto_s3", + "serde", + "serde_json", + "serde_with", + "signal-hook", + "tempfile", + "tokio", + "tokio-postgres", + "tokio-util 0.7.0", + "tracing", + "url", + "walkdir", + "workspace_hack", + "zenith_metrics", + "zenith_utils", +] + [[package]] name = "same-file" version = "1.0.6" @@ -3089,45 +3128,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "walkeeper" -version = "0.1.0" -dependencies = [ - "anyhow", - "byteorder", - "bytes", - "clap 3.0.14", - "const_format", - "crc32c", - "daemonize", - "etcd-client", - "fs2", - "hex", - "humantime", - "hyper", - "lazy_static", - "postgres", - "postgres-protocol", - "postgres_ffi", - "regex", - "rusoto_core", - "rusoto_s3", - "serde", - "serde_json", - "serde_with", - "signal-hook", - "tempfile", - "tokio", - "tokio-postgres", - "tokio-util 0.7.0", - "tracing", - "url", - "walkdir", - "workspace_hack", - "zenith_metrics", - "zenith_utils", -] - [[package]] name = "want" version = "0.3.0" @@ -3369,8 +3369,8 @@ dependencies = [ "pageserver", "postgres", "postgres_ffi", + "safekeeper", "serde_json", - "walkeeper", "workspace_hack", "zenith_utils", ] diff --git a/Cargo.toml b/Cargo.toml index b8283a6112..4b3b31e0b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = [ "pageserver", "postgres_ffi", "proxy", - "walkeeper", + "safekeeper", "workspace_hack", "zenith", "zenith_metrics", diff --git a/control_plane/Cargo.toml b/control_plane/Cargo.toml index e118ea4793..80b6c00dd2 100644 --- a/control_plane/Cargo.toml +++ b/control_plane/Cargo.toml @@ -18,6 +18,6 @@ url = "2.2.2" reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "rustls-tls"] } pageserver = { path = "../pageserver" } -walkeeper = { path = "../walkeeper" } +safekeeper = { path = "../safekeeper" } zenith_utils = { path = "../zenith_utils" } workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/control_plane/src/safekeeper.rs b/control_plane/src/safekeeper.rs index 89ab0a31ee..e23138bd3f 100644 --- a/control_plane/src/safekeeper.rs +++ b/control_plane/src/safekeeper.rs @@ -14,7 +14,7 @@ use postgres::Config; use reqwest::blocking::{Client, RequestBuilder, Response}; use reqwest::{IntoUrl, Method}; use thiserror::Error; -use walkeeper::http::models::TimelineCreateRequest; +use safekeeper::http::models::TimelineCreateRequest; use zenith_utils::http::error::HttpErrorBody; use zenith_utils::zid::{ZNodeId, ZTenantId, ZTimelineId}; diff --git a/docs/README.md b/docs/README.md index 0558fa24a8..a3fcd20bd2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,5 +10,5 @@ - [pageserver/README](/pageserver/README) — pageserver overview. - [postgres_ffi/README](/postgres_ffi/README) — Postgres FFI overview. - [test_runner/README.md](/test_runner/README.md) — tests infrastructure overview. -- [walkeeper/README](/walkeeper/README) — WAL service overview. +- [safekeeper/README](/safekeeper/README) — WAL service overview. - [core_changes.md](core_changes.md) - Description of Zenith changes in Postgres core diff --git a/docs/glossary.md b/docs/glossary.md index 0f82f2d666..ecc57b9ed1 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -29,7 +29,7 @@ Each Branch lives in a corresponding timeline[] and has an ancestor[]. NOTE: This is an overloaded term. -A checkpoint record in the WAL marks a point in the WAL sequence at which it is guaranteed that all data files have been updated with all information from shared memory modified before that checkpoint; +A checkpoint record in the WAL marks a point in the WAL sequence at which it is guaranteed that all data files have been updated with all information from shared memory modified before that checkpoint; ### Checkpoint (Layered repository) @@ -108,10 +108,10 @@ PostgreSQL LSNs and functions to monitor them: * `pg_current_wal_lsn()` - Returns the current write-ahead log write location. * `pg_current_wal_flush_lsn()` - Returns the current write-ahead log flush location. * `pg_last_wal_receive_lsn()` - Returns the last write-ahead log location that has been received and synced to disk by streaming replication. While streaming replication is in progress this will increase monotonically. -* `pg_last_wal_replay_lsn ()` - Returns the last write-ahead log location that has been replayed during recovery. If recovery is still in progress this will increase monotonically. +* `pg_last_wal_replay_lsn ()` - Returns the last write-ahead log location that has been replayed during recovery. If recovery is still in progress this will increase monotonically. [source PostgreSQL documentation](https://www.postgresql.org/docs/devel/functions-admin.html): -Zenith safekeeper LSNs. For more check [walkeeper/README_PROTO.md](/walkeeper/README_PROTO.md) +Zenith safekeeper LSNs. For more check [safekeeper/README_PROTO.md](/safekeeper/README_PROTO.md) * `CommitLSN`: position in WAL confirmed by quorum safekeepers. * `RestartLSN`: position in WAL confirmed by all safekeepers. * `FlushLSN`: part of WAL persisted to the disk by safekeeper. @@ -190,7 +190,7 @@ or we do not support them in zenith yet (pg_commit_ts). Tenant represents a single customer, interacting with Zenith. Wal redo[] activity, timelines[], layers[] are managed for each tenant independently. One pageserver[] can serve multiple tenants at once. -One safekeeper +One safekeeper See `docs/multitenancy.md` for more. diff --git a/docs/rfcs/009-snapshot-first-storage-cli.md b/docs/rfcs/009-snapshot-first-storage-cli.md index 3f5386c165..11ded3a724 100644 --- a/docs/rfcs/009-snapshot-first-storage-cli.md +++ b/docs/rfcs/009-snapshot-first-storage-cli.md @@ -12,7 +12,7 @@ Init empty pageserver using `initdb` in temporary directory. `--storage_dest=FILE_PREFIX | S3_PREFIX |...` option defines object storage type, all other parameters are passed via env variables. Inspired by WAL-G style naming : https://wal-g.readthedocs.io/STORAGES/. -Save`storage_dest` and other parameters in config. +Save`storage_dest` and other parameters in config. Push snapshots to `storage_dest` in background. ``` @@ -21,7 +21,7 @@ zenith start ``` #### 2. Restart pageserver (manually or crash-recovery). -Take `storage_dest` from pageserver config, start pageserver from latest snapshot in `storage_dest`. +Take `storage_dest` from pageserver config, start pageserver from latest snapshot in `storage_dest`. Push snapshots to `storage_dest` in background. ``` @@ -32,7 +32,7 @@ zenith start Start pageserver from existing snapshot. Path to snapshot provided via `--snapshot_path=FILE_PREFIX | S3_PREFIX | ...` Do not save `snapshot_path` and `snapshot_format` in config, as it is a one-time operation. -Save`storage_dest` parameters in config. +Save`storage_dest` parameters in config. Push snapshots to `storage_dest` in background. ``` //I.e. we want to start zenith on top of existing $PGDATA and use s3 as a persistent storage. @@ -42,15 +42,15 @@ zenith start How to pass credentials needed for `snapshot_path`? #### 4. Export. -Manually push snapshot to `snapshot_path` which differs from `storage_dest` +Manually push snapshot to `snapshot_path` which differs from `storage_dest` Optionally set `snapshot_format`, which can be plain pgdata format or zenith format. ``` zenith export --snapshot_path=FILE_PREFIX --snapshot_format=pgdata ``` #### Notes and questions -- walkeeper s3_offload should use same (similar) syntax for storage. How to set it in UI? +- safekeeper s3_offload should use same (similar) syntax for storage. How to set it in UI? - Why do we need `zenith init` as a separate command? Can't we init everything at first start? - We can think of better names for all options. - Export to plain postgres format will be useless, if we are not 100% compatible on page level. -I can recall at least one such difference - PD_WAL_LOGGED flag in pages. \ No newline at end of file +I can recall at least one such difference - PD_WAL_LOGGED flag in pages. diff --git a/docs/sourcetree.md b/docs/sourcetree.md index 89b07de8d2..b15294d67f 100644 --- a/docs/sourcetree.md +++ b/docs/sourcetree.md @@ -57,12 +57,12 @@ PostgreSQL extension that implements storage manager API and network communicati PostgreSQL extension that contains functions needed for testing and debugging. -`/walkeeper`: +`/safekeeper`: The zenith WAL service that receives WAL from a primary compute nodes and streams it to the pageserver. It acts as a holding area and redistribution center for recently generated WAL. -For more detailed info, see `/walkeeper/README` +For more detailed info, see `/safekeeper/README` `/workspace_hack`: The workspace_hack crate exists only to pin down some dependencies. diff --git a/postgres_ffi/src/waldecoder.rs b/postgres_ffi/src/waldecoder.rs index ac48b1b0f3..ce5aaf722d 100644 --- a/postgres_ffi/src/waldecoder.rs +++ b/postgres_ffi/src/waldecoder.rs @@ -4,7 +4,7 @@ //! This understands the WAL page and record format, enough to figure out where the WAL record //! boundaries are, and to reassemble WAL records that cross page boundaries. //! -//! This functionality is needed by both the pageserver and the walkeepers. The pageserver needs +//! This functionality is needed by both the pageserver and the safekeepers. The pageserver needs //! to look deeper into the WAL records to also understand which blocks they modify, the code //! for that is in pageserver/src/walrecord.rs //! diff --git a/walkeeper/Cargo.toml b/safekeeper/Cargo.toml similarity index 98% rename from walkeeper/Cargo.toml rename to safekeeper/Cargo.toml index 86aa56c9ae..ca5e2a6b55 100644 --- a/walkeeper/Cargo.toml +++ b/safekeeper/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "walkeeper" +name = "safekeeper" version = "0.1.0" edition = "2021" diff --git a/walkeeper/README b/safekeeper/README similarity index 100% rename from walkeeper/README rename to safekeeper/README diff --git a/walkeeper/README_PROTO.md b/safekeeper/README_PROTO.md similarity index 100% rename from walkeeper/README_PROTO.md rename to safekeeper/README_PROTO.md diff --git a/walkeeper/spec/ProposerAcceptorConsensus.cfg b/safekeeper/spec/ProposerAcceptorConsensus.cfg similarity index 100% rename from walkeeper/spec/ProposerAcceptorConsensus.cfg rename to safekeeper/spec/ProposerAcceptorConsensus.cfg diff --git a/walkeeper/spec/ProposerAcceptorConsensus.tla b/safekeeper/spec/ProposerAcceptorConsensus.tla similarity index 100% rename from walkeeper/spec/ProposerAcceptorConsensus.tla rename to safekeeper/spec/ProposerAcceptorConsensus.tla diff --git a/walkeeper/src/bin/safekeeper.rs b/safekeeper/src/bin/safekeeper.rs similarity index 97% rename from walkeeper/src/bin/safekeeper.rs rename to safekeeper/src/bin/safekeeper.rs index b3087a1004..490198231d 100644 --- a/walkeeper/src/bin/safekeeper.rs +++ b/safekeeper/src/bin/safekeeper.rs @@ -12,18 +12,18 @@ use std::path::{Path, PathBuf}; use std::thread; use tracing::*; use url::{ParseError, Url}; -use walkeeper::control_file::{self}; use zenith_utils::http::endpoint; use zenith_utils::zid::ZNodeId; use zenith_utils::{logging, tcp_listener, GIT_VERSION}; +use safekeeper::control_file::{self}; +use safekeeper::defaults::{DEFAULT_HTTP_LISTEN_ADDR, DEFAULT_PG_LISTEN_ADDR}; +use safekeeper::http; +use safekeeper::s3_offload; +use safekeeper::wal_service; +use safekeeper::SafeKeeperConf; +use safekeeper::{broker, callmemaybe}; use tokio::sync::mpsc; -use walkeeper::defaults::{DEFAULT_HTTP_LISTEN_ADDR, DEFAULT_PG_LISTEN_ADDR}; -use walkeeper::http; -use walkeeper::s3_offload; -use walkeeper::wal_service; -use walkeeper::SafeKeeperConf; -use walkeeper::{broker, callmemaybe}; use zenith_utils::shutdown::exit_now; use zenith_utils::signals; diff --git a/walkeeper/src/broker.rs b/safekeeper/src/broker.rs similarity index 100% rename from walkeeper/src/broker.rs rename to safekeeper/src/broker.rs diff --git a/walkeeper/src/callmemaybe.rs b/safekeeper/src/callmemaybe.rs similarity index 100% rename from walkeeper/src/callmemaybe.rs rename to safekeeper/src/callmemaybe.rs diff --git a/walkeeper/src/control_file.rs b/safekeeper/src/control_file.rs similarity index 100% rename from walkeeper/src/control_file.rs rename to safekeeper/src/control_file.rs diff --git a/walkeeper/src/control_file_upgrade.rs b/safekeeper/src/control_file_upgrade.rs similarity index 100% rename from walkeeper/src/control_file_upgrade.rs rename to safekeeper/src/control_file_upgrade.rs diff --git a/walkeeper/src/handler.rs b/safekeeper/src/handler.rs similarity index 98% rename from walkeeper/src/handler.rs rename to safekeeper/src/handler.rs index 00d177da56..bb14049787 100644 --- a/walkeeper/src/handler.rs +++ b/safekeeper/src/handler.rs @@ -94,7 +94,7 @@ impl postgres_backend::Handler for SafekeeperPostgresHandler { Ok(()) } else { - bail!("Walkeeper received unexpected initial message: {:?}", sm); + bail!("Safekeeper received unexpected initial message: {:?}", sm); } } diff --git a/walkeeper/src/http/mod.rs b/safekeeper/src/http/mod.rs similarity index 100% rename from walkeeper/src/http/mod.rs rename to safekeeper/src/http/mod.rs diff --git a/walkeeper/src/http/models.rs b/safekeeper/src/http/models.rs similarity index 100% rename from walkeeper/src/http/models.rs rename to safekeeper/src/http/models.rs diff --git a/walkeeper/src/http/routes.rs b/safekeeper/src/http/routes.rs similarity index 100% rename from walkeeper/src/http/routes.rs rename to safekeeper/src/http/routes.rs diff --git a/walkeeper/src/json_ctrl.rs b/safekeeper/src/json_ctrl.rs similarity index 100% rename from walkeeper/src/json_ctrl.rs rename to safekeeper/src/json_ctrl.rs diff --git a/walkeeper/src/lib.rs b/safekeeper/src/lib.rs similarity index 100% rename from walkeeper/src/lib.rs rename to safekeeper/src/lib.rs diff --git a/walkeeper/src/receive_wal.rs b/safekeeper/src/receive_wal.rs similarity index 100% rename from walkeeper/src/receive_wal.rs rename to safekeeper/src/receive_wal.rs diff --git a/walkeeper/src/s3_offload.rs b/safekeeper/src/s3_offload.rs similarity index 100% rename from walkeeper/src/s3_offload.rs rename to safekeeper/src/s3_offload.rs diff --git a/walkeeper/src/safekeeper.rs b/safekeeper/src/safekeeper.rs similarity index 100% rename from walkeeper/src/safekeeper.rs rename to safekeeper/src/safekeeper.rs diff --git a/walkeeper/src/send_wal.rs b/safekeeper/src/send_wal.rs similarity index 100% rename from walkeeper/src/send_wal.rs rename to safekeeper/src/send_wal.rs diff --git a/walkeeper/src/timeline.rs b/safekeeper/src/timeline.rs similarity index 100% rename from walkeeper/src/timeline.rs rename to safekeeper/src/timeline.rs diff --git a/walkeeper/src/wal_service.rs b/safekeeper/src/wal_service.rs similarity index 100% rename from walkeeper/src/wal_service.rs rename to safekeeper/src/wal_service.rs diff --git a/walkeeper/src/wal_storage.rs b/safekeeper/src/wal_storage.rs similarity index 100% rename from walkeeper/src/wal_storage.rs rename to safekeeper/src/wal_storage.rs diff --git a/zenith/Cargo.toml b/zenith/Cargo.toml index 74aeffb51c..69283d3763 100644 --- a/zenith/Cargo.toml +++ b/zenith/Cargo.toml @@ -12,7 +12,7 @@ postgres = { git = "https://github.com/zenithdb/rust-postgres.git", rev="2949d98 # FIXME: 'pageserver' is needed for BranchInfo. Refactor pageserver = { path = "../pageserver" } control_plane = { path = "../control_plane" } -walkeeper = { path = "../walkeeper" } +safekeeper = { path = "../safekeeper" } postgres_ffi = { path = "../postgres_ffi" } zenith_utils = { path = "../zenith_utils" } workspace_hack = { version = "0.1", path = "../workspace_hack" } diff --git a/zenith/src/main.rs b/zenith/src/main.rs index f5d4184e63..97b07b7b74 100644 --- a/zenith/src/main.rs +++ b/zenith/src/main.rs @@ -12,7 +12,7 @@ use pageserver::config::defaults::{ use std::collections::{BTreeSet, HashMap}; use std::process::exit; use std::str::FromStr; -use walkeeper::defaults::{ +use safekeeper::defaults::{ DEFAULT_HTTP_LISTEN_PORT as DEFAULT_SAFEKEEPER_HTTP_PORT, DEFAULT_PG_LISTEN_PORT as DEFAULT_SAFEKEEPER_PG_PORT, };