Details
-
Bug
-
Resolution: Fixed
-
Major
-
Morpheus, 7.6.2
-
Untriaged
-
0
-
Unknown
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
For Gerrit Dashboard: MB-61316 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
208102,2 | MB-61316: make sure GetByteSlice will get a slice from (i+1)th datapool if needed | master | goxdcr | Status: MERGED | +2 | +1 |
208410,2 | MB-61316: make sure GetByteSlice will get a slice from (i+1)th datapool if needed | trinity | goxdcr | Status: MERGED | +2 | +1 |