nastra opened a new pull request, #14997: URL: https://github.com/apache/iceberg/pull/14997
This fixes an issue that @haizhou-zhao brought up in https://github.com/apache/iceberg/pull/14334. Basically the test added in https://github.com/apache/iceberg/pull/14334 performs a concurrent update of the same view version, but fails with ``` org.apache.iceberg.exceptions.ValidationException: Cannot set last added schema: no schema has been added at org.apache.iceberg.exceptions.ValidationException.check(ValidationException.java:49) at org.apache.iceberg.view.ViewMetadata$Builder.addVersionInternal(ViewMetadata.java:297) at org.apache.iceberg.view.ViewMetadata$Builder.addVersion(ViewMetadata.java:277) at org.apache.iceberg.MetadataUpdate$AddViewVersion.applyTo(MetadataUpdate.java:508) at org.apache.iceberg.rest.CatalogHandlers.lambda$commit$11(CatalogHandlers.java:624) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at org.apache.iceberg.rest.CatalogHandlers.lambda$commit$12(CatalogHandlers.java:624) ``` This is due to our internal state tracking of `lastAddedSchemaId`, which is then assumed to be set when adding the view version and checking ``` if (version.schemaId() == LAST_ADDED) { ValidationException.check(lastAddedSchemaId != null, "Cannot set last added schema: no schema has been added"); version = ImmutableViewVersion.builder().from(version).schemaId(lastAddedSchemaId).build(); } ``` I added a reproducible test to `TestViewMetadata` where the schema ID is set to `-1`, indicating that the schema ID can be re-assigned. Once we get this change in, we should also get https://github.com/apache/iceberg/pull/14334 in, as that reproduces the issue and has a good test for it. @huaxingao, @singhpk234, @amogh-jahagirdar since you guys reviewed https://github.com/apache/iceberg/pull/14434 already, could you please review this one as well? -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
