Make use of postgres --sync-safekeepers in tests and CLI.

Change control plane code to call `postgres --sync-safekeepers` before
compute node start when safekeepers are enabled. Now `pg create` will
create an empty data directory with the proper config file. Subsequent
`pg start` will run `sync-safekeepers` and will call basebackup with
the resulting LSN. Also change few tests to accommodate this new behavior.
This commit is contained in:
Stas Kelvich
2021-09-06 13:06:20 +03:00
committed by arssher
parent 2cf3a70be5
commit ed4eed0a19
5 changed files with 141 additions and 101 deletions
+7 -4
View File
@@ -447,9 +447,8 @@ fn handle_pg(pg_match: &ArgMatches, env: &local_env::LocalEnv) -> Result<()> {
.value_of("tenantid")
.map_or(Ok(env.tenantid), |value| value.parse())?;
let timeline_name = create_match.value_of("timeline").unwrap_or("main");
let config_only = create_match.is_present("config-only");
cplane.new_node(tenantid, timeline_name, config_only)?;
cplane.new_node(tenantid, timeline_name)?;
}
("start", Some(start_match)) => {
let tenantid: ZTenantId = start_match
@@ -466,11 +465,15 @@ fn handle_pg(pg_match: &ArgMatches, env: &local_env::LocalEnv) -> Result<()> {
None
};
println!("Starting postgres on timeline {}...", timeline_name);
println!(
"Starting {} postgres on timeline {}...",
if node.is_some() { "existing" } else { "new" },
timeline_name
);
if let Some(node) = node {
node.start(&auth_token)?;
} else {
let node = cplane.new_node(tenantid, timeline_name, false)?;
let node = cplane.new_node(tenantid, timeline_name)?;
node.start(&auth_token)?;
}
}