confluent-kafka-python
confluent-kafka-python copied to clipboard
Bug in protobuf serializer: unnecessary roundtrip to schema registry
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()andconfluent_kafka.libversion()): - [ ] Apache Kafka broker version:
- [ ] Client configuration:
{...} - [ ] Operating system:
- [ ] Provide client logs (with
'debug': '..'as necessary) - [ ] Provide broker log excerpts
- [ ] Critical issue