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

[BP 7.2.6] - XDCR - Datapool GetByteSlice logic is flawed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.2.6
    • Morpheus, 7.6.2
    • XDCR

    Description

      Logic for searching datapool "class":
      1. For Put:

      i := sort.Search(NumOfSizes, func(i int) bool {        
            return sliceCap <= p.byteSlicePoolClasses[i]    
      }) 

      2. For Get:

      i := sort.Search(NumOfSizes, func(i int) bool {        
           return p.byteSlicePoolClasses[i] >= sizeRequested    
      }) 

      Classes are 50, 100, 250, 500, ... for i=0, i=1, i=2,...

      Consider the simplest example. Say we "put" a byte slice of capacity 45 - it will go to the "class with max capacity 50 (i=0)" datapool. If I then "get" for a slice with capacity say 49, we will get a slice from "class with max capacity 50 (i=0)" pool - i.e. in this example we get the 45 capacity slice again which was less than what was requested, which will lead to trouble.

      A possible solution would be to use the (i+1)th class's datapool for "get"

      Attachments

        Issue Links

          Activity

            People

              ayush.nayyar Ayush Nayyar
              neil.huang Neil Huang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                PagerDuty