diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-05-27 09:31:19 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-05-27 09:31:19 +0300 |
commit | ab87fc6c7ad4ce261a833330e939facc4358612a (patch) | |
tree | fc6953f3d18856d7cc9b982f09cd4a20bf449819 | |
parent | 17106c984b9649641068ddf108dcffd2c7773212 (diff) | |
download | mariadb-git-ab87fc6c7ad4ce261a833330e939facc4358612a.tar.gz |
Cleanup: Remove handler::update_table_comment()
The only call of the virtual member function
handler::update_table_comment() was removed in
commit 82d28fada7dc928564aefac802400c6684c11917 (MySQL 5.5.53)
but the implementation was not removed.
The only non-trivial implementation was for InnoDB. The information
is now returned via handler::get_foreign_key_create_info() and
ha_statistics::delete_length.
-rw-r--r-- | sql/ha_partition.cc | 21 | ||||
-rw-r--r-- | sql/ha_partition.h | 7 | ||||
-rw-r--r-- | sql/handler.h | 4 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 62 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.h | 1 |
5 files changed, 3 insertions, 92 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 523e76e511e..ad020acf5c4 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB + Copyright (c) 2009, 2021, MariaDB 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 @@ -2244,25 +2244,6 @@ void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) } } -/* - Change comments specific to handler - - SYNOPSIS - update_table_comment() - comment Original comment - - RETURN VALUE - new comment - - DESCRIPTION - No comment changes so far -*/ - -char *ha_partition::update_table_comment(const char *comment) -{ - return (char*) comment; /* Nothing to change */ -} - /** Handle delete and rename table diff --git a/sql/ha_partition.h b/sql/ha_partition.h index a48aa639237..34174089bf6 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -3,7 +3,7 @@ /* Copyright (c) 2005, 2012, Oracle and/or its affiliates. - Copyright (c) 2009, 2013, Monty Program Ab & SkySQL Ab. + Copyright (c) 2009, 2021, 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 @@ -314,10 +314,6 @@ public: Meta data routines to CREATE, DROP, RENAME table and often used at ALTER TABLE (update_create_info used from ALTER TABLE and SHOW ..). - update_table_comment is used in SHOW TABLE commands to provide a - chance for the handler to add any interesting comments to the table - comments not provided by the users comment. - create_partitioning_metadata is called before opening a new handler object with openfrm to call create. It is used to create any local handler object needed in opening the object in openfrm @@ -330,7 +326,6 @@ public: virtual int create_partitioning_metadata(const char *name, const char *old_name, int action_flag); virtual void update_create_info(HA_CREATE_INFO *create_info); - virtual char *update_table_comment(const char *comment); virtual int change_partitions(HA_CREATE_INFO *create_info, const char *path, ulonglong * const copied, diff --git a/sql/handler.h b/sql/handler.h index f618c1d6469..b3617d7a47a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2,7 +2,7 @@ #define HANDLER_INCLUDED /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB + Copyright (c) 2009, 2021, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -3363,8 +3363,6 @@ public: /* end of the list of admin commands */ virtual int indexes_are_disabled(void) {return 0;} - virtual char *update_table_comment(const char * comment) - { return (char*) comment;} virtual void append_create_info(String *packet) {} /** If index == MAX_KEY then a check for table is made and if index < diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 5617a293a23..81f1dae85b6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -15190,68 +15190,6 @@ ha_innobase::check( DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT); } -/*************************************************************//** -Adds information about free space in the InnoDB tablespace to a table comment -which is printed out when a user calls SHOW TABLE STATUS. Adds also info on -foreign keys. -@return table comment + InnoDB free space + info on foreign keys */ -UNIV_INTERN -char* -ha_innobase::update_table_comment( -/*==============================*/ - const char* comment)/*!< in: table comment defined by user */ -{ - uint length = (uint) strlen(comment); - char* str=0; - size_t flen; - std::string fk_str; - - /* We do not know if MySQL can call this function before calling - external_lock(). To be safe, update the thd of the current table - handle. */ - - if (length > 64000 - 3) { - return((char*) comment); /* string too long */ - } - - update_thd(ha_thd()); - - m_prebuilt->trx->op_info = "returning table comment"; - -#define SSTR( x ) reinterpret_cast< std::ostringstream & >( \ - ( std::ostringstream() << std::dec << x ) ).str() - - fk_str.append("InnoDB free: "); - fk_str.append(SSTR(fsp_get_available_space_in_free_extents( - m_prebuilt->table->space))); - - fk_str.append(dict_print_info_on_foreign_keys( - FALSE, m_prebuilt->trx, - m_prebuilt->table)); - - flen = fk_str.length(); - - if (length + flen + 3 > 64000) { - flen = 64000 - 3 - length; - } - /* allocate buffer for the full string */ - str = (char*) my_malloc(length + flen + 3, MYF(0)); - if (str) { - char* pos = str + length; - if (length) { - memcpy(str, comment, length); - *pos++ = ';'; - *pos++ = ' '; - } - memcpy(pos, fk_str.c_str(), flen); - pos[flen] = 0; - } - - m_prebuilt->trx->op_info = (char*)""; - - return(str ? str : (char*) comment); -} - /*******************************************************************//** Gets the foreign key create info for a table stored in InnoDB. @return own: character string in the form which can be inserted to the diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 274c6761d4f..eab009f7ac2 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -221,7 +221,6 @@ public: int rename_table(const char* from, const char* to); inline int defragment_table(const char* name); int check(THD* thd, HA_CHECK_OPT* check_opt); - char* update_table_comment(const char* comment); char* get_foreign_key_create_info(); |