jackjlli commented on a change in pull request #7374: URL: https://github.com/apache/pinot/pull/7374#discussion_r699535533
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java ########## @@ -1094,6 +1086,24 @@ public void updateSchema(Schema schema, boolean reload) } } + /** + * Helper method to update the schema, or throw SchemaBackwardIncompatibleException when the new schema is not + * backward-compatible with the existing schema. + */ + private void updateSchema(Schema schema, Schema oldSchema) + throws SchemaBackwardIncompatibleException { + schema.updateBooleanFieldsIfNeeded(oldSchema); + if (schema.equals(oldSchema)) { + LOGGER.info("New schema: {} is the same as the existing schema, not updating it", schema.getSchemaName()); + return; + } + if (!schema.isBackwardCompatibleWith(oldSchema)) { + throw new SchemaBackwardIncompatibleException( + String.format("New schema: %s is not backward-compatible with the existing schema", schema.getSchemaName())); + } + ZKMetadataProvider.setSchema(_propertyStore, schema); Review comment: nit: maybe we should add some logs to print out some messages like `Updating schema`, `Updated schema successfully` at the beginning and the end of the logic? Same for schema creation. -- 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-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org