Skip to content

Redirect partition queues *after* reassignment. #107

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/Kafka/Consumer/Callbacks.hs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,13 @@ setRebalanceCallback f k e pls = do
let assignment = (tpTopicName &&& tpPartition) <$> ps
case e of
KafkaResponseError RdKafkaRespErrAssignPartitions -> do
f k (RebalanceBeforeAssign assignment)
void $ assign' k pls -- pass as pointer to avoid possible serialisation issues
mbq <- getRdMsgQueue $ getKafkaConf k
case mbq of
Nothing -> pure ()
Just mq -> do
forM_ ps (\tp -> redirectPartitionQueue (getKafka k) (tpTopicName tp) (tpPartition tp) mq)
-- sleep for 1 second.
-- it looks like without it there is not enough time for redirect to happen
-- or something similarly strange. I don't understand it.
-- If you know WTH is going on PLEASE let me know because the current "fix" is ugly
-- and is completely unreasonable :(
threadDelay 1000000
f k (RebalanceBeforeAssign assignment)
void $ assign' k pls -- pass as pointer to avoid possible serialisation issues
f k (RebalanceAssign assignment)
KafkaResponseError RdKafkaRespErrRevokePartitions -> do
f k (RebalanceBeforeRevoke assignment)
Expand Down