HOTFIX: Fix infinite loop in AbstractIndex.indexSlotRangeFor
Fixes regression from which causing an infinite loop in `binarySearch`.
Reviewers: Ismael Juma
@@ -29,8 +29,6 @@ import kafka.utils.CoreUtils.inLock
import kafka.utils.{CoreUtils, Logging}
import org.apache.kafka.common.utils.{ByteBufferUnmapper, OperatingSystem, Utils}
-import scala.math.ceil
-
/**
* The abstract index class which holds entry format agnostic methods.
*
@@ -377,7 +375,7 @@ abstract class AbstractIndex[K, V](@volatile var file: File, val baseOffset: Lon
var lo = begin
var hi = end
while(lo < hi) {
- val mid = (lo + hi) >>> 1
+ val mid = (lo + hi + 1) >>> 1
val found = parseEntry(idx, mid)
val compareResult = compareIndexEntry(found, target, searchEntity)
if(compareResult > 0)
