Skip to content

Commit

Permalink
recoverylog: relax FSM to allow updating the content of a property
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jgraettinger committed Dec 11, 2023
1 parent 79690d5 commit 128bdd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 0 additions & 2 deletions consumer/recoverylog/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 3 additions & 6 deletions consumer/recoverylog/fsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})
}
Expand Down

0 comments on commit 128bdd7

Please sign in to comment.