Skip to content

Commit 23e8aaf

Browse files
committed
bugfix: HA switch with checkpoint duplicate update. #388
1 parent 0044e58 commit 23e8aaf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/mongoshake/collector/syncer.go

+12
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ func (sync *OplogSyncer) startBatcher() {
226226
filterFlag := false // marks whether previous log is filter
227227

228228
nimo.GoRoutineInLoop(func() {
229+
/*
230+
* judge self is master?
231+
*/
232+
if !quorum.IsMaster() {
233+
utils.YieldInMs(DurationTime)
234+
return
235+
}
236+
229237
// As much as we can batch more from logs queue. batcher can merge
230238
// a sort of oplogs from different logs queue one by one. the max number
231239
// of oplogs in batch is limited by AdaptiveBatchingMaxSize
@@ -278,6 +286,10 @@ func (sync *OplogSyncer) startBatcher() {
278286
} else {
279287
// if log is nil, check whether filterLog is empty
280288
if filterLog == nil {
289+
// no need to update
290+
return
291+
} else if filterLog.Timestamp <= sync.ckptManager.GetInMemory().Timestamp {
292+
// no need to update
281293
return
282294
} else {
283295
now := time.Now()

0 commit comments

Comments
 (0)