Skip to content

Commit

Permalink
[FAB-1419] Set appropriate ACK level for brokers
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-1419

By default the partition leader (i.e. the Kafka broker responsible for
maintainig a chain) waits only for the local commit to succeed before
responding.

The right setting to maximize the reliability of data delivery is to have
the partition leader wait for all in-sync replicas (backups) to get a
message before sending back to the producer an acknowledgement or an
error.

Change-Id: I1bc045ef883c39cac3fec2c31f3e9f329ba972c4
Signed-off-by: Kostas Christidis <kostas@christidis.io>
  • Loading branch information
kchristidis committed Dec 15, 2016
1 parent c6f2565 commit 89f9a10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions orderer/kafka/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func newBrokerConfig(kafkaVersion sarama.KafkaVersion, chosenStaticPartition int
brokerConfig := sarama.NewConfig()

brokerConfig.Version = kafkaVersion
// Set the level of acknowledgement reliability needed from the broker.
// WaitForAll means that the partition leader will wait till all ISRs
// got the message before sending back an ACK to the sender.
brokerConfig.Producer.RequiredAcks = sarama.WaitForAll
// A partitioner is actually not needed the way we do things now,
// but we're adding it now to allow for flexibility in the future.
brokerConfig.Producer.Partitioner = newStaticPartitioner(chosenStaticPartition)
Expand Down

0 comments on commit 89f9a10

Please sign in to comment.