Skip to content

Commit

Permalink
[FAB-2936] Vendor latest version of sarama library
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-2936

This is the first in a series of changesets that will allow us to
quickly query the state of the Kafka cluster. This is itself needed so
that we can decide whether there's a point in repeating a certain
request (e.g. for the creation of a channel/partition in Kafka) or not.

We're vendoring the latest version of the sarama library because it
introduces the `Brokers()` method to the `Client` interface, and this
allows us to easily get the list of active brokers.

This changeset also adds a relevant (and now req'd) config setting, see:
IBM/sarama#816 for more.

Change-Id: Ia6bda8f237e087066f404f09f9d6ac359ed44b85
Signed-off-by: Kostas Christidis <[email protected]>
  • Loading branch information
kchristidis committed Mar 31, 2017
1 parent 24ab51a commit 047cc27
Show file tree
Hide file tree
Showing 58 changed files with 2,289 additions and 181 deletions.
15 changes: 9 additions & 6 deletions orderer/kafka/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,19 @@ func newBrokerConfig(kafkaVersion sarama.KafkaVersion, chosenStaticPartition int
}
}

// Set equivalent of Kafka producer config max.request.bytes to the default
// value of a Kafka broker's socket.request.max.bytes property (100 MiB).
brokerConfig.Producer.MaxMessageBytes = int(sarama.MaxRequestSize)
// 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)
// 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)
// Set equivalent of Kafka producer config max.request.bytes to the default
// value of a Kafka broker's socket.request.max.bytes property (100 MiB).
brokerConfig.Producer.MaxMessageBytes = int(sarama.MaxRequestSize)
// An esoteric setting required by the sarama library, see:
// https://github.com/Shopify/sarama/issues/816
brokerConfig.Producer.Return.Successes = true

brokerConfig.Version = kafkaVersion

Expand Down
52 changes: 52 additions & 0 deletions vendor/github.com/Shopify/sarama/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions vendor/github.com/Shopify/sarama/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/Shopify/sarama/Vagrantfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions vendor/github.com/Shopify/sarama/async_producer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 047cc27

Please sign in to comment.