Description
In Partitioner, we cycle through each partition to find one whose leader is available. However, since the counter is shared among different caller threads, the logic may not iterate through every partition. The impact is that we could return an unavailable partition to the caller when there are partitions available. If the partition is unavailable for a long time, the producer may block due to bufferpool being full.