Jackie-Jiang commented on a change in pull request #7374: URL: https://github.com/apache/pinot/pull/7374#discussion_r699583525
########## 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())); Review comment: We can change the `schema.isBackwardCompatibleWith()` to throw exception instead of returning a boolean. This is out of the scope of this PR, so added to TODO to track that -- 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