fix(#1115): commit perm+topology changes under META_LOCK to prevent dirty working tree
This commit is contained in:
parent
057c673be8
commit
ed50b858c5
3 changed files with 83 additions and 12 deletions
|
|
@ -585,11 +585,14 @@ impl Coordinator {
|
|||
let topo_before = crate::topology::read();
|
||||
let old_parent = topo_before.get(child).cloned().flatten();
|
||||
|
||||
// The disk write happens here; topology validation +
|
||||
// idempotent fast-path inside `set_parent` may short-circuit
|
||||
// (same parent → no-op). We mirror the same idempotent shape
|
||||
// for the notifications: if nothing changed, send nothing.
|
||||
crate::topology::set_parent(child, new_parent)?;
|
||||
// The disk write + git commit happen here under META_LOCK, so
|
||||
// the topology.json change is committed atomically and the
|
||||
// working tree is never left dirty between the write and the
|
||||
// next meta operation. Topology validation + idempotent
|
||||
// fast-path inside `set_parent` may short-circuit (same
|
||||
// parent → no-op). We mirror the same idempotent shape for
|
||||
// the notifications: if nothing changed, send nothing.
|
||||
crate::meta::commit_topology(child, new_parent).await?;
|
||||
|
||||
let changed = old_parent.as_deref() != new_parent;
|
||||
if changed {
|
||||
|
|
|
|||
Loading…
Reference in a new issue