-
Notifications
You must be signed in to change notification settings - Fork 200
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
brod:fold doesn't work when there have been transactions #588
Comments
The LastOffset in the flatten_batches function seems to be the correct one. Fetch function even has it as NewBeginOffset0 +1. But the fetch does not return it. If it would, then we wouldn't need to do the Line 644 in 636e448
We could improve the brod_utils:fetch/4, but it's an exported function and is also used by brod:fetch. We could change the latter to keep backward compatibility, but I don't know if brod_utils is also considered a public interface from the compatibility point of view. @zmstone, what do you think? |
The brod:fold/8 did not work correctly when the last message in the message set a transaction commit. The output looked like this: ``` %%% brod_consumer_SUITE ==> t_fold_transactions: FAILED %%% brod_consumer_SUITE ==> {function_clause, [{lists,last,[[]],[{file,"lists.erl"},{line,228}]}, {brod_utils,handle_fetch_rsp,7, [{file,"/home/indrek/gems/brod/src/brod_utils.erl"},{line,661}]}, {brod_consumer_SUITE,t_fold_transactions,1, [{file,"/home/indrek/gems/brod/test/brod_consumer_SUITE.erl"}, {line,443}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1224}]}]} ``` The issue was that `#kafka_message{offset = LastOffset} = lists:last(Msgs),` was used, when the Msgs list was empty. Now instead of trying to infer next offset from the kafka_message, we pass the NextFetchOffset from the brod_utils:fetch/4 function. Fixes kafka4beam#588
Got something working, hopefully it makes sense: #589 |
The brod:fold/8 did not work correctly when the last message in the message set a transaction commit. The output looked like this: ``` %%% brod_consumer_SUITE ==> t_fold_transactions: FAILED %%% brod_consumer_SUITE ==> {function_clause, [{lists,last,[[]],[{file,"lists.erl"},{line,228}]}, {brod_utils,handle_fetch_rsp,7, [{file,"/home/indrek/gems/brod/src/brod_utils.erl"},{line,661}]}, {brod_consumer_SUITE,t_fold_transactions,1, [{file,"/home/indrek/gems/brod/test/brod_consumer_SUITE.erl"}, {line,443}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1224}]}]} ``` The issue was that `#kafka_message{offset = LastOffset} = lists:last(Msgs),` was used, when the Msgs list was empty. Now instead of trying to infer next offset from the kafka_message, we pass the NextFetchOffset from the brod_utils:fetch/4 function. Fixes kafka4beam#588
The brod:fold/8 did not work correctly when the last message in the message set a transaction commit. The output looked like this: ``` %%% brod_consumer_SUITE ==> t_fold_transactions: FAILED %%% brod_consumer_SUITE ==> {function_clause, [{lists,last,[[]],[{file,"lists.erl"},{line,228}]}, {brod_utils,handle_fetch_rsp,7, [{file,"/home/indrek/gems/brod/src/brod_utils.erl"},{line,661}]}, {brod_consumer_SUITE,t_fold_transactions,1, [{file,"/home/indrek/gems/brod/test/brod_consumer_SUITE.erl"}, {line,443}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1224}]}]} ``` The issue was that `#kafka_message{offset = LastOffset} = lists:last(Msgs),` was used, when the Msgs list was empty. Now instead of trying to infer next offset from the kafka_message, we pass the NextFetchOffset from the brod_utils:fetch/4 function. Fixes kafka4beam#588
The brod:fold/8 did not work correctly when the last message in the message set a transaction commit. The output looked like this: ``` %%% brod_consumer_SUITE ==> t_fold_transactions: FAILED %%% brod_consumer_SUITE ==> {function_clause, [{lists,last,[[]],[{file,"lists.erl"},{line,228}]}, {brod_utils,handle_fetch_rsp,7, [{file,"/home/indrek/gems/brod/src/brod_utils.erl"},{line,661}]}, {brod_consumer_SUITE,t_fold_transactions,1, [{file,"/home/indrek/gems/brod/test/brod_consumer_SUITE.erl"}, {line,443}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1224}]}]} ``` The issue was that `#kafka_message{offset = LastOffset} = lists:last(Msgs),` was used, when the Msgs list was empty. Now instead of trying to infer next offset from the kafka_message, we pass the NextFetchOffset from the brod_utils:fetch_one_batch/4 function. Fixes kafka4beam#588
The brod:fold/8 did not work correctly when the last message in the message set a transaction commit. The output looked like this: ``` %%% brod_consumer_SUITE ==> t_fold_transactions: FAILED %%% brod_consumer_SUITE ==> {function_clause, [{lists,last,[[]],[{file,"lists.erl"},{line,228}]}, {brod_utils,handle_fetch_rsp,7, [{file,"/home/indrek/gems/brod/src/brod_utils.erl"},{line,661}]}, {brod_consumer_SUITE,t_fold_transactions,1, [{file,"/home/indrek/gems/brod/test/brod_consumer_SUITE.erl"}, {line,443}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1224}]}]} ``` The issue was that `#kafka_message{offset = LastOffset} = lists:last(Msgs),` was used, when the Msgs list was empty. Now instead of trying to infer next offset from the kafka_message, we pass the NextFetchOffset from the brod_utils:fetch_one_batch/4 function. Fixes kafka4beam#588
The brod:fold/8 did not work correctly when the last message in the message set a transaction commit. The output looked like this: ``` %%% brod_consumer_SUITE ==> t_fold_transactions: FAILED %%% brod_consumer_SUITE ==> {function_clause, [{lists,last,[[]],[{file,"lists.erl"},{line,228}]}, {brod_utils,handle_fetch_rsp,7, [{file,"/home/indrek/gems/brod/src/brod_utils.erl"},{line,661}]}, {brod_consumer_SUITE,t_fold_transactions,1, [{file,"/home/indrek/gems/brod/test/brod_consumer_SUITE.erl"}, {line,443}]}, {test_server,ts_tc,3,[{file,"test_server.erl"},{line,1783}]}, {test_server,run_test_case_eval1,6, [{file,"test_server.erl"},{line,1292}]}, {test_server,run_test_case_eval,9, [{file,"test_server.erl"},{line,1224}]}]} ``` The issue was that `#kafka_message{offset = LastOffset} = lists:last(Msgs),` was used, when the Msgs list was empty. Now instead of trying to infer next offset from the kafka_message, we pass the NextFetchOffset from the brod_utils:fetch_one_batch/4 function. Fixes kafka4beam#588
A failing test:
Output:
This is the line that throws an exception:
brod/src/brod_utils.erl
Line 644 in 636e448
The
brod_utils:fetch
(flatten_batches) seems to be control message aware, but at some point something gets lost.I dug pretty deep, but I'm unsure how to fix this.
The text was updated successfully, but these errors were encountered: