New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification Request for brod:fetch #251
Comments
Which brod version and which kafka version were you testing? However, the messages are not that big, i.e. 3 messages are obviously less than 100K. |
there are 40 hours between timestamp of message at offset 2 and offset 3, could you check in kafka log-data directory, see if there are two segments for that partition ? |
that should be it. |
Ok, so it is expected. The code I have doing the fetch looks like this; does this seem correct? defp fetch(acc, hosts, topic, partition, start, total_count) do
case :brod.fetch(default_hosts(), topic, partition, start) do
{:ok, []} -> acc
{:error, reason} -> {:error, reason}
{_, messages} ->
result = acc ++ messages
case (length(result) < total_count) do
true -> fetch(result, hosts, topic, partition, start + length(result), total_count)
false -> result
end
end
end |
Seem correct. But it’s probably better to connect leader then use brod_util:fetch/4 to avoid re-connect for each attempt. |
Thank you for the review. |
Should be start+length(messages) not length(result) |
See attached screen shot ...
brod:fetch using the earliest offset only seems to be returning a subset of messages.
In this case, There are 5 messages in partition 0. Earliest offset is 0, latest is 5. A call to fetch using offset 0 returns message 0,1 and 2. Calling fetch with offset 3 returns the last two messages.
Is this expected? Anyway to get back all 5 with a single fetch call?
The text was updated successfully, but these errors were encountered: