Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-61228

XDCR - Expand the slice got from datapool to sizeRequested

    XMLWordPrintable

Details

    Description

      The logic for pooling byte slices is based on capacity (and not the length) of the input slice -

      func (p *DataPoolImpl) PutByteSlice(doneSlice []byte) {    
               sliceCap := uint64(cap(doneSlice))    
               i := sort.Search(NumOfSizes, func(i int) bool {        
                    return sliceCap <= p.byteSlicePoolClasses[i]    
                })
                if i >= 0 && i < NumOfSizes {                 
                       p.byteSlicePools[i].Put(doneSlice)    
                }
      } 

      So when we get from the dataPool, we need to make sure that we expand the slice to sizeRequested (which otherwise will be limited by the length of the got slice from the pool which has a capacity of atleast the size that was requested, but the length can be way less than requested size) before using it further. In the current logic, we can therefore fall short with respect to the length of the slice in some cases later.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sumukh.bhat Sumukh Bhat
            sumukh.bhat Sumukh Bhat
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty