codelipenghui commented on a change in pull request #12786:
URL: https://github.com/apache/pulsar/pull/12786#discussion_r751997217
##########
File path:
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
##########
@@ -573,6 +573,14 @@
)
private int brokerMaxConnectionsPerIp = 0;
+ @FieldContext(
+ category = CATEGORY_POLICIES,
+ dynamic = true,
+ doc = "Allow schema to be auto updated. If this is disabled,
'is_allow_auto_update_schema' in namespace "
+ + "policy will be ignored. This is enabled by default."
+ )
+ private boolean allowAutoUpdateSchema = true;
Review comment:
```suggestion
private boolean isAllowAutoUpdateSchemaEnabled = true;
```
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
##########
@@ -333,20 +333,21 @@ public String getReplicatorPrefix() {
String base = TopicName.get(getName()).getPartitionedTopicName();
String id = TopicName.get(base).getSchemaName();
SchemaRegistryService schemaRegistryService =
brokerService.pulsar().getSchemaRegistryService();
- return isAllowAutoUpdateSchema ? schemaRegistryService
- .putSchemaIfAbsent(id, schema, schemaCompatibilityStrategy)
- :
schemaRegistryService.trimDeletedSchemaAndGetList(id).thenCompose(schemaAndMetadataList
->
-
schemaRegistryService.getSchemaVersionBySchemaData(schemaAndMetadataList,
schema)
- .thenCompose(schemaVersion -> {
- if (schemaVersion == null) {
- return FutureUtil
- .failedFuture(
- new IncompatibleSchemaException(
- "Schema not found and schema
auto updating is disabled."));
- } else {
- return
CompletableFuture.completedFuture(schemaVersion);
- }
- }));
+
+ if (brokerService.pulsar().getConfig().isAllowAutoUpdateSchema() &&
isAllowAutoUpdateSchema) {
Review comment:
I think it's not correct here, the namespace level policy can overwrite
the broker level configuration, which means you can disable it at the broker
level by default but for some namespaces, you can enable it.
It's not like a broker level mandatory control. Just the broker level
default configurations.
--
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]