You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/08/30 23:51:08 UTC

[GitHub] [pinot] yupeng9 commented on a change in pull request #7374: Check schema backward-compatibility when updating schema through addSchema with override

yupeng9 commented on a change in pull request #7374:
URL: https://github.com/apache/pinot/pull/7374#discussion_r698882577



##########
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:
       is it possible to also return the details of the incompatiblity?




-- 
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@pinot.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org