confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

Bug in protobuf serializer: unnecessary roundtrip to schema registry

Open CTCC1 opened this issue 5 years ago • 0 comments

Description

https://github.com/confluentinc/confluent-kafka-python/blob/master/confluent_kafka/schema_registry/protobuf.py#L315 _known_subject is never populated.

The ProtobufSerializer has a cache for the subject created. However, it is never populated in the code. As such, the serializer does a round trip to the schema registry upon every serialization to lookup the schema by calling the lookup function here https://github.com/confluentinc/confluent-kafka-python/blob/master/confluent_kafka/schema_registry/protobuf.py#L323

How to reproduce

Try to serialize multiple times with the same serializer instance and look at the schema registry logs.

Checklist

Please provide the following information:

  • [ ] confluent-kafka-python and librdkafka version (confluent_kafka.version() and confluent_kafka.libversion()):
  • [ ] Apache Kafka broker version:
  • [ ] Client configuration: {...}
  • [ ] Operating system:
  • [ ] Provide client logs (with 'debug': '..' as necessary)
  • [ ] Provide broker log excerpts
  • [ ] Critical issue

CTCC1 avatar Aug 13 '20 14:08 CTCC1