PDGGK opened a new pull request, #9422:
URL: https://github.com/apache/paimon/pull/9422
### Purpose
`FlinkGenericCatalog` wraps a Paimon catalog and a Flink one and closes them
as a bare sequence:
```java
@Override
public void close() throws CatalogException {
paimon.close();
flink.close();
}
```
They are separate resources. When `paimon.close()` throws, `flink.close()`
never runs, and the Flink catalog in this pairing is typically a `HiveCatalog`
holding a metastore client. Both are now closed, and the first failure is what
the caller sees, with the second attached rather than dropped.
`open()` has the same pairing the other way round:
```java
paimon.open();
flink.open();
```
If `flink.open()` throws, the Paimon catalog stays open. A caller does not
close a catalog whose `open()` failed, so nothing releases it.
### Tests
`FlinkGenericCatalogCloseTest`, four cases with both catalogs mocked:
- `testCloseClosesTheFlinkCatalogWhenPaimonFails` — the Flink catalog is
still closed and the original `CatalogException` still comes out.
- `testCloseKeepsBothFailures` — both fail; the caller gets the paimon one
with the flink one suppressed.
- `testOpenClosesThePaimonCatalogWhenFlinkFails` — the paimon catalog is
closed on the way out.
- `testCloseClosesBoth` — control: nothing fails, both close, nothing is
thrown.
Reverting the change turns the first three red and leaves the control green,
on `Wanted but not invoked: flink.close()` and the equivalent for the paimon
side.
`mvn test -pl paimon-flink/paimon-flink-common
-Dtest='org.apache.paimon.flink.FlinkGenericCatalog*'` — 5 tests, all passing.
spotless and checkstyle clean.
--
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]