Repository navigation
[#13675] fix(spark): Fix Gravitino client cache eviction lifecycle - #13677
Bhavdeep-Sai wants to merge 1 commit into
Conversation
|
Reviewed head
Validation: With only the unused-variable obstacle removed and one review reproduction added, the Spark 3.5 non-integration suite ran 235 tests with three failures: the two fixture NPEs and the concurrent-loading reproduction. With the fixtures repaired, the two relevant test classes ran 13 tests with one failure (the expiration wait). The two size-eviction regression tests passed with the fix, both failed when the removal listener was reverted to closing without catalog invalidation, and passed again after restoring the listener. Spark 4.0, Docker, and integration tests were not run. All temporary source changes were restored after verification. |
What changes were proposed in this pull request?
This PR fixes the Gravitino client lifecycle issue described in #13675.
BaseCatalogcould retain a catalog instance backed by aGravitinoClientthat was later evicted from the Caffeine client cache. The cache removal listener closes the evicted client's HTTP transport, leaving the retained catalog with a closed client.This change:
GravitinoCatalogManagerwhen catalog operations are performed.BaseCatalogfrom continuing to use a catalog backed by a closed client.Why are the changes needed?
When a cached
GravitinoClientis evicted,GravitinoCatalogManagercloses the client and its underlying HTTP connection pool.However,
BaseCatalogcould still hold a catalog instance backed by that evicted client. Subsequent metadata operations could therefore attempt to use a closed HTTP transport and fail.Re-resolving the catalog after cache eviction ensures that operations use an active Gravitino client, while invalidating the corresponding catalog cache entries prevents stale catalog instances from being reused.
Fix: #13675
Does this PR introduce any user-facing change?
No.
This is a bug fix to the internal Gravitino client and catalog cache lifecycle. No user-facing API or configuration property is introduced, removed, or changed.
How was this patch tested?
Added regression tests covering:
The following tests/checks were run:
./gradlew :spark-connector:spark-3.5:test --tests "org.apache.gravitino.spark.connector.catalog.TestBaseCatalogClientEviction" --tests "org.apache.gravitino.spark.connector.catalog.TestGravitinoCatalogManager"./gradlew :spark-connector:spark-3.5:test./gradlew spotlessApplygit diff --check./gradlew test -PskipITs -PskipDockerTests=false