Skip to content

Commit

Permalink
MB-41597 optimize index stream merge check
Browse files Browse the repository at this point in the history
If there are mutations pending for the INIT_STREAM, avoid the expensive
call to get KV seqnum. Instead, check for stream merge based on
the seqnum of received mutations.

Change-Id: I16392bc6a84c2908e420e306318c6a09d9f3eb50
  • Loading branch information
deepkaran committed Nov 26, 2020
1 parent f927725 commit 6442a06
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion secondary/indexer/timekeeper.go
Expand Up @@ -2451,10 +2451,17 @@ func (tk *timekeeper) checkFlushTsValidForMerge(streamId common.StreamId, keyspa
return false, nil
}

tsList := tk.ss.streamKeyspaceIdTsListMap[streamId][keyspaceId]
lenInitTs := tsList.Len()

maintTsSeq = getSeqTsFromTsVbuuid(maintFlushTs)
if initTsSeq.GreaterThanEqual(maintTsSeq) {
return true, initFlushTs
} else {
} else if lenInitTs == 0 {
//If there are mutations pending for the INIT_STREAM, avoid the expensive
//call to get KV seqnum. Instead, check for stream merge based on
//the seqnum of received mutations.

//if this stream is on a collection
cid := tk.ss.streamKeyspaceIdCollectionId[streamId][keyspaceId]
if cid != "" {
Expand Down

0 comments on commit 6442a06

Please sign in to comment.