From e072bf9e9b79d8b6508bccb809f5947a30d90f22 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Mon, 25 Nov 2019 14:17:17 +0000 Subject: [PATCH] MCOL-3628 Move I_S tables into main handler lib The I_S tables are all now in ha_columnstore.so --- dbcon/mysql/CMakeLists.txt | 57 +++------------------ dbcon/mysql/ha_mcs.cpp | 69 ++++++++++++++++++++++++++ dbcon/mysql/is_columnstore.h | 23 +++++++++ dbcon/mysql/is_columnstore_columns.cpp | 26 +--------- dbcon/mysql/is_columnstore_extents.cpp | 28 +---------- dbcon/mysql/is_columnstore_files.cpp | 24 +-------- dbcon/mysql/is_columnstore_tables.cpp | 27 +--------- 7 files changed, 106 insertions(+), 148 deletions(-) create mode 100644 dbcon/mysql/is_columnstore.h diff --git a/dbcon/mysql/CMakeLists.txt b/dbcon/mysql/CMakeLists.txt index 6183fdf68..ca2bb9381 100644 --- a/dbcon/mysql/CMakeLists.txt +++ b/dbcon/mysql/CMakeLists.txt @@ -23,7 +23,11 @@ SET ( libcalmysql_SRCS ha_view.cpp sm.cpp ha_window_function.cpp ha_mcs_partition.cpp - ha_pseudocolumn.cpp) + ha_pseudocolumn.cpp + is_columnstore_tables.cpp + is_columnstore_columns.cpp + is_columnstore_files.cpp + is_columnstore_extents.cpp) add_definitions(-DMYSQL_DYNAMIC_PLUGIN) @@ -36,56 +40,7 @@ target_link_libraries(ha_columnstore ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${NE set_target_properties(ha_columnstore PROPERTIES VERSION 1.0.0 SOVERSION 1) -SET ( is_columnstore_tables_SRCS - is_columnstore_tables.cpp - sm.cpp - ) -add_library(is_columnstore_tables SHARED ${is_columnstore_tables_SRCS}) - -target_link_libraries(is_columnstore_tables ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${SERVER_BUILD_DIR}/libservices/libmysqlservices.a threadpool) - -# Don't prepend .so file with 'lib' -set_target_properties(is_columnstore_tables PROPERTIES PREFIX "") -set_target_properties(is_columnstore_tables PROPERTIES VERSION 1.0.0 SOVERSION 1) - -SET ( is_columnstore_columns_SRCS - is_columnstore_columns.cpp - sm.cpp - ) -add_library(is_columnstore_columns SHARED ${is_columnstore_columns_SRCS}) - -target_link_libraries(is_columnstore_columns ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${SERVER_BUILD_DIR}/libservices/libmysqlservices.a threadpool) - -# Don't prepend .so file with 'lib' -set_target_properties(is_columnstore_columns PROPERTIES PREFIX "") -set_target_properties(is_columnstore_columns PROPERTIES VERSION 1.0.0 SOVERSION 1) - -SET ( is_columnstore_extents_SRCS - is_columnstore_extents.cpp - sm.cpp - ) -add_library(is_columnstore_extents SHARED ${is_columnstore_extents_SRCS}) - -target_link_libraries(is_columnstore_extents ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${SERVER_BUILD_DIR}/libservices/libmysqlservices.a threadpool) - -# Don't prepend .so file with 'lib' -set_target_properties(is_columnstore_extents PROPERTIES PREFIX "") -set_target_properties(is_columnstore_extents PROPERTIES VERSION 1.0.0 SOVERSION 1) - -SET ( is_columnstore_files_SRCS - is_columnstore_files.cpp - sm.cpp - ) -add_library(is_columnstore_files SHARED ${is_columnstore_files_SRCS}) - -target_link_libraries(is_columnstore_files ${ENGINE_LDFLAGS} ${ENGINE_WRITE_LIBS} ${SERVER_BUILD_DIR}/libservices/libmysqlservices.a threadpool) - -# Don't prepend .so file with 'lib' -set_target_properties(is_columnstore_files PROPERTIES PREFIX "") -set_target_properties(is_columnstore_files PROPERTIES VERSION 1.0.0 SOVERSION 1) - - -install(TARGETS ha_columnstore is_columnstore_tables is_columnstore_columns is_columnstore_extents is_columnstore_files DESTINATION ${MARIADB_PLUGINDIR} COMPONENT storage-engine) +install(TARGETS ha_columnstore DESTINATION ${MARIADB_PLUGINDIR} COMPONENT storage-engine) install(FILES syscatalog_mysql.sql dumpcat_mysql.sql calsetuserpriority.sql diff --git a/dbcon/mysql/ha_mcs.cpp b/dbcon/mysql/ha_mcs.cpp index d501140f5..76932b545 100644 --- a/dbcon/mysql/ha_mcs.cpp +++ b/dbcon/mysql/ha_mcs.cpp @@ -23,6 +23,7 @@ #include "ha_mcs_pushdown.h" #define NEED_CALPONT_EXTERNS #include "ha_mcs_impl.h" +#include "is_columnstore.h" static handler* calpont_create_handler(handlerton* hton, TABLE_SHARE* table, @@ -911,6 +912,10 @@ const COND* ha_mcs::cond_push(const COND* cond) struct st_mysql_storage_engine columnstore_storage_engine = { MYSQL_HANDLERTON_INTERFACE_VERSION }; +static struct st_mysql_information_schema is_columnstore_plugin_version = +{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; + + mysql_declare_plugin(columnstore) { MYSQL_STORAGE_ENGINE_PLUGIN, @@ -943,6 +948,70 @@ maria_declare_plugin(columnstore) mcs_system_variables, /* system variables */ "1.0", /* string version */ MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ +}, +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &is_columnstore_plugin_version, + "COLUMNSTORE_COLUMNS", + "MariaDB Corporation", + "An information schema plugin to list ColumnStore columns", + PLUGIN_LICENSE_GPL, + is_columnstore_columns_plugin_init, + //is_columnstore_tables_plugin_deinit, + NULL, + 0x0100, + NULL, + NULL, + "1.0", + MariaDB_PLUGIN_MATURITY_STABLE +}, +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &is_columnstore_plugin_version, + "COLUMNSTORE_TABLES", + "MariaDB Corporation", + "An information schema plugin to list ColumnStore tables", + PLUGIN_LICENSE_GPL, + is_columnstore_tables_plugin_init, + //is_columnstore_tables_plugin_deinit, + NULL, + 0x0100, + NULL, + NULL, + "1.0", + MariaDB_PLUGIN_MATURITY_STABLE +}, +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &is_columnstore_plugin_version, + "COLUMNSTORE_FILES", + "MariaDB Corporation", + "An information schema plugin to list ColumnStore filess", + PLUGIN_LICENSE_GPL, + is_columnstore_files_plugin_init, + //is_columnstore_files_plugin_deinit, + NULL, + 0x0100, + NULL, + NULL, + "1.0", + MariaDB_PLUGIN_MATURITY_STABLE +}, +{ + MYSQL_INFORMATION_SCHEMA_PLUGIN, + &is_columnstore_plugin_version, + "COLUMNSTORE_EXTENTS", + "MariaDB Corporation", + "An information schema plugin to list ColumnStore extents", + PLUGIN_LICENSE_GPL, + is_columnstore_extents_plugin_init, + //is_columnstore_extents_plugin_deinit, + NULL, + 0x0100, + NULL, + NULL, + "1.0", + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/dbcon/mysql/is_columnstore.h b/dbcon/mysql/is_columnstore.h new file mode 100644 index 000000000..27f899007 --- /dev/null +++ b/dbcon/mysql/is_columnstore.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2019 MariaDB Corporation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#pragma once + +int is_columnstore_extents_plugin_init(void* p); +int is_columnstore_files_plugin_init(void* p); +int is_columnstore_tables_plugin_init(void* p); +int is_columnstore_columns_plugin_init(void* p); diff --git a/dbcon/mysql/is_columnstore_columns.cpp b/dbcon/mysql/is_columnstore_columns.cpp index 66d97564c..b664cfc7c 100644 --- a/dbcon/mysql/is_columnstore_columns.cpp +++ b/dbcon/mysql/is_columnstore_columns.cpp @@ -28,6 +28,7 @@ #include "calpontsystemcatalog.h" #include "dataconvert.h" #include "exceptclasses.h" +#include "is_columnstore.h" using namespace logging; @@ -260,7 +261,7 @@ static int is_columnstore_columns_fill(THD* thd, TABLE_LIST* tables, COND* cond) return 0; } -static int is_columnstore_columns_plugin_init(void* p) +int is_columnstore_columns_plugin_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = is_columnstore_columns_fields; @@ -268,26 +269,3 @@ static int is_columnstore_columns_plugin_init(void* p) return 0; } -static struct st_mysql_information_schema is_columnstore_columns_plugin_version = -{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; - -maria_declare_plugin(is_columnstore_columns_plugin) -{ - MYSQL_INFORMATION_SCHEMA_PLUGIN, - &is_columnstore_columns_plugin_version, - "COLUMNSTORE_COLUMNS", - "MariaDB Corporation", - "An information schema plugin to list ColumnStore columns", - PLUGIN_LICENSE_GPL, - is_columnstore_columns_plugin_init, - //is_columnstore_tables_plugin_deinit, - NULL, - 0x0100, - NULL, - NULL, - "1.0", - MariaDB_PLUGIN_MATURITY_STABLE -} -maria_declare_plugin_end; - - diff --git a/dbcon/mysql/is_columnstore_extents.cpp b/dbcon/mysql/is_columnstore_extents.cpp index 99aa43eba..cb8044806 100644 --- a/dbcon/mysql/is_columnstore_extents.cpp +++ b/dbcon/mysql/is_columnstore_extents.cpp @@ -26,7 +26,7 @@ #include "dbrm.h" #include "objectidmanager.h" - +#include "is_columnstore.h" // Required declaration as it isn't in a MairaDB include bool schema_table_store_record(THD* thd, TABLE* table); @@ -278,34 +278,10 @@ static int is_columnstore_extents_fill(THD* thd, TABLE_LIST* tables, COND* cond) return 0; } -static int is_columnstore_extents_plugin_init(void* p) +int is_columnstore_extents_plugin_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = is_columnstore_extents_fields; schema->fill_table = is_columnstore_extents_fill; return 0; } - -static struct st_mysql_information_schema is_columnstore_extents_plugin_version = -{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; - -maria_declare_plugin(is_columnstore_extents_plugin) -{ - MYSQL_INFORMATION_SCHEMA_PLUGIN, - &is_columnstore_extents_plugin_version, - "COLUMNSTORE_EXTENTS", - "MariaDB Corporation", - "An information schema plugin to list ColumnStore extents", - PLUGIN_LICENSE_GPL, - is_columnstore_extents_plugin_init, - //is_columnstore_extents_plugin_deinit, - NULL, - 0x0100, - NULL, - NULL, - "1.0", - MariaDB_PLUGIN_MATURITY_STABLE -} -maria_declare_plugin_end; - - diff --git a/dbcon/mysql/is_columnstore_files.cpp b/dbcon/mysql/is_columnstore_files.cpp index 378985303..429b5c650 100644 --- a/dbcon/mysql/is_columnstore_files.cpp +++ b/dbcon/mysql/is_columnstore_files.cpp @@ -35,6 +35,7 @@ #include "messagequeue.h" #include "messagequeuepool.h" #include "we_messages.h" +#include "is_columnstore.h" // Required declaration as it isn't in a MairaDB include bool schema_table_store_record(THD* thd, TABLE* table); @@ -289,7 +290,7 @@ static int is_columnstore_files_fill(THD* thd, TABLE_LIST* tables, COND* cond) return 0; } -static int is_columnstore_files_plugin_init(void* p) +int is_columnstore_files_plugin_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = is_columnstore_files_fields; @@ -297,24 +298,3 @@ static int is_columnstore_files_plugin_init(void* p) return 0; } -static struct st_mysql_information_schema is_columnstore_files_plugin_version = -{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; - -maria_declare_plugin(is_columnstore_files_plugin) -{ - MYSQL_INFORMATION_SCHEMA_PLUGIN, - &is_columnstore_files_plugin_version, - "COLUMNSTORE_FILES", - "MariaDB Corporation", - "An information schema plugin to list ColumnStore filess", - PLUGIN_LICENSE_GPL, - is_columnstore_files_plugin_init, - //is_columnstore_files_plugin_deinit, - NULL, - 0x0100, - NULL, - NULL, - "1.0", - MariaDB_PLUGIN_MATURITY_STABLE -} -maria_declare_plugin_end; diff --git a/dbcon/mysql/is_columnstore_tables.cpp b/dbcon/mysql/is_columnstore_tables.cpp index 1f66308f7..711d80da5 100644 --- a/dbcon/mysql/is_columnstore_tables.cpp +++ b/dbcon/mysql/is_columnstore_tables.cpp @@ -26,7 +26,7 @@ #include #include "calpontsystemcatalog.h" #include "dataconvert.h" - +#include "is_columnstore.h" // Required declaration as it isn't in a MairaDB include bool schema_table_store_record(THD* thd, TABLE* table); @@ -158,7 +158,7 @@ static int is_columnstore_tables_fill(THD* thd, TABLE_LIST* tables, COND* cond) return 0; } -static int is_columnstore_tables_plugin_init(void* p) +int is_columnstore_tables_plugin_init(void* p) { ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; schema->fields_info = is_columnstore_tables_fields; @@ -166,26 +166,3 @@ static int is_columnstore_tables_plugin_init(void* p) return 0; } -static struct st_mysql_information_schema is_columnstore_tables_plugin_version = -{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; - -maria_declare_plugin(is_columnstore_tables_plugin) -{ - MYSQL_INFORMATION_SCHEMA_PLUGIN, - &is_columnstore_tables_plugin_version, - "COLUMNSTORE_TABLES", - "MariaDB Corporation", - "An information schema plugin to list ColumnStore tables", - PLUGIN_LICENSE_GPL, - is_columnstore_tables_plugin_init, - //is_columnstore_tables_plugin_deinit, - NULL, - 0x0100, - NULL, - NULL, - "1.0", - MariaDB_PLUGIN_MATURITY_STABLE -} -maria_declare_plugin_end; - -