Skip to content

Commit

Permalink
Merge pull request #86 from kakao/fix-dup-register-logstream
Browse files Browse the repository at this point in the history
fix(mr): handle duplicated RegisterLogStream(#62)
  • Loading branch information
hungryjang authored Aug 26, 2022
2 parents 9870ad2 + 861b3b0 commit 16a35ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/metarepos/raft_metadata_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func NewRaftMetadataRepository(options *MetadataRepositoryOptions) *RaftMetadata
sw: stopwaiter.New(),
tmStub: tmStub,
topicEndPos: make(map[types.TopicID]int),
requestNum: uint64(time.Now().UnixNano()),
}

mr.storage = NewMetadataStorage(mr.sendAck, options.SnapCount, mr.logger.Named("storage"))
Expand Down
5 changes: 5 additions & 0 deletions internal/metarepos/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ func (ms *MetadataStorage) registerLogStream(ls *varlogpb.LogStreamDescriptor) e
return verrors.ErrAlreadyExists
}

if equal {
// To ensure that it is applied to the meta cache
return nil
}

_, cur := ms.getStateMachine()

ms.mtMu.Lock()
Expand Down

0 comments on commit 16a35ea

Please sign in to comment.