mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-27 08:09:58 +00:00
If the 'basebackup' command failed in the middle of building the tar archive, the client would not report the error, but would attempt to to start up postgres with the partial contents of the data directory. That fails because the control file is missing (it's added to the archive last, precisly to make sure that you cannot start postgres from a partial archive). But the client doesn't see the proper error message that caused the basebackup to fail in the server, which is confusing. Two issues conspired to cause that: 1. The tar::Builder object that we use in the pageserver to construct the tar stream has a Drop handler that automatically writes a valid end-of-archive marker on drop. Because of that, the resulting tarball looks complete, even if an error happens while we're building it. The pageserver does send an ErrorResponse after the seemingly-valid tarball, but: 2. The client stops reading the Copy stream, as soon as it sees the tar end-of-archive marker. Therefore, it doesn't read the ErrorResponse that comes after it. We have two clients that call 'basebackup', one in `control_plane` used by the `neon_local` binary, and another one in `compute_tools`. Both had the same issue. This PR fixes both issues, even though fixing either one would be enough to fix the problem at hand. The pageserver now doesn't send the end-of-archive marker on error, and the client now reads the copy stream to the end, even if it sees an end-of-archive marker. Fixes github issue #1715 In the passing, change Basebackup to use generic Write rather than 'dyn'.
24 lines
677 B
TOML
24 lines
677 B
TOML
[package]
|
|
name = "control_plane"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
tar = "0.4.38"
|
|
postgres = { git = "https://github.com/zenithdb/rust-postgres.git", rev="d052ee8b86fff9897c77b0fe89ea9daba0e1fa38" }
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_with = "1.12.0"
|
|
toml = "0.5"
|
|
lazy_static = "1.4"
|
|
regex = "1"
|
|
anyhow = "1.0"
|
|
thiserror = "1"
|
|
nix = "0.23"
|
|
url = "2.2.2"
|
|
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "rustls-tls"] }
|
|
|
|
pageserver = { path = "../pageserver" }
|
|
safekeeper = { path = "../safekeeper" }
|
|
utils = { path = "../libs/utils" }
|
|
workspace_hack = { version = "0.1", path = "../workspace_hack" }
|