From 128bdd7af87d1648f78e707e3fe4ae2eb606cece Mon Sep 17 00:00:00 2001 From: Johnny Graettinger Date: Mon, 11 Dec 2023 19:16:05 +0000 Subject: [PATCH] recoverylog: relax FSM to allow updating the content of a property In certain situations, if a RocksDB doesn't fully initialize then it may re-create its IDENTITY file upon the next next open attempt. Currently this is prohibited by FSM but should be relaxed. --- consumer/recoverylog/fsm.go | 2 -- consumer/recoverylog/fsm_test.go | 9 +++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/consumer/recoverylog/fsm.go b/consumer/recoverylog/fsm.go index b760444b..6783ca56 100644 --- a/consumer/recoverylog/fsm.go +++ b/consumer/recoverylog/fsm.go @@ -301,8 +301,6 @@ func (m *FSM) applyWrite(op *RecordedOp) error { func (m *FSM) applyProperty(op *Property) error { if _, ok := m.Links[op.Path]; ok { return ErrLinkExists - } else if content, ok := m.Properties[op.Path]; ok && content != op.Content { - return ErrPropertyExists } if m.Properties == nil { m.Properties = make(map[string]string) diff --git a/consumer/recoverylog/fsm_test.go b/consumer/recoverylog/fsm_test.go index 0372abae..76c5cfb6 100644 --- a/consumer/recoverylog/fsm_test.go +++ b/consumer/recoverylog/fsm_test.go @@ -383,14 +383,11 @@ func (s *FSMSuite) TestPropertyUpdates(c *gc.C) { // Attempting a property update of an existing file fails. c.Check(s.property(44, 0xf11e2261, 100, "/a/path", "bad"), gc.Equals, ErrLinkExists) - // Attempting a property update of an existing property fails. We may change - // this in the future, if a sufficient motivating case appears, but for now - // we apply the most restrictive behavior. - c.Check(s.property(44, 0xf11e2261, 100, "/a/property", "update"), gc.Equals, - ErrPropertyExists) + // An existing property may be updated. + c.Check(s.property(44, 0xf11e2261, 100, "/a/property", "update"), gc.IsNil) c.Check(s.fsm.Properties, gc.DeepEquals, map[string]string{ - "/a/property": "content", + "/a/property": "update", "/another/property": "other-content", }) }