Skip to content

Commit

Permalink
MB-44764 Re-order config check and checkInterval() evaluations
Browse files Browse the repository at this point in the history
The checkInterval method calls isInitial() which inturn iterates
over entire list of instances to see if there is any instance
belonging to the streamId and keyspaceId on which flush was done.

With 10000 indexes on a node, iterating over all 10000 indexes
for every flushDone is a costly call. This can be avoided when
writer tuning is not enabled. Hence, re-ordering the checks
so that we skip the iteration of 10000 indexes

Change-Id: I0b96960dbe8d1375fdf62d409d97d84a82027384
  • Loading branch information
varunv-cb committed Mar 19, 2021
1 parent 12351a7 commit 5205b08
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions secondary/indexer/storage_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ func (s *storageMgr) flushDone(streamId common.StreamId, keyspaceId string,
return true
}

// TODO (Collections): It is not optimal to iterate over
// entire instIdList when there are large number of indexes on
// a node in MAINT_STREAM. This logic needs to be optimised further
// when writer tuning is enabled
for _, instId := range instIdList {
inst, ok := indexInstMap[instId]
if ok && inst.Stream == streamId &&
Expand All @@ -528,8 +532,8 @@ func (s *storageMgr) flushDone(streamId common.StreamId, keyspaceId string,

if common.GetStorageMode() == common.PLASMA {

if time.Now().UnixNano()-s.lastFlushDone > checkInterval() &&
s.config["plasma.writer.tuning.enable"].Bool() {
if s.config["plasma.writer.tuning.enable"].Bool() &&
time.Now().UnixNano()-s.lastFlushDone > checkInterval() {

var wg sync.WaitGroup

Expand Down

0 comments on commit 5205b08

Please sign in to comment.