You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/08/31 03:45:24 UTC

[GitHub] [pulsar] gaoran10 commented on a change in pull request #11856: [Schema] Schema compatibility strategy in broker level.

gaoran10 commented on a change in pull request #11856:
URL: https://github.com/apache/pulsar/pull/11856#discussion_r698959315



##########
File path: pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
##########
@@ -1955,6 +1957,13 @@
             "org.apache.pulsar.broker.service.schema.ProtobufNativeSchemaCompatibilityCheck"
     );
 
+    @FieldContext(
+            category = CATEGORY_SCHEMA,
+            doc = "The schema compatibility strategy in broker level. If this config in namespace policy is `UNDEFINED`"
+                    + ", schema compatibility strategy check will use it in broker level."
+    )
+    private String schemaCompatibilityStrategy = "UNDEFINED";

Review comment:
       Could we use the name of the enum `SchemaCompatibilityStrategy.UNDEFINED`.

##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
##########
@@ -545,8 +545,11 @@ public void recordAddLatency(long latency, TimeUnit unit) {
 
     protected void setSchemaCompatibilityStrategy (Policies policies) {
         if (policies.schema_compatibility_strategy == SchemaCompatibilityStrategy.UNDEFINED) {
-            schemaCompatibilityStrategy = SchemaCompatibilityStrategy.fromAutoUpdatePolicy(
-                    policies.schema_auto_update_compatibility_strategy);
+            schemaCompatibilityStrategy = SchemaCompatibilityStrategy.valueOf(brokerService.pulsar()
+                    .getConfig().getSchemaCompatibilityStrategy());
+            if (schemaCompatibilityStrategy == SchemaCompatibilityStrategy.UNDEFINED) {

Review comment:
       Could we use the equals method of the enum `SchemaCompatibilityStrategy.UNDEFINED`.
   
   such as
   ```
   SchemaCompatibilityStrategy.UNDEFINED.equals(schemaCompatibilityStrategy)
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org