You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ij...@apache.org on 2019/11/17 18:08:57 UTC
[kafka] branch trunk updated: HOTFIX: Fix infinite loop in
AbstractIndex.indexSlotRangeFor (#7702)
This is an automated email from the ASF dual-hosted git repository.
ijuma pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new ca7a5ea HOTFIX: Fix infinite loop in AbstractIndex.indexSlotRangeFor (#7702)
ca7a5ea is described below
commit ca7a5eae890fd92cb9794ee0923d424a7e680d61
Author: Jason Gustafson <ja...@confluent.io>
AuthorDate: Sun Nov 17 10:08:29 2019 -0800
HOTFIX: Fix infinite loop in AbstractIndex.indexSlotRangeFor (#7702)
Fixes regression from #5378 which causing an infinite loop in `binarySearch`.
Reviewers: Ismael Juma <is...@juma.me.uk>
---
core/src/main/scala/kafka/log/AbstractIndex.scala | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/core/src/main/scala/kafka/log/AbstractIndex.scala b/core/src/main/scala/kafka/log/AbstractIndex.scala
index 71887f1..8e70ae1 100644
--- a/core/src/main/scala/kafka/log/AbstractIndex.scala
+++ b/core/src/main/scala/kafka/log/AbstractIndex.scala
@@ -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)