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

rexxiong pushed a commit to branch branch-0.5
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/branch-0.5 by this push:
     new ee37b6db3 [CELEBORN-1297][FOLLOWUP] Fix DB config service SQL file
ee37b6db3 is described below

commit ee37b6db3702e4c56d3eefbf623896b91f6170a6
Author: Sanskar Modi <[email protected]>
AuthorDate: Wed Sep 18 07:46:13 2024 +0800

    [CELEBORN-1297][FOLLOWUP] Fix DB config service SQL file
    
    ### What changes were proposed in this pull request?
    
    Fix the unique key to reflect correct columns names.
    
    ### Why are the changes needed?
    
    Running current DB scripts give below error because `user` column was 
renamed to `name` (https://github.com/apache/celeborn/pull/2340) but the unique 
key was not updated correctly.
    
    ```
    mysql> CREATE TABLE IF NOT EXISTS celeborn_cluster_tenant_config
        -> (
        ->     id           int          NOT NULL AUTO_INCREMENT,
        ->     cluster_id   int          NOT NULL,
        ->     tenant_id    varchar(255) NOT NULL,
        ->     level        varchar(255) NOT NULL COMMENT 'config level, valid 
level is TENANT,USER',
        ->     name         varchar(255) DEFAULT NULL COMMENT 'tenant sub user',
        ->     config_key   varchar(255) NOT NULL,
        ->     config_value varchar(255) NOT NULL,
        ->     type         varchar(255) DEFAULT NULL COMMENT 'conf categories, 
such as quota',
        ->     gmt_create   timestamp NOT NULL,
        ->     gmt_modify   timestamp NOT NULL,
        ->     PRIMARY KEY (id),
        ->     UNIQUE KEY `index_unique_tenant_config_key` (`cluster_id`, 
`tenant_id`, `user`, `config_key`)
        -> );
    ERROR 1072 (42000): Key column 'user' doesn't exist in table
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    NA
    
    ### How was this patch tested?
    
    Tested in local DB
    ```
    mysql> CREATE TABLE IF NOT EXISTS celeborn_cluster_tenant_config
        -> (
        ->     id           int          NOT NULL AUTO_INCREMENT,
        ->     cluster_id   int          NOT NULL,
        ->     tenant_id    varchar(255) NOT NULL,
        ->     level        varchar(255) NOT NULL COMMENT 'config level, valid 
level is TENANT,USER',
        ->     name         varchar(255) DEFAULT NULL COMMENT 'tenant sub user',
        ->     config_key   varchar(255) NOT NULL,
        ->     config_value varchar(255) NOT NULL,
        ->     type         varchar(255) DEFAULT NULL COMMENT 'conf categories, 
such as quota',
        ->     gmt_create   timestamp NOT NULL,
        ->     gmt_modify   timestamp NOT NULL,
        ->     PRIMARY KEY (id),
        ->     UNIQUE KEY `index_unique_tenant_config_key` (`cluster_id`, 
`tenant_id`, `name`, `config_key`)
        -> );
    Query OK, 0 rows affected (0.01 sec)
    ```
    
    Closes #2740 from s0nskar/fix-db-script.
    
    Authored-by: Sanskar Modi <[email protected]>
    Signed-off-by: Shuang <[email protected]>
    (cherry picked from commit b3f86f9acc50e56d9eeba9338de455412bf5f769)
    Signed-off-by: Shuang <[email protected]>
---
 docs/developers/configuration.md                              | 2 +-
 service/src/main/resources/sql/mysql/celeborn-0.5.0-mysql.sql | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/developers/configuration.md b/docs/developers/configuration.md
index 533cfa988..c8fe7849f 100644
--- a/docs/developers/configuration.md
+++ b/docs/developers/configuration.md
@@ -142,7 +142,7 @@ CREATE TABLE IF NOT EXISTS celeborn_cluster_tenant_config (
   gmt_create timestamp NOT NULL,
   gmt_modify timestamp NOT NULL,
   PRIMARY KEY (id),
-  UNIQUE KEY `index_unique_tenant_config_key` (`cluster_id`, `tenant_id`, 
`user`, `config_key`)
+  UNIQUE KEY `index_unique_tenant_config_key` (`cluster_id`, `tenant_id`, 
`name`, `config_key`)
 );
 
 INSERT INTO celeborn_cluster_info ( `id`, `name`, `namespace`, `endpoint`, 
`gmt_create`, `gmt_modify` )
diff --git a/service/src/main/resources/sql/mysql/celeborn-0.5.0-mysql.sql 
b/service/src/main/resources/sql/mysql/celeborn-0.5.0-mysql.sql
index 757884b7a..fe275a11b 100644
--- a/service/src/main/resources/sql/mysql/celeborn-0.5.0-mysql.sql
+++ b/service/src/main/resources/sql/mysql/celeborn-0.5.0-mysql.sql
@@ -52,5 +52,5 @@ CREATE TABLE IF NOT EXISTS celeborn_cluster_tenant_config
     gmt_create   timestamp NOT NULL,
     gmt_modify   timestamp NOT NULL,
     PRIMARY KEY (id),
-    UNIQUE KEY `index_unique_tenant_config_key` (`cluster_id`, `tenant_id`, 
`user`, `config_key`)
+    UNIQUE KEY `index_unique_tenant_config_key` (`cluster_id`, `tenant_id`, 
`name`, `config_key`)
 );

Reply via email to