Browse Source

Update changelog for #709

Also remove unnecessary variable.
Evan Huus 9 years ago
parent
commit
366453c3e3
2 changed files with 3 additions and 2 deletions
  1. 2 0
      CHANGELOG.md
  2. 1 2
      partitioner.go

+ 2 - 0
CHANGELOG.md

@@ -33,6 +33,8 @@ Bug Fixes:
    ([#685](https://github.com/Shopify/sarama/pull/685)).
  - Fix a possible tight loop in the consumer
    ([#693](https://github.com/Shopify/sarama/pull/693)).
+ - Fix possible negative partition value from the HashPartitioner
+   ([#709](https://github.com/Shopify/sarama/pull/709)).
 
 #### Version 1.9.0 (2016-05-16)
 

+ 1 - 2
partitioner.go

@@ -111,8 +111,7 @@ func (p *hashPartitioner) Partition(message *ProducerMessage, numPartitions int3
 	if err != nil {
 		return -1, err
 	}
-	hash := int32(p.hasher.Sum32())
-	partition := hash % numPartitions
+	partition := int32(p.hasher.Sum32()) % numPartitions
 	if partition < 0 {
 		partition = -partition
 	}