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

XDCR - Datapool GetByteSlice logic is flawed

    XMLWordPrintable

Details

    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

        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:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty