merge from old apache svn + https://issues.apache.org/jira/browse/KAFKA-296