Skip to content

Commit

Permalink
Ignore replayed commands on the metastore.
Browse files Browse the repository at this point in the history
This commit changes the metastore to ignore any commands that are replayed
against it. This is typically handled by the messaging.Conn but there's no
sense in panicing in the metastore if a replayed message comes through.
  • Loading branch information
benbjohnson committed Apr 2, 2015
1 parent 734e57a commit 48f5e52
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ func (m *metastore) mustView(fn func(*metatx) error) (err error) {
// Panics if a disk or system error occurs. Return error from the fn for validation errors.
func (m *metastore) mustUpdate(index uint64, fn func(*metatx) error) (err error) {
if e := m.update(func(tx *metatx) error {
// Ignore replayed commands.
curr := tx.index()
assert(index == 0 || index > curr, "metastore index replay: meta=%d, index=%d", curr, index)
if index > 0 && index <= curr {
return nil
}

// Execute function passed in.
err = fn(tx)
Expand Down

0 comments on commit 48f5e52

Please sign in to comment.