Skip to content
Snippets Groups Projects
Commit a4aa095c authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

fix: vshard used to break box.cfg.listen value

parent f9620f09
No related branches found
No related tags found
1 merge request!869fix: vshard used to break box.cfg.listen value
Pipeline #32814 passed
...@@ -22,11 +22,12 @@ crate::define_rpc_request! { ...@@ -22,11 +22,12 @@ crate::define_rpc_request! {
node.wait_index(req.applied, req.timeout)?; node.wait_index(req.applied, req.timeout)?;
node.status().check_term(req.term)?; node.status().check_term(req.term)?;
let cfg = node.storage.properties.target_vshard_config()?;
crate::tlog!(Debug, "vshard config: {cfg:?}");
let lua = ::tarantool::lua_state(); let lua = ::tarantool::lua_state();
let mut cfg = node.storage.properties.target_vshard_config()?;
cfg.listen = Some(lua.eval("return box.info.listen")?);
crate::tlog!(Debug, "vshard config: {cfg:?}");
if !req.do_reconfigure { if !req.do_reconfigure {
if let Some(tlua::True) = lua.eval("return pico._vshard_is_configured")? { if let Some(tlua::True) = lua.eval("return pico._vshard_is_configured")? {
return Ok(Response {}); return Ok(Response {});
......
...@@ -14,6 +14,13 @@ use std::collections::HashMap; ...@@ -14,6 +14,13 @@ use std::collections::HashMap;
pub struct VshardConfig { pub struct VshardConfig {
sharding: HashMap<String, ReplicasetSpec>, sharding: HashMap<String, ReplicasetSpec>,
discovery_mode: DiscoveryMode, discovery_mode: DiscoveryMode,
/// This field is not stored in the global storage, instead
/// it is set right before the config is passed into vshard.*.cfg,
/// otherwise vshard will override it with an incorrect value.
#[serde(skip_serializing_if="Option::is_none")]
#[serde(default)]
pub listen: Option<String>,
} }
#[rustfmt::skip] #[rustfmt::skip]
...@@ -110,6 +117,7 @@ impl VshardConfig { ...@@ -110,6 +117,7 @@ impl VshardConfig {
} }
Self { Self {
listen: None,
sharding, sharding,
discovery_mode: DiscoveryMode::On, discovery_mode: DiscoveryMode::On,
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment