siddharthteotia commented on a change in pull request #6737:
URL: https://github.com/apache/incubator-pinot/pull/6737#discussion_r606098357
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -1066,14 +1067,22 @@ public void updateSchema(Schema schema, boolean reload)
return;
}
+ boolean isNewSchemaBackwardCompatible =
schema.isBackwardCompatibleWith(oldSchema);
+ if (!isNewSchemaBackwardCompatible) {
+ if (force) {
+ LOGGER.warn(String
+ .format("New schema %s is not backward compatible with the current
schema. Force updating it", schemaName));
+ } else {
+ throw new SchemaBackwardIncompatibleException(
+ String.format("New schema %s is not backward compatible with the
current schema", schemaName));
+ }
+ }
+
PinotHelixPropertyStoreZnRecordProvider propertyStoreHelper =
PinotHelixPropertyStoreZnRecordProvider.forSchema(_propertyStore);
propertyStoreHelper.set(schemaName, record);
- boolean isNewSchemaBackwardCompatible =
schema.isBackwardCompatibleWith(oldSchema);
- if (!isNewSchemaBackwardCompatible) {
- LOGGER.warn(String.format("New schema %s is not backward compatible",
schemaName));
- } else if (reload) {
+ if (isNewSchemaBackwardCompatible && reload) {
Review comment:
Eventually user will have to reload for schema change to take effect on
pre-existing segments and it will fail.
One viable scenario for forcing a backward incompatible change could be for
REFRESH use cases. For example, changing a column type from LONG to INT
followed by starting a refresh.
For APPEND use cases, we recently had a situation where 2 years ago the
column type was changed from LONG to INT and segments were never reloaded. So,
the user was under the impression that schema change went through for old
segments as well. Their recent selection queries somehow ended up touching old
segments and failed the schema consistency check in
SelectionOnlyCombineOperator. So, for APPEND use cases may be we should always
disallow ?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]