From 861b3b05c0670a2dcae6d6505eacdb21dc375134 Mon Sep 17 00:00:00 2001 From: "pharrell.jang" Date: Fri, 26 Aug 2022 13:12:52 +0900 Subject: [PATCH] fix(mr): handle duplicated RegisterLogStream(#62) --- internal/metarepos/raft_metadata_repository.go | 1 + internal/metarepos/storage.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/internal/metarepos/raft_metadata_repository.go b/internal/metarepos/raft_metadata_repository.go index a6867b62f..a229371a5 100644 --- a/internal/metarepos/raft_metadata_repository.go +++ b/internal/metarepos/raft_metadata_repository.go @@ -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")) diff --git a/internal/metarepos/storage.go b/internal/metarepos/storage.go index 09a5f4e2a..1ca48d972 100644 --- a/internal/metarepos/storage.go +++ b/internal/metarepos/storage.go @@ -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()