Response for "Metadata" request is malformed
nsubramanya-ns opened this issue · comments
Since the "Version" in the request header is ignored (or not copied over to the response header), the sender of the request (using https://github.com/confluentinc/confluent-kafka-go) is unhappy with the response. This can be resolved with the following simple one line change:
diff --git a/kafkatest/server.go b/kafkatest/server.go index 5767848..b8956f0 100644 --- a/kafkatest/server.go +++ b/kafkatest/server.go @@ -546,6 +546,7 @@ func (s *Server) handleMetadataRequest(nodeID int32, conn net.Conn, req *proto.M defer s.mu.RUnlock() resp := &proto.MetadataResp{ + Version: req.GetVersion(), CorrelationID: req.GetCorrelationID(), Topics: make([]proto.MetadataRespTopic, 0, len(s.topics)), Brokers: s.brokers,
Hi Nagendra,
Thanks for pointing out. I'll make this fix, but, unfortunately, I am not sure that it will be enough.
kafkatest
is the simplest possible implementation of kafka server we used when we started writing our driver. It was never intended to be used anywhere in production. I am not even sure that we kept it up to date with a recent changes in kafka driver protocol.
BTW, despite that all other places set response version equal request's version, I would say that a more safe option is to use minimal supported version.
Hi,
I use kafkatest
to mock a kafka broker in order to test my app which produces a message. I don't intend to use kafkatest
for production. My one line change is good to keep the confluent-kafka-go
producer happy.
With reference to your comment about "minimal supported version", pls can you consider adding logic to handle APIVersionsRequest
?
I've merged PR - could you please test.
I tested with your branch and now using master
- working well. Thanks for the quick turnaround.
I'm closing this issue as it seems to be good now :)