hussain-s opened a new pull request, #15006:
URL: https://github.com/apache/gravitino/pull/15006

   ### What changes were proposed in this pull request?
   
   Add a JDBC catalog safety check before Spark accesses the underlying source. 
The connector refreshes the Gravitino catalog metadata and rejects access when 
the JDBC URL, user, password, or catalog creation time differs from the values 
used to initialize Spark's JDBC catalog.
   
   ### Why are the changes needed?
   
   Spark's `JDBCTableCatalog` retains its connection settings after 
initialization. After a Gravitino JDBC catalog is altered, or dropped and 
recreated with the same name, an open Spark session could silently keep reading 
from or writing to the old source.
   
   The connector now fails with a clear instruction to restart the Spark 
session instead of using stale connection settings.
   
   Fixes #14837
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. An open Spark session now rejects JDBC catalog access with an 
instruction to restart the session after its JDBC connection settings change or 
the catalog is recreated.
   
   ### How was this patch tested?
   
   - Ran the full Spark 3.5 JDBC unit-test package:
   
     ```shell
     ./gradlew :spark-connector:spark-3.5:test \
       --tests 'org.apache.gravitino.spark.connector.jdbc.*' \
       -PskipITs -PskipDockerTests=true --no-daemon --console=plain
     ```
   
     Result: passed.
   
   - Ran the Docker-backed Spark 3.5 MySQL JDBC integration test:
   
     ```shell
     SKIP_DOCKER_TESTS=false ./gradlew :spark-connector:spark-3.5:test \
       --tests 
org.apache.gravitino.spark.connector.integration.test.jdbc.SparkJdbcMysqlCatalogIT35
 \
       --no-daemon --console=plain
     ```
   
     Result: passed.


-- 
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]

Reply via email to