Il Mar 8 Mar 2022, 06:24 PengHui Li <peng...@apache.org> ha scritto: > +1 the byte schema should also abide by the schema compatibility strategy > If I remember correctly, the byte schema should always compatible with > string schema > > Penghui > > > On Tue, Mar 8, 2022 at 10:56 AM guo jiwei <techno...@apache.org> wrote: > > > Hi, > > I want to discuss the compatibility issue with the byte schema here. > > For now, the byte-schema is compatible with all other schemas. This > may > > introduce more issues. > > Case 1: > > 1. Consumer1 init with JSON schema for topic A. > > 2. But producer1 init without schema and send byte messages > > directly to topic A. > > This will cause consumer1 to deserialize msg error. Also, > > producer1 may send unsafe byte data. >
This is something we should fix. But sometimes you use Producer<byte[]> (or ByteBuffer) because you don't know the Schema initially and then you set the Schema per message. We have AUTO_PRODUCE Schem but it is not straightforward for users. So herd the best we can do is to not check the Schema until the first send. > > > Case 2: > > 1. Consumer1 init with byte schema for topic A. > > 2. But producer1 init with AVRO/JSON schema and send messages > to > > topic A. > > This will cause consumer1 don't know how to deserialize msg This is not a problem from my point of view. If you want to consume raw data you use Schema BYTES or ByteBuffer. If you want to dynamically interpret the contents you use Schema AUTO_CONSUME and GenericObject. Enrico > . > > > > To avoid the above issues, Byte schema should also follow the schema > > compatibility policy. I'm open #13701 > > <https://github.com/apache/pulsar/issues/13701> to track this. If the > idea > > is accepted, I will start a PIP. > > > > Please give some suggestions about this idea. > > > > > > Regards > > Jiwei Guo (Tboy) > > >