Skip to content

Commit

Permalink
Implementation of kvcq message heap estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
LetLetMe committed Oct 9, 2024
1 parent 954295d commit 7d76207
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ public void increaseQueueOffset(QueueOffsetOperator queueOffsetOperator, Message
queueOffsetOperator.increaseQueueOffset(topicQueueKey, messageNum);
}

public static void main(String[] args) {
System.out.println((long)(1000 * (1 /(1000 *1.0))));
}
@Override
public long estimateMessageCount(long from, long to, MessageFilter filter) {
if (from >= to) {
Expand All @@ -242,7 +245,8 @@ public long estimateMessageCount(long from, long to, MessageFilter filter) {
matchSize++;
}
}
return (to - from) * (matchSize / sampleSize);
// Make sure the second half is a floating point number, otherwise it will be truncated to 0
return (long)((to - from) * (matchSize / (sampleSize * 1.0)));
}

@Override
Expand Down

0 comments on commit 7d76207

Please sign in to comment.