nisan1101 opened a new pull request, #2590:
URL: https://github.com/apache/iceberg-go/pull/2590
## Why
A concurrent schema registration can make `UpdateSchema.BuildUpdates()`
select another writer's schema instead of the schema it adds.
## Summary
```diff
NewAddSchemaUpdate(newSchema),
-NewSetCurrentSchemaUpdate(newSchema.ID),
+NewSetCurrentSchemaUpdate(-1),
```
Use the last-added-schema marker so the catalog resolves its assigned ID.
Historical schema reuse and the current-schema requirement stay unchanged.
## Evidence
- **Before:**
`TestBuildUpdatesSelectsAddedSchemaAfterConcurrentRegistration/different_schema`
fails: the resulting schema contains `b` instead of `c`.
- **After:** `go test ./table -run '^TestBuildUpdates' -count=1` passes,
covering concurrent registration of a different or equivalent schema and
existing historical schema reuse.
- `make test`: pass.
- `make lint`: pass (golangci-lint v2.15.0); repository pre-commit hook also
passes with pinned v2.14.0.
## Merge Danger
**Door:** two-way
**Blast Radius:** schema-evolution
Changes only selection of a newly added schema; no exported API changes.
## Spec
Fixes #2586.
Sources:
- [Issue #2586](https://github.com/apache/iceberg-go/issues/2586)
- [REST Catalog
SetCurrentSchemaUpdate](https://github.com/apache/iceberg/blob/d1a422988cbde266f10c9e174ddf7c36a08de51a/open-api/rest-catalog-open-api.yaml#L3383-L3395)
PR scope: select the schema added by the same update request despite
concurrent schema registration, with regression coverage.
--
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]