Skip to content

Commit 2940c60

Browse files
committed
Fix incorrect logs when a message failed to be decoded with the writer schema
### Motivation See https://github.com/apache/pulsar-client-python/blob/f9b2d168ae85f289d6ee043cd81791d569ba8844/pulsar/schema/schema_avro.py#L92C32-L92C69 When `self._decode_bytes(msg.data(), writer_schema)` failed, the error log is still `Failed to get schema info`, which is confusing. ### Modifications Modify the error message. Even if it failed at `self._get_writer_schema(topic, version)`, there would still be error logs from the C++ client.
1 parent f9b2d16 commit 2940c60

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pulsar/schema/schema_avro.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def decode_message(self, msg: _pulsar.Message):
9191
writer_schema = self._get_writer_schema(topic, version)
9292
return self._decode_bytes(msg.data(), writer_schema)
9393
except Exception as e:
94-
self._logger.error(f'Failed to get schema info of {topic} version {version}: {e}')
94+
msg_id = msg.message_id()
95+
self._logger.warn(f'Failed to decode {msg_id} with schema {topic} version {version}: {e}')
9596
return self._decode_bytes(msg.data(), self._schema)
9697

9798
def _get_writer_schema(self, topic: str, version: int) -> 'dict':

0 commit comments

Comments
 (0)