nodece commented on a change in pull request #13297:
URL: https://github.com/apache/pulsar/pull/13297#discussion_r773989152



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
##########
@@ -795,4 +796,40 @@ protected void 
validatePersistencePolicies(PersistencePolicies persistence) {
                         persistence.getBookkeeperAckQuorum()));
 
     }
+
+    protected CompletableFuture<SchemaCompatibilityStrategy> 
getSchemaCompatibilityStrategyAsync() {
+        validateTopicOperation(topicName, 
TopicOperation.GET_SCHEMA_COMPATIBILITY_STRATEGY);
+
+        CompletableFuture<SchemaCompatibilityStrategy> future =
+                
CompletableFuture.completedFuture(SchemaCompatibilityStrategy.UNDEFINED);
+
+        if (config().isTopicLevelPoliciesEnabled()) {
+            future = getTopicPoliciesAsyncWithRetry(topicName).thenApply(
+                    op -> op.map(TopicPolicies::getSchemaCompatibilityStrategy)
+                            .orElse(SchemaCompatibilityStrategy.UNDEFINED));
+        }
+
+        return future.thenApply(schemaCompatibilityStrategy -> {
+                    if (schemaCompatibilityStrategy == 
SchemaCompatibilityStrategy.UNDEFINED) {
+                        Policies policies = 
getNamespacePolicies(namespaceName);
+                        if (policies.schema_compatibility_strategy == 
SchemaCompatibilityStrategy.UNDEFINED) {
+                            schemaCompatibilityStrategy = 
SchemaCompatibilityStrategy.fromAutoUpdatePolicy(
+                                    
policies.schema_auto_update_compatibility_strategy);
+                            if (schemaCompatibilityStrategy == 
SchemaCompatibilityStrategy.UNDEFINED) {
+                                return 
config().getSchemaCompatibilityStrategy();

Review comment:
       The `schema_auto_update_compatibility_strategy` is never equal to 
`SchemaCompatibilityStrategy.UNDEFINED`, so broker config is always ignored.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to