diff --git a/satellite/durability/observer.go b/satellite/durability/observer.go index 4ed4d9157..d3f344f04 100644 --- a/satellite/durability/observer.go +++ b/satellite/durability/observer.go @@ -126,10 +126,16 @@ func (c *Report) Start(ctx context.Context, startTime time.Time) error { return errs.Wrap(err) } c.aliasMap = aliasMap + c.resetStat() c.classifyNodeAliases() return nil } +func (c *Report) resetStat() { + c.healthStat = make(map[string]*HealthStat) + c.busFactor = HealthStat{} +} + func (c *Report) classifyNodeAliases() { c.classID = make(map[string]classID, len(c.classifiers)) c.className = make(map[classID]string, len(c.classifiers)) diff --git a/satellite/durability/observer_test.go b/satellite/durability/observer_test.go index f0834d49e..dfa960ffb 100644 --- a/satellite/durability/observer_test.go +++ b/satellite/durability/observer_test.go @@ -103,6 +103,18 @@ func TestDurability(t *testing.T) { require.Equal(t, segment1.StreamID.String()+"/0", c.healthStat["net:127.0.0.0"].Exemplar) require.Equal(t, 2, c.healthStat["net:127.0.1.0"].Min()) require.Equal(t, 3, c.healthStat["net:127.0.2.0"].Min()) + + // usually called with c.Start() + c.resetStat() + + fork, err = c.Fork(ctx) + require.NoError(t, err) + err = c.Join(ctx, fork) + require.NoError(t, err) + + // second run supposed to have zero stat. + require.Nil(t, c.healthStat["net:127.0.0.0"]) + } func TestDurabilityUnknownNode(t *testing.T) {