From 3e4083deb771883c0715470b1c0064cd0d575ff6 Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Tue, 26 Sep 2023 11:37:52 +0800 Subject: [PATCH] fix comments --- .../resources/sql/mysql/005-KYUUBI-5327.mysql.sql | 13 +++++++++---- .../sql/mysql/metadata-store-schema-1.8.0.mysql.sql | 8 +++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/kyuubi-server/src/main/resources/sql/mysql/005-KYUUBI-5327.mysql.sql b/kyuubi-server/src/main/resources/sql/mysql/005-KYUUBI-5327.mysql.sql index fb6ca6f3354..76f221c15fe 100644 --- a/kyuubi-server/src/main/resources/sql/mysql/005-KYUUBI-5327.mysql.sql +++ b/kyuubi-server/src/main/resources/sql/mysql/005-KYUUBI-5327.mysql.sql @@ -1,8 +1,13 @@ -SELECT '< KYUUBI-5131: Create index on metastore.create_time' AS ' '; +SELECT '< KYUUBI-5327: Introduce priority in metadata' AS ' '; ALTER TABLE metadata ADD COLUMN priority int default 10 COMMENT 'the application priority, high value means high priority'; --- mysql 5.7 does not support mix order index --- mysql 8 allow create mix order index and can be used in order by --- here create it in 5.7 won't cause error +-- In mysql 5.7, A key_part specification can end with ASC or DESC. +-- These keywords are permitted for future extensions for specifying ascending or descending index value storage. +-- Currently, they are parsed but ignored; index values are always stored in ascending order. +-- In mysql 8 this can take effect and this index will be hit if query order by priority DESC, create_time ASC. +-- See more detail in: +-- https://dev.mysql.com/doc/refman/8.0/en/index-hints.html +-- https://dev.mysql.com/doc/refman/8.0/en/create-index.html +-- https://dev.mysql.com/doc/refman/5.7/en/create-index.html ALTER TABLE metadata ADD INDEX priority_create_time_index(priority DESC, create_time ASC); diff --git a/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-1.8.0.mysql.sql b/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-1.8.0.mysql.sql index 0f192eaf663..30bcbcfc3ad 100644 --- a/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-1.8.0.mysql.sql +++ b/kyuubi-server/src/main/resources/sql/mysql/metadata-store-schema-1.8.0.mysql.sql @@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS metadata( request_name varchar(1024) COMMENT 'the request name', request_conf mediumtext COMMENT 'the request config map', request_args mediumtext COMMENT 'the request arguments', - create_time bigint NOT NULL COMMENT 'the metadata create time', + create_time BIGINT NOT NULL COMMENT 'the metadata create time', engine_type varchar(32) NOT NULL COMMENT 'the engine type', cluster_manager varchar(128) COMMENT 'the engine cluster manager', engine_open_time bigint COMMENT 'the engine open time', @@ -24,14 +24,12 @@ CREATE TABLE IF NOT EXISTS metadata( engine_state varchar(32) COMMENT 'the engine application state', engine_error mediumtext COMMENT 'the engine application diagnose', end_time bigint COMMENT 'the metadata end time', - priority int DEFAULT 10 COMMENT 'the application priority, high value means high priority', + priority int DEFAULT 10 COMMENT 'the application priority, high value means high priority', peer_instance_closed boolean default '0' COMMENT 'closed by peer kyuubi instance', UNIQUE INDEX unique_identifier_index(identifier), INDEX user_name_index(user_name), INDEX engine_type_index(engine_type), INDEX create_time_index(create_time), - -- mysql 5.7 does not support mix order index - -- mysql 8 allow create mix order index and can be used in order by - -- here create it in 5.7 won't cause error + -- See more detail about this index in ./005-KYUUBI-5327.mysql.sql INDEX priority_create_time_index(priority DESC, create_time ASC) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;