Skip to content

Commit

Permalink
MB-51371: Return emtpy array when local KV has no vb for bucket
Browse files Browse the repository at this point in the history
* In case ephemeral buckets when mcd crashes the active vbuckets are not
  restored automatically and recovered kv does does not have any active
  vbuckets.
* Vbno32to16 in getLocalVBuckets earlier used to convert nil array to
  emtpty array and Vbno32to16 was removed to have avoid mutiple conversions
  when integrating cinfo lite
* SelectByVbuckets selects all the vbuckets when input is nil. So
  projector is trying to find owner of all the vbuckets when KV owns none
* Fix is to return empty array in place of nil so that no vbuckets are
  selected in SelectByVbuckets as it was being done internally in Vbno32to16

Change-Id: Id6031856d29a73b4a259296afc2d631daf3fae85
  • Loading branch information
ksaikrishnateja committed Mar 15, 2022
1 parent 32f2dd6 commit 3dea9a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions secondary/projector/feed.go
Expand Up @@ -1893,6 +1893,16 @@ func (feed *Feed) getLocalVbuckets(pooln, bucketn string, opaque uint16) ([]uint
fmsg := "%v ##%x vbmap {%v,%v} - %v\n"
logging.Infof(fmsg, feed.logPrefix, opaque, pooln, bucketn, vbnos)

// vbnos is nil if KV does not own any vbuckets for this Bucket.
// it can be when MCD crashes and all the vbuckets data for ephemeral
// bucket is lost and active vBuckets will not be restored automatically
// on recovery
// return empty array & not nil as output of this function is passed to
// SelectByVBuckets and it will select everything when vbnos is nil.
if len(vbnos) == 0 {
vbnos = make([]uint16, 0)
}

return vbnos, nil
}

Expand Down

0 comments on commit 3dea9a0

Please sign in to comment.