apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.23k stars 3.58k forks source link

Proper compatibility check for PROTOBUF_NATIVE schema #19385

Open visortelle opened 1 year ago

visortelle commented 1 year ago

Search before asking

Motivation

The current implementation checks only for changing a root message name.

https://github.com/apache/pulsar/blob/34c18704ce759922ce45820321af44b382a28e10/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/ProtobufNativeSchemaCompatibilityCheck.java#L67-L72

It's definitely not enough. For example, these schemas won't be compatible due to the changed field type:

message Person {
  int32 age = 1;
  string name = 2;
}
message Person {
  int64 age = 1;
  string name = 2;

Of course, it's the simplest case. There are many more of them.

Solution

Alternatives

Anything else?

I understand why it has been implemented this way. By quick googling, I didn't find any ready-to-use JVM-based Protobuf compatibility checkers.

In comparison, Avro has the org.apache.avro.SchemaValidator package.

Are you willing to submit a PR?

Denovo1998 commented 1 year ago

Maybe I can give it a try.

github-actions[bot] commented 1 year ago

The issue had no activity for 30 days, mark with Stale label.