This commit is contained in:
Vlad Lazar
2025-02-20 18:56:34 +01:00
parent 07bee60037
commit 6a6a6fa659
3 changed files with 49 additions and 1 deletions

View File

@@ -793,4 +793,12 @@ mod tests {
Some(Duration::from_secs(5))
);
}
#[test]
fn test_vlad() {
let tenant_conf_opt: TenantConfOpt =
serde_json::from_str("{\"pitr_interval\": \"24h0m0s\"}").unwrap();
let tenant_config: models::TenantConfig = tenant_conf_opt.clone().into();
assert_eq!(tenant_config.pitr_interval.unwrap(), "24h0m0s");
}
}

View File

@@ -1287,7 +1287,13 @@ impl TenantShard {
attached_location_conf(generation, &self.shard, &self.config, &self.policy);
match self.observed.locations.get(&node_id) {
Some(conf) if conf.conf.as_ref() == Some(&wanted_conf) => {}
Some(_) | None => {
Some(conf) => {
tracing::info!("Wanted: {wanted_conf:?}");
tracing::info!("Observed: {conf:?}");
dirty_nodes.insert(node_id);
}
None => {
dirty_nodes.insert(node_id);
}
}

View File

@@ -3764,3 +3764,37 @@ def test_storage_controller_node_flap_detach_race(
assert len(locs) == 1, f"{shard} has {len(locs)} attached locations"
wait_until(validate_locations, timeout=10)
def test_storage_controller_config_equivalence(neon_env_builder: NeonEnvBuilder):
neon_env_builder.num_pageservers = 1
neon_env_builder.storage_controller_config = {
"start_as_candidate": False,
}
env = neon_env_builder.init_configs()
env.start()
tenant_id = TenantId.generate()
env.storage_controller.tenant_create(
tenant_id, shard_count=2, tenant_config={"pitr_interval": "1h2m3s"}
)
env.storage_controller.reconcile_until_idle()
reconciles_before_restart = env.storage_controller.get_metric_value(
"storage_controller_reconcile_complete_total", filter={"status": "ok"}
)
assert reconciles_before_restart != 0
env.storage_controller.stop()
env.storage_controller.start()
env.storage_controller.reconcile_until_idle()
reconciles_after_restart = env.storage_controller.get_metric_value(
"storage_controller_reconcile_complete_total", filter={"status": "ok"}
)
assert reconciles_after_restart == 0