bube opened a new pull request, #8471:
URL: https://github.com/apache/paimon/pull/8471
### Purpose
Closes #8470.
When two Paimon sinks commit to different tables in the same Iceberg REST
catalog database, and that database (namespace) does not yet exist, they can
race on namespace creation. `IcebergRestMetadataCommitter.commitMetadataImpl()`
uses a check-then-act pattern across two separate REST round-trips:
```java
// create database if not exist
if (!databaseExists()) {
createDatabase();
}
```
Both commits can observe the namespace as missing and both call
`createNamespace()`. The loser fails — per the Iceberg REST spec with a 409
`AlreadyExistsException` (as `RESTServerExtension` returns), or with a 500
`ServiceFailureException` on the non-spec-compliant
`apache/iceberg-rest-fixture` docker image. This causes a spurious commit
failure and sink restart. It recovers after the restart (the namespace exists
by then), but produces noise on the first commit of a fresh database.
This makes namespace creation idempotent: `createDatabase()` now catches
`AlreadyExistsException` and proceeds, since the required namespace now exists.
(A spec-violating 500 from a non-compliant server is a separate, server-side
problem and is intentionally not swallowed.)
### Tests
Added
`IcebergRestMetadataCommitterTest#testCreateDatabaseIsIdempotentUnderRace`,
which reproduces the losing commit's situation — a second `createDatabase()`
against an already-existing namespace — and asserts it does not fail. The test
fails on the unfixed code with `AlreadyExistsException` and passes with the
fix. The full `IcebergRestMetadataCommitterTest` suite (with
checkstyle/spotless) passes.
--
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]