浏览代码

Merge pull request #240 from Shopify/tighten-config-validation

producer: check MaxMessagesPerReq >= FlushMsgCount
Evan Huus 11 年之前
父节点
当前提交
950d619a1a
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      producer.go
  2. 1 1
      vagrant/install_cluster.sh

+ 2 - 2
producer.go

@@ -75,8 +75,8 @@ func (config *ProducerConfig) Validate() error {
 		Logger.Println("ProducerConfig.MaxMessageBytes too close to MaxRequestSize; it will be ignored.")
 	}
 
-	if config.MaxMessagesPerReq < 0 {
-		return ConfigurationError("Invalid MaxMessagesPerReq")
+	if config.MaxMessagesPerReq < 0 || (config.MaxMessagesPerReq > 0 && config.MaxMessagesPerReq < config.FlushMsgCount) {
+		return ConfigurationError("Invalid MaxMessagesPerReq, must be non-negative and >= FlushMsgCount if set")
 	}
 
 	if config.RetryBackoff < 0 {

+ 1 - 1
vagrant/install_cluster.sh

@@ -6,7 +6,7 @@ KAFKA_VERSION=0.8.1.1
 
 mkdir -p ${KAFKA_INSTALL_ROOT}
 if [ ! -f ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_VERSION}.tgz ]; then
-    wget --quiet http://apache.mirror.nexicom.net/kafka/${KAFKA_VERSION}/kafka_2.10-${KAFKA_VERSION}.tgz -O ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_VERSION}.tgz
+    wget --quiet http://apache.mirror.gtcomm.net/kafka/${KAFKA_VERSION}/kafka_2.10-${KAFKA_VERSION}.tgz -O ${KAFKA_INSTALL_ROOT}/kafka-${KAFKA_VERSION}.tgz
 fi
 
 for i in 1 2 3 4 5; do