If you write to a non-leader partition, I'd expect you'd get
NotLeaderForPartitionException (thrown by
Partition.appendMessagesToLeader).
This will get sent to the producer as error code 6.

I don't see anything special in the producer side to handle this
specific (although I'd expect a forced metadata refresh and then a
re-send).

Gwen

On Sat, Dec 6, 2014 at 6:46 PM, Xiaoyu Wang <xw...@rocketfuel.com> wrote:
> Hello,
>
> I am looking at producer code and found that producer updates its
> broker/partition info under the two conditions
>
>    1. has reached the topicMetadataRefreshInterval
>    2. failed sending message, before retry
>
> So, assume we have broker A and B, B is the current lead and A is the
> preferred lead and a producer is publishing to B. If someone execute
> preferred lead election command now, A will become the new lead and the
> producer won't know the lead is now A and will still writes to B until the
> metadata refresh interval has been reached. Is this correct? Or did I did
> miss anything.
>
>
> Thanks.

Reply via email to