This is an automated email from the ASF dual-hosted git repository.

yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new cc1aa1e284 [#5289][Improvement] CatalogMysqlDriverIT miss driver url 
(#6671)
cc1aa1e284 is described below

commit cc1aa1e284e22db71a828279e0d306eff5a9915c
Author: lsyulong <[email protected]>
AuthorDate: Wed Mar 19 12:06:03 2025 +0800

    [#5289][Improvement] CatalogMysqlDriverIT miss driver url (#6671)
    
    What changes were proposed in this pull request?
    #5289 [Improvement] CatalogMysqlDriverIT miss driver url
    
    Why are the changes needed?
    #5289 [Improvement] CatalogMysqlDriverIT miss driver url
    
    because,I have submitted a PR before, but there were some problems.
    Later, I built the environment locally and revised it again.
    
    Fix: https://github.com/apache/gravitino/issues/5289
    
    
    Does this PR introduce any user-facing change?
    no
    
    How was this patch tested?
    yes ,I have successfully built and tested locally
    
    
    
![image](https://github.com/user-attachments/assets/357dfc5b-3fcb-4de1-9255-7eb51ff2c755)
    
    
![image](https://github.com/user-attachments/assets/32faa488-7bb0-4f4d-817e-31651e9466b6)
    
    ---------
    
    Co-authored-by: Mini Yu <[email protected]>
---
 .../catalog/jdbc/operation/JdbcTableOperations.java |  5 ++++-
 .../integration/test/CatalogMysqlDriverIT.java      |  2 ++
 .../mysql/integration/test/CatalogMysqlIT.java      | 21 ++++++++++++---------
 .../gravitino/integration/test/util/BaseIT.java     |  2 +-
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git 
a/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/operation/JdbcTableOperations.java
 
b/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/operation/JdbcTableOperations.java
index 083ffaaaf8..6893a03446 100644
--- 
a/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/operation/JdbcTableOperations.java
+++ 
b/catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/operation/JdbcTableOperations.java
@@ -402,8 +402,11 @@ public abstract class JdbcTableOperations implements 
TableOperation {
     ResultSet indexInfo = getIndexInfo(databaseName, tableName, metaData);
     while (indexInfo.next()) {
       String indexName = indexInfo.getString("INDEX_NAME");
+      String loadedTableName = indexInfo.getString("TABLE_NAME");
       // The primary key is also the unique key, so we need to filter the 
primary key here.
-      if (!indexInfo.getBoolean("NON_UNIQUE") && 
!primaryIndexNames.contains(indexName)) {
+      if (loadedTableName.equals(tableName)
+          && !indexInfo.getBoolean("NON_UNIQUE")
+          && !primaryIndexNames.contains(indexName)) {
         jdbcIndexBeans.add(
             new JdbcIndexBean(
                 Index.IndexType.UNIQUE_KEY,
diff --git 
a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlDriverIT.java
 
b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlDriverIT.java
index e5f5cb62ab..79c33399ca 100644
--- 
a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlDriverIT.java
+++ 
b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlDriverIT.java
@@ -25,5 +25,7 @@ import org.junit.jupiter.api.Tag;
 public class CatalogMysqlDriverIT extends CatalogMysqlIT {
   public CatalogMysqlDriverIT() {
     super();
+    DOWNLOAD_MYSQL_JDBC_DRIVER_URL =
+        
"https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.11/mysql-connector-java-8.0.11.jar";;
   }
 }
diff --git 
a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java
 
b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java
index 9bd949b7b3..7c713fc7ec 100644
--- 
a/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java
+++ 
b/catalogs/catalog-jdbc-mysql/src/test/java/org/apache/gravitino/catalog/mysql/integration/test/CatalogMysqlIT.java
@@ -183,9 +183,10 @@ public class CatalogMysqlIT extends BaseIT {
     catalogProperties.put(
         JdbcConfig.JDBC_URL.getKey(),
         StringUtils.substring(
-            MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME),
-            0,
-            MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME).lastIndexOf("/")));
+                MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME),
+                0,
+                MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME).lastIndexOf("/"))
+            + "?useSSL=false&allowPublicKeyRetrieval=true");
     catalogProperties.put(
         JdbcConfig.JDBC_DRIVER.getKey(), 
MYSQL_CONTAINER.getDriverClassName(TEST_DB_NAME));
     catalogProperties.put(JdbcConfig.USERNAME.getKey(), 
MYSQL_CONTAINER.getUsername());
@@ -284,9 +285,10 @@ public class CatalogMysqlIT extends BaseIT {
     catalogProperties.put(
         JdbcConfig.JDBC_URL.getKey(),
         StringUtils.substring(
-            MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME),
-            0,
-            MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME).lastIndexOf("/")));
+                MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME),
+                0,
+                MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME).lastIndexOf("/"))
+            + "?useSSL=false&allowPublicKeyRetrieval=true");
     catalogProperties.put(
         JdbcConfig.JDBC_DRIVER.getKey(), 
MYSQL_CONTAINER.getDriverClassName(TEST_DB_NAME));
     catalogProperties.put(JdbcConfig.USERNAME.getKey(), 
MYSQL_CONTAINER.getUsername());
@@ -2055,9 +2057,10 @@ public class CatalogMysqlIT extends BaseIT {
     catalogProperties.put(
         JdbcConfig.JDBC_URL.getKey(),
         StringUtils.substring(
-            MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME),
-            0,
-            MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME).lastIndexOf("/")));
+                MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME),
+                0,
+                MYSQL_CONTAINER.getJdbcUrl(TEST_DB_NAME).lastIndexOf("/"))
+            + "?useSSL=false&allowPublicKeyRetrieval=true");
     catalogProperties.put(
         JdbcConfig.JDBC_DRIVER.getKey(), 
MYSQL_CONTAINER.getDriverClassName(TEST_DB_NAME));
     catalogProperties.put(JdbcConfig.USERNAME.getKey(), 
MYSQL_CONTAINER.getUsername());
diff --git 
a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java
 
b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java
index c600e537bd..27e8abf5a2 100644
--- 
a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java
+++ 
b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/BaseIT.java
@@ -99,7 +99,7 @@ public class BaseIT {
 
   protected boolean ignoreIcebergRestService = true;
 
-  public static final String DOWNLOAD_MYSQL_JDBC_DRIVER_URL =
+  public String DOWNLOAD_MYSQL_JDBC_DRIVER_URL =
       
"https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.26/mysql-connector-java-8.0.26.jar";;
 
   public static final String DOWNLOAD_POSTGRESQL_JDBC_DRIVER_URL =

Reply via email to