eolivelli commented on a change in pull request #9612:
URL: https://github.com/apache/pulsar/pull/9612#discussion_r580090240
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java
##########
@@ -293,12 +295,28 @@ private void checkCompatible(SchemaAndMetadata
existingSchema, SchemaData newSch
SchemaData schemaData) {
final CompletableFuture<SchemaVersion> completableFuture = new
CompletableFuture<>();
SchemaVersion schemaVersion;
- for (SchemaAndMetadata schemaAndMetadata : schemaAndMetadataList) {
- if
(Arrays.equals(hashFunction.hashBytes(schemaAndMetadata.schema.getData()).asBytes(),
- hashFunction.hashBytes(schemaData.getData()).asBytes())) {
- schemaVersion = schemaAndMetadata.version;
- completableFuture.complete(schemaVersion);
- return completableFuture;
+ if (schemaData.getData().length != 0) {
+ Schema.Parser parser = new Schema.Parser();
+ Schema newSchema = parser.parse(new String(schemaData.getData(),
UTF_8));
Review comment:
Sorry I was not clear.
My comment is more about having code coverage for the condition about
PROTOBUF.
if we add an explicit unit test about the fact that with PROTOBUF we are
performing your new code, we are sure that we won't lose this implementation in
the future.
Probably adding an utility method `isUsingAvroSchemaParser` and add simple
unit tests about that method will reduce the number of combinations we need to
completely cover this change.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]