You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2023/03/30 08:45:29 UTC
[inlong] branch master updated: [INLONG-7658][Manager] Optimized table index (#7665)
This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new bcdccdf3c [INLONG-7658][Manager] Optimized table index (#7665)
bcdccdf3c is described below
commit bcdccdf3c5a27e3407228f6f8930a133b4b97a53
Author: lvanneo <38...@users.noreply.github.com>
AuthorDate: Thu Mar 30 16:45:22 2023 +0800
[INLONG-7658][Manager] Optimized table index (#7665)
---
.../main/resources/h2/apache_inlong_manager.sql | 9 +++----
.../manager-web/sql/apache_inlong_manager.sql | 9 +++----
inlong-manager/manager-web/sql/changes-1.7.0.sql | 30 ++++++++++++++++++++++
3 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/inlong-manager/manager-test/src/main/resources/h2/apache_inlong_manager.sql b/inlong-manager/manager-test/src/main/resources/h2/apache_inlong_manager.sql
index f99d349b2..f64d5babc 100644
--- a/inlong-manager/manager-test/src/main/resources/h2/apache_inlong_manager.sql
+++ b/inlong-manager/manager-test/src/main/resources/h2/apache_inlong_manager.sql
@@ -68,8 +68,7 @@ CREATE TABLE IF NOT EXISTS `inlong_group_ext`
`is_deleted` int(11) DEFAULT '0' COMMENT 'Whether to delete, 0: not deleted, > 0: deleted',
`modify_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_inlong_group_key` (`inlong_group_id`, `key_name`),
- INDEX `group_ext_group_index` (`inlong_group_id`)
+ UNIQUE KEY `unique_inlong_group_key` (`inlong_group_id`, `key_name`)
);
-- ----------------------------
@@ -247,8 +246,7 @@ CREATE TABLE IF NOT EXISTS `inlong_stream`
`modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modify time',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'Version number, which will be incremented by 1 after modification',
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_inlong_stream` (`inlong_stream_id`, `inlong_group_id`, `is_deleted`),
- INDEX `stream_group_id_index` (`inlong_group_id`)
+ UNIQUE KEY `unique_inlong_stream` (`inlong_group_id`, `inlong_stream_id`, `is_deleted`)
);
-- ----------------------------
@@ -264,8 +262,7 @@ CREATE TABLE IF NOT EXISTS `inlong_stream_ext`
`is_deleted` int(11) DEFAULT '0' COMMENT 'Whether to delete, 0: not deleted, > 0: deleted',
`modify_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_inlong_stream_key` (`inlong_group_id`, `inlong_stream_id`, `key_name`),
- INDEX `stream_id_index` (`inlong_group_id`, `inlong_stream_id`)
+ UNIQUE KEY `unique_inlong_stream_key` (`inlong_group_id`, `inlong_stream_id`, `key_name`)
);
-- ----------------------------
diff --git a/inlong-manager/manager-web/sql/apache_inlong_manager.sql b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
index 14377c31e..9e398382b 100644
--- a/inlong-manager/manager-web/sql/apache_inlong_manager.sql
+++ b/inlong-manager/manager-web/sql/apache_inlong_manager.sql
@@ -75,8 +75,7 @@ CREATE TABLE IF NOT EXISTS `inlong_group_ext`
`is_deleted` int(11) DEFAULT '0' COMMENT 'Whether to delete, 0: not deleted, > 0: deleted',
`modify_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_inlong_group_key` (`inlong_group_id`, `key_name`),
- INDEX `group_ext_group_index` (`inlong_group_id`)
+ UNIQUE KEY `unique_inlong_group_key` (`inlong_group_id`, `key_name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='Inlong group extension table';
@@ -260,8 +259,7 @@ CREATE TABLE IF NOT EXISTS `inlong_stream`
`modify_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modify time',
`version` int(11) NOT NULL DEFAULT '1' COMMENT 'Version number, which will be incremented by 1 after modification',
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_inlong_stream` (`inlong_stream_id`, `inlong_group_id`, `is_deleted`),
- INDEX `stream_group_id_index` (`inlong_group_id`)
+ UNIQUE KEY `unique_inlong_stream` (`inlong_group_id`, `inlong_stream_id`, `is_deleted`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='Inlong stream table';
@@ -278,8 +276,7 @@ CREATE TABLE IF NOT EXISTS `inlong_stream_ext`
`is_deleted` int(11) DEFAULT '0' COMMENT 'Whether to delete, 0: not deleted, > 0: deleted',
`modify_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Modify time',
PRIMARY KEY (`id`),
- UNIQUE KEY `unique_inlong_stream_key` (`inlong_group_id`, `inlong_stream_id`, `key_name`),
- INDEX `stream_id_index` (`inlong_group_id`, `inlong_stream_id`)
+ UNIQUE KEY `unique_inlong_stream_key` (`inlong_group_id`, `inlong_stream_id`, `key_name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='Inlong stream extension table';
diff --git a/inlong-manager/manager-web/sql/changes-1.7.0.sql b/inlong-manager/manager-web/sql/changes-1.7.0.sql
new file mode 100644
index 000000000..5be093283
--- /dev/null
+++ b/inlong-manager/manager-web/sql/changes-1.7.0.sql
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+-- This is the SQL change file from version 1.6.0 to the current version 1.7.0.
+-- When upgrading to version 1.7.0, please execute those SQLs in the DB (such as MySQL) used by the Manager module.
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+USE `apache_inlong_manager`;
+
+DROP INDEX `group_ext_group_index` ON `inlong_group_ext`;
+DROP INDEX `stream_id_index` ON `inlong_stream_ext`;
+DROP INDEX `stream_group_id_index` ON `inlong_stream`;
+DROP INDEX `unique_inlong_stream` ON `inlong_stream`;
+ALTER TABLE `inlong_stream` ADD UNIQUE KEY `unique_inlong_stream` (`inlong_group_id`, `inlong_stream_id`, `is_deleted`);