From 89f9a108f75d21f2fb25e7cc5ef96451c10ed15f Mon Sep 17 00:00:00 2001 From: Kostas Christidis Date: Thu, 15 Dec 2016 14:54:54 -0500 Subject: [PATCH] [FAB-1419] Set appropriate ACK level for brokers 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 --- orderer/kafka/util.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/orderer/kafka/util.go b/orderer/kafka/util.go index a20b6283926..b59f6214928 100644 --- a/orderer/kafka/util.go +++ b/orderer/kafka/util.go @@ -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)