Proper locking for rktp_metadata

This commit is contained in:
Magnus Edenhill 2014-07-06 23:40:30 +02:00
parent 15d8ae3cd3
commit 1ade4c90e4
1 changed files with 2 additions and 0 deletions

View File

@ -641,11 +641,13 @@ static int rd_kafka_topic_leader_update (rd_kafka_topic_t *rkt,
rktp = rd_kafka_toppar_get(rkt, mdp->id, 0);
rd_kafka_assert(rkt->rkt_rk, rktp);
rd_kafka_toppar_lock(rktp);
/* Store a copy of the metadata for this partition.
* The sub-arrays are NULLed to avoid extra alloc. */
rktp->rktp_metadata = *mdp;
rktp->rktp_metadata.replicas = NULL;
rktp->rktp_metadata.isrs = NULL;
rd_kafka_toppar_unlock(rktp);
if (!rkb) {
int had_leader = rktp->rktp_leader ? 1 : 0;