diff options
Diffstat (limited to 'storage')
-rw-r--r-- | storage/archive/ha_archive.cc | 401 | ||||
-rw-r--r-- | storage/archive/ha_archive.h | 44 | ||||
-rw-r--r-- | storage/cassandra/ha_cassandra.cc | 2 | ||||
-rw-r--r-- | storage/example/ha_example.cc | 206 | ||||
-rw-r--r-- | storage/example/ha_example.h | 20 | ||||
-rw-r--r-- | storage/innobase/btr/btr0sea.cc | 8 | ||||
-rw-r--r-- | storage/innobase/ha/ha0ha.cc | 6 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 12 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.cc | 348 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.h | 58 | ||||
-rw-r--r-- | storage/innobase/include/ha0ha.h | 8 | ||||
-rw-r--r-- | storage/innobase/include/ha0ha.ic | 4 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 10 | ||||
-rw-r--r-- | storage/maria/ma_ft_boolean_search.c | 17 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 12 | ||||
-rw-r--r-- | storage/perfschema/pfs_digest.cc | 1 | ||||
-rw-r--r-- | storage/perfschema/pfs_instr.cc | 4 | ||||
-rw-r--r-- | storage/perfschema/unittest/CMakeLists.txt | 26 |
18 files changed, 496 insertions, 691 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 5a6251a5de6..291cd6a398b 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -97,15 +97,20 @@ -Brian */ -/* Variables for archive share methods */ -mysql_mutex_t archive_mutex; -static HASH archive_open_tables; /* The file extension */ #define ARZ ".ARZ" // The data file #define ARN ".ARN" // Files used during an optimize call #define ARM ".ARM" // Meta file (deprecated) +/* 5.0 compatibility */ +#define META_V1_OFFSET_CHECK_HEADER 0 +#define META_V1_OFFSET_VERSION 1 +#define META_V1_OFFSET_ROWS_RECORDED 2 +#define META_V1_OFFSET_CHECK_POINT 10 +#define META_V1_OFFSET_CRASHED 18 +#define META_V1_LENGTH 19 + /* uchar + uchar */ @@ -142,23 +147,12 @@ static handler *archive_create_handler(handlerton *hton, return new (mem_root) ha_archive(hton, table); } -/* - Used for hash table that tracks open tables. -*/ -static uchar* archive_get_key(ARCHIVE_SHARE *share, size_t *length, - my_bool not_used __attribute__((unused))) -{ - *length=share->table_name_length; - return (uchar*) share->table_name; -} - #ifdef HAVE_PSI_INTERFACE -PSI_mutex_key az_key_mutex_archive_mutex, az_key_mutex_ARCHIVE_SHARE_mutex; +PSI_mutex_key az_key_mutex_Archive_share_mutex; static PSI_mutex_info all_archive_mutexes[]= { - { &az_key_mutex_archive_mutex, "archive_mutex", PSI_FLAG_GLOBAL}, - { &az_key_mutex_ARCHIVE_SHARE_mutex, "ARCHIVE_SHARE::mutex", 0} + { &az_key_mutex_Archive_share_mutex, "Archive_share::mutex", 0} }; PSI_file_key arch_key_file_metadata, arch_key_file_data, arch_key_file_frm; @@ -214,39 +208,24 @@ int archive_db_init(void *p) archive_hton->flags= HTON_NO_FLAGS; archive_hton->discover= archive_discover; - if (mysql_mutex_init(az_key_mutex_archive_mutex, - &archive_mutex, MY_MUTEX_INIT_FAST)) - goto error; - if (my_hash_init(&archive_open_tables, table_alias_charset, 32, 0, 0, - (my_hash_get_key) archive_get_key, 0, 0)) - { - mysql_mutex_destroy(&archive_mutex); - } - else - { - DBUG_RETURN(FALSE); - } -error: - DBUG_RETURN(TRUE); + DBUG_RETURN(0); } -/* - Release the archive handler. - - SYNOPSIS - archive_db_done() - void - RETURN - FALSE OK -*/ - -int archive_db_done(void *p) +Archive_share::Archive_share() { - my_hash_free(&archive_open_tables); - mysql_mutex_destroy(&archive_mutex); - - return 0; + crashed= false; + in_optimize= false; + archive_write_open= false; + dirty= false; + DBUG_PRINT("ha_archive", ("Archive_share: %p", + this)); + thr_lock_init(&lock); + /* + We will use this lock for rows. + */ + mysql_mutex_init(az_key_mutex_Archive_share_mutex, + &mutex, MY_MUTEX_INIT_FAST); } @@ -301,6 +280,103 @@ err: DBUG_RETURN(1); } +/** + @brief Read version 1 meta file (5.0 compatibility routine). + + @return Completion status + @retval 0 Success + @retval !0 Failure +*/ + +int Archive_share::read_v1_metafile() +{ + char file_name[FN_REFLEN]; + uchar buf[META_V1_LENGTH]; + File fd; + DBUG_ENTER("Archive_share::read_v1_metafile"); + + fn_format(file_name, data_file_name, "", ARM, MY_REPLACE_EXT); + if ((fd= mysql_file_open(arch_key_file_metadata, file_name, O_RDONLY, MYF(0))) == -1) + DBUG_RETURN(-1); + + if (mysql_file_read(fd, buf, sizeof(buf), MYF(0)) != sizeof(buf)) + { + mysql_file_close(fd, MYF(0)); + DBUG_RETURN(-1); + } + + rows_recorded= uint8korr(buf + META_V1_OFFSET_ROWS_RECORDED); + crashed= buf[META_V1_OFFSET_CRASHED]; + mysql_file_close(fd, MYF(0)); + DBUG_RETURN(0); +} + + +/** + @brief Write version 1 meta file (5.0 compatibility routine). + + @return Completion status + @retval 0 Success + @retval !0 Failure +*/ + +int Archive_share::write_v1_metafile() +{ + char file_name[FN_REFLEN]; + uchar buf[META_V1_LENGTH]; + File fd; + DBUG_ENTER("Archive_share::write_v1_metafile"); + + buf[META_V1_OFFSET_CHECK_HEADER]= ARCHIVE_CHECK_HEADER; + buf[META_V1_OFFSET_VERSION]= 1; + int8store(buf + META_V1_OFFSET_ROWS_RECORDED, rows_recorded); + int8store(buf + META_V1_OFFSET_CHECK_POINT, (ulonglong) 0); + buf[META_V1_OFFSET_CRASHED]= crashed; + + fn_format(file_name, data_file_name, "", ARM, MY_REPLACE_EXT); + if ((fd= mysql_file_open(arch_key_file_metadata, file_name, O_WRONLY, MYF(0))) == -1) + DBUG_RETURN(-1); + + if (mysql_file_write(fd, buf, sizeof(buf), MYF(0)) != sizeof(buf)) + { + mysql_file_close(fd, MYF(0)); + DBUG_RETURN(-1); + } + + mysql_file_close(fd, MYF(0)); + DBUG_RETURN(0); +} + +/** + @brief Pack version 1 row (5.0 compatibility routine). + + @param[in] record the record to pack + + @return Length of packed row +*/ + +unsigned int ha_archive::pack_row_v1(uchar *record) +{ + uint *blob, *end; + uchar *pos; + DBUG_ENTER("pack_row_v1"); + memcpy(record_buffer->buffer, record, table->s->reclength); + pos= record_buffer->buffer + table->s->reclength; + for (blob= table->s->blob_field, end= blob + table->s->blob_fields; + blob != end; blob++) + { + uint32 length= ((Field_blob *) table->field[*blob])->get_length(); + if (length) + { + uchar *data_ptr; + ((Field_blob *) table->field[*blob])->get_ptr(&data_ptr); + memcpy(pos, data_ptr, length); + pos+= length; + } + } + DBUG_RETURN(pos - record_buffer->buffer); +} + /* This method reads the header of a datafile and returns whether or not it was successful. */ @@ -353,156 +429,102 @@ int ha_archive::read_data_header(azio_stream *file_to_read) See ha_example.cc for a longer description. */ -ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) +Archive_share *ha_archive::get_share(const char *table_name, int *rc) { - uint length; - DBUG_ENTER("ha_archive::get_share"); + Archive_share *tmp_share; - mysql_mutex_lock(&archive_mutex); - length=(uint) strlen(table_name); + DBUG_ENTER("ha_archive::get_share"); - if (!(share=(ARCHIVE_SHARE*) my_hash_search(&archive_open_tables, - (uchar*) table_name, - length))) + lock_shared_ha_data(); + if (!(tmp_share= static_cast<Archive_share*>(get_ha_share_ptr()))) { - char *tmp_name; azio_stream archive_tmp; - if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &share, sizeof(*share), - &tmp_name, length+1, - NullS)) + tmp_share= new Archive_share; + + if (!tmp_share) { - mysql_mutex_unlock(&archive_mutex); *rc= HA_ERR_OUT_OF_MEM; - DBUG_RETURN(NULL); + goto err; } + DBUG_PRINT("ha_archive", ("new Archive_share: %p", + tmp_share)); - share->use_count= 0; - share->table_name_length= length; - share->table_name= tmp_name; - share->crashed= FALSE; - share->archive_write_open= FALSE; - fn_format(share->data_file_name, table_name, "", + fn_format(tmp_share->data_file_name, table_name, "", ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME); - strmov(share->table_name, table_name); - DBUG_PRINT("ha_archive", ("Data File %s", - share->data_file_name)); - /* - We will use this lock for rows. - */ - mysql_mutex_init(az_key_mutex_ARCHIVE_SHARE_mutex, - &share->mutex, MY_MUTEX_INIT_FAST); - + strmov(tmp_share->table_name, table_name); + DBUG_PRINT("ha_archive", ("Data File %s", + tmp_share->data_file_name)); + /* We read the meta file, but do not mark it dirty. Since we are not doing a write we won't mark it dirty (and we won't open it for anything but reading... open it for write and we will generate null compression writes). */ - if (!(azopen(&archive_tmp, share->data_file_name, O_RDONLY|O_BINARY))) + if (!(azopen(&archive_tmp, tmp_share->data_file_name, O_RDONLY|O_BINARY))) { - *rc= my_errno ? my_errno : -1; - mysql_mutex_unlock(&archive_mutex); - mysql_mutex_destroy(&share->mutex); - my_free(share); - DBUG_RETURN(NULL); + delete tmp_share; + *rc= my_errno ? my_errno : HA_ERR_CRASHED; + tmp_share= NULL; + goto err; } - share->version= archive_tmp.version; - if (archive_tmp.version == ARCHIVE_VERSION) - { - stats.auto_increment_value= archive_tmp.auto_increment + 1; - share->rows_recorded= (ha_rows)archive_tmp.rows; - share->crashed= archive_tmp.dirty; - } - else - { - /* Used by repair */ - share->rows_recorded= ~(ha_rows) 0; - stats.auto_increment_value= 0; - } - /* - If archive version is less than 3, It should be upgraded before - use. - */ - if (archive_tmp.version < ARCHIVE_VERSION) - *rc= HA_ERR_TABLE_NEEDS_UPGRADE; + stats.auto_increment_value= archive_tmp.auto_increment + 1; + tmp_share->rows_recorded= (ha_rows)archive_tmp.rows; + tmp_share->crashed= archive_tmp.dirty; + share= tmp_share; + if (archive_tmp.version == 1) + share->read_v1_metafile(); azclose(&archive_tmp); - (void) my_hash_insert(&archive_open_tables, (uchar*) share); - thr_lock_init(&share->lock); + set_ha_share_ptr(static_cast<Handler_share*>(tmp_share)); } - share->use_count++; - DBUG_PRINT("ha_archive", ("archive table %.*s has %d open handles now", - share->table_name_length, share->table_name, - share->use_count)); - if (share->crashed) + if (tmp_share->crashed) *rc= HA_ERR_CRASHED_ON_USAGE; - mysql_mutex_unlock(&archive_mutex); - - DBUG_RETURN(share); -} - +err: + unlock_shared_ha_data(); -/* - Free the share. - See ha_example.cc for a description. -*/ -int ha_archive::free_share() -{ - int rc= 0; - DBUG_ENTER("ha_archive::free_share"); - DBUG_PRINT("ha_archive", - ("archive table %.*s has %d open handles on entrance", - share->table_name_length, share->table_name, - share->use_count)); - - mysql_mutex_lock(&archive_mutex); - if (!--share->use_count) - { - my_hash_delete(&archive_open_tables, (uchar*) share); - thr_lock_delete(&share->lock); - mysql_mutex_destroy(&share->mutex); - /* - We need to make sure we don't reset the crashed state. - If we open a crashed file, wee need to close it as crashed unless - it has been repaired. - Since we will close the data down after this, we go on and count - the flush on close; - */ - if (share->archive_write_open) - { - if (azclose(&(share->archive_write))) - rc= 1; - } - my_free(share); - } - mysql_mutex_unlock(&archive_mutex); + DBUG_ASSERT(tmp_share || *rc); - DBUG_RETURN(rc); + DBUG_RETURN(tmp_share); } -int ha_archive::init_archive_writer() + +int Archive_share::init_archive_writer() { - DBUG_ENTER("ha_archive::init_archive_writer"); - /* + DBUG_ENTER("Archive_share::init_archive_writer"); + /* It is expensive to open and close the data files and since you can't have a gzip file that can be both read and written we keep a writer open that is shared amoung all open tables. */ - if (!(azopen(&(share->archive_write), share->data_file_name, + if (!(azopen(&archive_write, data_file_name, O_RDWR|O_BINARY))) { DBUG_PRINT("ha_archive", ("Could not open archive write file")); - share->crashed= TRUE; + crashed= true; DBUG_RETURN(1); } - share->archive_write_open= TRUE; + archive_write_open= true; DBUG_RETURN(0); } +void Archive_share::close_archive_writer() +{ + mysql_mutex_assert_owner(&mutex); + if (archive_write_open) + { + if (archive_write.version == 1) + (void) write_v1_metafile(); + azclose(&archive_write); + archive_write_open= false; + dirty= false; + } +} + + /* No locks are required because it is associated with just one handler instance */ @@ -512,7 +534,8 @@ int ha_archive::init_archive_reader() /* It is expensive to open and close the data files and since you can't have a gzip file that can be both read and written we keep a writer open - that is shared amoung all open tables. + that is shared amoung all open tables, but have one reader open for + each handler instance. */ if (!archive_reader_open) { @@ -557,6 +580,8 @@ int ha_archive::open(const char *name, int mode, uint open_options) DBUG_PRINT("ha_archive", ("archive table was opened for crash: %s", (open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no")); share= get_share(name, &rc); + if (!share) + DBUG_RETURN(rc); /* Allow open on crashed table in repair mode only. @@ -583,7 +608,6 @@ int ha_archive::open(const char *name, int mode, uint open_options) rc= 0; break; } - free_share(); /* fall through */ default: DBUG_RETURN(rc); @@ -595,13 +619,17 @@ int ha_archive::open(const char *name, int mode, uint open_options) ARCHIVE_ROW_HEADER_SIZE); if (!record_buffer) - { - free_share(); DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } thr_lock_data_init(&share->lock, &lock, NULL); + DBUG_PRINT("ha_archive", ("archive table was crashed %s", + rc == HA_ERR_CRASHED_ON_USAGE ? "yes" : "no")); + if (rc == HA_ERR_CRASHED_ON_USAGE && open_options & HA_OPEN_FOR_REPAIR) + { + DBUG_RETURN(0); + } + DBUG_RETURN(rc); } @@ -636,8 +664,6 @@ int ha_archive::close(void) if (azclose(&archive)) rc= 1; } - /* then also close share */ - rc|= free_share(); DBUG_RETURN(rc); } @@ -812,7 +838,7 @@ int ha_archive::real_write_row(uchar *buf, azio_stream *writer) DBUG_ENTER("ha_archive::real_write_row"); /* We pack the row for writing */ - r_pack_length= pack_row(buf); + r_pack_length= pack_row(buf, writer); written= azwrite(writer, record_buffer->buffer, r_pack_length); if (written != r_pack_length) @@ -853,7 +879,7 @@ uint32 ha_archive::max_row_length(const uchar *buf) } -unsigned int ha_archive::pack_row(uchar *record) +unsigned int ha_archive::pack_row(uchar *record, azio_stream *writer) { uchar *ptr; @@ -863,6 +889,9 @@ unsigned int ha_archive::pack_row(uchar *record) if (fix_rec_buff(max_row_length(record))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */ + if (writer->version == 1) + DBUG_RETURN(pack_row_v1(record)); + /* Copy null bits */ memcpy(record_buffer->buffer+ARCHIVE_ROW_HEADER_SIZE, record, table->s->null_bytes); @@ -907,8 +936,8 @@ int ha_archive::write_row(uchar *buf) mysql_mutex_lock(&share->mutex); if (!share->archive_write_open) - if (init_archive_writer()) - DBUG_RETURN(errno); + if (share->init_archive_writer()) + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); if (table->next_number_field && record == table->record[0]) @@ -1373,11 +1402,26 @@ end: DBUG_RETURN(rc); } + +/** + @brief Check for upgrade + + @param[in] check_opt check options + + @return Completion status + @retval HA_ADMIN_OK No upgrade required + @retval HA_ADMIN_CORRUPT Cannot read meta-data + @retval HA_ADMIN_NEEDS_UPGRADE Upgrade required +*/ + int ha_archive::check_for_upgrade(HA_CHECK_OPT *check_opt) { - if (share->version < ARCHIVE_VERSION) - return HA_ADMIN_NEEDS_ALTER; - return 0; + DBUG_ENTER("ha_archive::check_for_upgrade"); + if (init_archive_reader()) + DBUG_RETURN(HA_ADMIN_CORRUPT); + if (archive.version < ARCHIVE_VERSION) + DBUG_RETURN(HA_ADMIN_NEEDS_UPGRADE); + DBUG_RETURN(HA_ADMIN_OK); } @@ -1573,6 +1617,7 @@ THR_LOCK_DATA **ha_archive::store_lock(THD *thd, void ha_archive::update_create_info(HA_CREATE_INFO *create_info) { + char tmp_real_path[FN_REFLEN]; DBUG_ENTER("ha_archive::update_create_info"); ha_archive::info(HA_STATUS_AUTO); @@ -1581,8 +1626,8 @@ void ha_archive::update_create_info(HA_CREATE_INFO *create_info) create_info->auto_increment_value= stats.auto_increment_value; } - if (!(my_readlink(share->real_path, share->data_file_name, MYF(0)))) - create_info->data_file_name= share->real_path; + if (!(my_readlink(tmp_real_path, share->data_file_name, MYF(0)))) + create_info->data_file_name= sql_strdup(tmp_real_path); DBUG_VOID_RETURN; } @@ -1806,6 +1851,20 @@ void ha_archive::destroy_record_buffer(archive_record_buffer *r) DBUG_VOID_RETURN; } +bool ha_archive::check_if_incompatible_data(HA_CREATE_INFO *info, + uint table_changes) +{ + if (info->auto_increment_value != stats.auto_increment_value || + (info->used_fields & HA_CREATE_USED_DATADIR) || + info->data_file_name || + (info->used_fields & HA_CREATE_USED_COMMENT) || + table_changes != IS_EQUAL_YES) + return COMPATIBLE_DATA_NO; + + return COMPATIBLE_DATA_YES; +} + + struct st_mysql_storage_engine archive_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; @@ -1818,7 +1877,7 @@ mysql_declare_plugin(archive) "Archive storage engine", PLUGIN_LICENSE_GPL, archive_db_init, /* Plugin Init */ - archive_db_done, /* Plugin Deinit */ + NULL, /* Plugin Deinit */ 0x0300 /* 3.0 */, NULL, /* status variables */ NULL, /* system variables */ @@ -1835,7 +1894,7 @@ maria_declare_plugin(archive) "Archive storage engine", PLUGIN_LICENSE_GPL, archive_db_init, /* Plugin Init */ - archive_db_done, /* Plugin Deinit */ + NULL, /* Plugin Deinit */ 0x0300 /* 3.0 */, NULL, /* status variables */ NULL, /* system variables */ diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 627267c7306..0b6c9eab472 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -32,20 +32,38 @@ typedef struct st_archive_record_buffer { } archive_record_buffer; -typedef struct st_archive_share { - char *table_name; - char data_file_name[FN_REFLEN]; - uint table_name_length,use_count, version; +class Archive_share : public Handler_share +{ +public: mysql_mutex_t mutex; THR_LOCK lock; azio_stream archive_write; /* Archive file we are working with */ + ha_rows rows_recorded; /* Number of rows in tables */ + char table_name[FN_REFLEN]; + char data_file_name[FN_REFLEN]; + bool in_optimize; bool archive_write_open; bool dirty; /* Flag for if a flush should occur */ bool crashed; /* Meta file is crashed */ - ha_rows rows_recorded; /* Number of rows in tables */ - ulonglong mean_rec_length; - char real_path[FN_REFLEN]; -} ARCHIVE_SHARE; + Archive_share(); + ~Archive_share() + { + DBUG_PRINT("ha_archive", ("~Archive_share: %p", + this)); + if (archive_write_open) + { + mysql_mutex_lock(&mutex); + (void) close_archive_writer(); + mysql_mutex_unlock(&mutex); + } + thr_lock_delete(&lock); + mysql_mutex_destroy(&mutex); + } + int init_archive_writer(); + void close_archive_writer(); + int write_v1_metafile(); + int read_v1_metafile(); +}; /* Version for file format. @@ -58,7 +76,7 @@ typedef struct st_archive_share { class ha_archive: public handler { THR_LOCK_DATA lock; /* MySQL lock */ - ARCHIVE_SHARE *share; /* Shared lock info */ + Archive_share *share; /* Shared lock info */ azio_stream archive; /* Archive file we are working with */ my_off_t current_position; /* The position of the row we just read */ @@ -76,6 +94,7 @@ class ha_archive: public handler archive_record_buffer *create_record_buffer(unsigned int length); void destroy_record_buffer(archive_record_buffer *r); int frm_copy(azio_stream *src, azio_stream *dst); + unsigned int pack_row_v1(uchar *record); public: ha_archive(handlerton *hton, TABLE_SHARE *table_arg); @@ -121,9 +140,7 @@ public: int get_row(azio_stream *file_to_read, uchar *buf); int get_row_version2(azio_stream *file_to_read, uchar *buf); int get_row_version3(azio_stream *file_to_read, uchar *buf); - ARCHIVE_SHARE *get_share(const char *table_name, int *rc); - int free_share(); - int init_archive_writer(); + Archive_share *get_share(const char *table_name, int *rc); int init_archive_reader(); // Always try auto_repair in case of HA_ERR_CRASHED_ON_USAGE bool auto_repair(int error) const @@ -150,6 +167,7 @@ public: uint32 max_row_length(const uchar *buf); bool fix_rec_buff(unsigned int length); int unpack_row(azio_stream *file_to_read, uchar *record); - unsigned int pack_row(uchar *record); + unsigned int pack_row(uchar *record, azio_stream *writer); + bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); }; diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index e8c5b844e3d..2998accc874 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -2344,7 +2344,7 @@ int ha_cassandra::multi_range_read_explain_info(uint mrr_mode, char *str, size_t if (!(mrr_mode & HA_MRR_USE_DEFAULT_IMPL)) { uint mrr_str_len= strlen(mrr_str); - uint copy_len= min(mrr_str_len, size); + uint copy_len= MY_MIN(mrr_str_len, size); memcpy(str, mrr_str, size); return copy_len; } diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 98968d0b5b5..b37845bf9ec 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -107,17 +107,6 @@ static handler *example_create_handler(handlerton *hton, handlerton *example_hton; -/* Variables for example share methods */ - -/* - Hash used to track the number of open tables; variable for example share - methods -*/ -static HASH example_open_tables; - -/* The mutex used to init the hash; variable for example share methods */ -mysql_mutex_t example_mutex; - /** Structure for CREATE TABLE options (table options). @@ -199,20 +188,12 @@ ha_create_table_option example_field_option_list[]= Function we use in the creation of our hash to get key. */ -static uchar* example_get_key(EXAMPLE_SHARE *share, size_t *length, - my_bool not_used __attribute__((unused))) -{ - *length=share->table_name_length; - return (uchar*) share->table_name; -} - #ifdef HAVE_PSI_INTERFACE -static PSI_mutex_key ex_key_mutex_example, ex_key_mutex_EXAMPLE_SHARE_mutex; +static PSI_mutex_key ex_key_mutex_Example_share_mutex; static PSI_mutex_info all_example_mutexes[]= { - { &ex_key_mutex_example, "example", PSI_FLAG_GLOBAL}, - { &ex_key_mutex_EXAMPLE_SHARE_mutex, "EXAMPLE_SHARE::mutex", 0} + { &ex_key_mutex_Example_share_mutex, "Example_share::mutex", 0} }; static void init_example_psi_keys() @@ -220,15 +201,20 @@ static void init_example_psi_keys() const char* category= "example"; int count; - if (PSI_server == NULL) - return; - count= array_elements(all_example_mutexes); - PSI_server->register_mutex(category, all_example_mutexes, count); + mysql_mutex_register(category, all_example_mutexes, count); } #endif +Example_share::Example_share() +{ + thr_lock_init(&lock); + mysql_mutex_init(ex_key_mutex_Example_share_mutex, + &mutex, MY_MUTEX_INIT_FAST); +} + + static int example_init_func(void *p) { DBUG_ENTER("example_init_func"); @@ -238,10 +224,6 @@ static int example_init_func(void *p) #endif example_hton= (handlerton *)p; - mysql_mutex_init(ex_key_mutex_example, &example_mutex, MY_MUTEX_INIT_FAST); - (void) my_hash_init(&example_open_tables,system_charset_info,32,0,0, - (my_hash_get_key) example_get_key,0,0); - example_hton->state= SHOW_OPTION_YES; example_hton->create= example_create_handler; example_hton->flags= HTON_CAN_RECREATE; @@ -252,20 +234,6 @@ static int example_init_func(void *p) } -static int example_done_func(void *p) -{ - int error= 0; - DBUG_ENTER("example_done_func"); - - if (example_open_tables.records) - error= 1; - my_hash_free(&example_open_tables); - mysql_mutex_destroy(&example_mutex); - - DBUG_RETURN(error); -} - - /** @brief Example of simple lock controls. The "share" it creates is a @@ -274,71 +242,24 @@ static int example_done_func(void *p) they are needed to function. */ -static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) +Example_share *ha_example::get_share() { - EXAMPLE_SHARE *share; - uint length; - char *tmp_name; + Example_share *tmp_share; - mysql_mutex_lock(&example_mutex); - length=(uint) strlen(table_name); + DBUG_ENTER("ha_example::get_share()"); - if (!(share=(EXAMPLE_SHARE*) my_hash_search(&example_open_tables, - (uchar*) table_name, - length))) + lock_shared_ha_data(); + if (!(tmp_share= static_cast<Example_share*>(get_ha_share_ptr()))) { - if (!(share=(EXAMPLE_SHARE *) - my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), - &share, sizeof(*share), - &tmp_name, length+1, - NullS))) - { - mysql_mutex_unlock(&example_mutex); - return NULL; - } - - share->use_count=0; - share->table_name_length=length; - share->table_name=tmp_name; - strmov(share->table_name,table_name); - if (my_hash_insert(&example_open_tables, (uchar*) share)) - goto error; - thr_lock_init(&share->lock); - mysql_mutex_init(ex_key_mutex_EXAMPLE_SHARE_mutex, - &share->mutex, MY_MUTEX_INIT_FAST); - } - share->use_count++; - mysql_mutex_unlock(&example_mutex); - - return share; + tmp_share= new Example_share; + if (!tmp_share) + goto err; -error: - mysql_mutex_destroy(&share->mutex); - my_free(share); - - return NULL; -} - - -/** - @brief - Free lock controls. We call this whenever we close a table. If the table had - the last reference to the share, then we free memory associated with it. -*/ - -static int free_share(EXAMPLE_SHARE *share) -{ - mysql_mutex_lock(&example_mutex); - if (!--share->use_count) - { - my_hash_delete(&example_open_tables, (uchar*) share); - thr_lock_delete(&share->lock); - mysql_mutex_destroy(&share->mutex); - my_free(share); + set_ha_share_ptr(static_cast<Handler_share*>(tmp_share)); } - mysql_mutex_unlock(&example_mutex); - - return 0; +err: + unlock_shared_ha_data(); + DBUG_RETURN(tmp_share); } static handler* example_create_handler(handlerton *hton, @@ -400,7 +321,7 @@ int ha_example::open(const char *name, int mode, uint test_if_locked) { DBUG_ENTER("ha_example::open"); - if (!(share = get_share(name, table))) + if (!(share = get_share())) DBUG_RETURN(1); thr_lock_data_init(&share->lock,&lock,NULL); @@ -420,8 +341,7 @@ int ha_example::open(const char *name, int mode, uint test_if_locked) /** @brief - Closes a table. We call the free_share() function to free any resources - that we have allocated in the "shared" structure. + Closes a table. @details Called from sql_base.cc, sql_select.cc, and table.cc. In sql_select.cc it is @@ -437,7 +357,7 @@ int ha_example::open(const char *name, int mode, uint test_if_locked) int ha_example::close(void) { DBUG_ENTER("ha_example::close"); - DBUG_RETURN(free_share(share)); + DBUG_RETURN(0); } @@ -979,76 +899,6 @@ int ha_example::create(const char *name, TABLE *table_arg, } -/** - check_if_incompatible_data() called if ALTER TABLE can't detect otherwise - if new and old definition are compatible - - @details If there are no other explicit signs like changed number of - fields this function will be called by compare_tables() - (sql/sql_tables.cc) to decide should we rewrite whole table or only .frm - file. - -*/ - -bool ha_example::check_if_incompatible_data(HA_CREATE_INFO *info, - uint table_changes) -{ - ha_table_option_struct *param_old, *param_new; - DBUG_ENTER("ha_example::check_if_incompatible_data"); - /* - This example shows how custom engine specific table and field - options can be accessed from this function to be compared. - */ - param_new= info->option_struct; - DBUG_PRINT("info", ("new strparam: '%-.64s' ullparam: %llu enumparam: %u " - "boolparam: %u", - (param_new->strparam ? param_new->strparam : "<NULL>"), - param_new->ullparam, param_new->enumparam, - param_new->boolparam)); - - param_old= table->s->option_struct; - DBUG_PRINT("info", ("old strparam: '%-.64s' ullparam: %llu enumparam: %u " - "boolparam: %u", - (param_old->strparam ? param_old->strparam : "<NULL>"), - param_old->ullparam, param_old->enumparam, - param_old->boolparam)); - - /* - check important parameters: - for this example engine, we'll assume that changing ullparam or - boolparam requires a table to be rebuilt, while changing strparam - or enumparam - does not. - */ - if (param_new->ullparam != param_old->ullparam || - param_new->boolparam != param_old->boolparam) - DBUG_RETURN(COMPATIBLE_DATA_NO); - -#ifndef DBUG_OFF - for (uint i= 0; i < table->s->fields; i++) - { - ha_field_option_struct *f_old, *f_new; - f_old= table->s->field[i]->option_struct; - DBUG_ASSERT(f_old); - DBUG_PRINT("info", ("old field: %u old complex: '%-.64s'", i, - (f_old->complex_param_to_parse_it_in_engine ? - f_old->complex_param_to_parse_it_in_engine : - "<NULL>"))); - if (info->fields_option_struct[i]) - { - f_new= info->fields_option_struct[i]; - DBUG_PRINT("info", ("old field: %u new complex: '%-.64s'", i, - (f_new->complex_param_to_parse_it_in_engine ? - f_new->complex_param_to_parse_it_in_engine : - "<NULL>"))); - } - else - DBUG_PRINT("info", ("old field %i did not changed", i)); - } -#endif - - DBUG_RETURN(COMPATIBLE_DATA_YES); -} - struct st_mysql_storage_engine example_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION }; @@ -1126,7 +976,7 @@ mysql_declare_plugin(example) "Example storage engine", PLUGIN_LICENSE_GPL, example_init_func, /* Plugin Init */ - example_done_func, /* Plugin Deinit */ + NULL, /* Plugin Deinit */ 0x0001 /* 0.1 */, func_status, /* status variables */ example_system_variables, /* system variables */ @@ -1143,7 +993,7 @@ maria_declare_plugin(example) "Example storage engine", PLUGIN_LICENSE_GPL, example_init_func, /* Plugin Init */ - example_done_func, /* Plugin Deinit */ + NULL, /* Plugin Deinit */ 0x0001, /* version number (0.1) */ func_status, /* status variables */ example_system_variables, /* system variables */ diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 9be370edfe3..361e4b3a848 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -42,15 +42,20 @@ #include "my_base.h" /* ha_rows */ /** @brief - EXAMPLE_SHARE is a structure that will be shared among all open handlers. + Example_share is a class that will be shared among all open handlers. This example implements the minimum of what you will probably need. */ -typedef struct st_example_share { - char *table_name; - uint table_name_length,use_count; +class Example_share : public Handler_share { +public: mysql_mutex_t mutex; THR_LOCK lock; -} EXAMPLE_SHARE; + Example_share(); + ~Example_share() + { + thr_lock_delete(&lock); + mysql_mutex_destroy(&mutex); + } +}; /** @brief Class definition for the storage engine @@ -58,7 +63,8 @@ typedef struct st_example_share { class ha_example: public handler { THR_LOCK_DATA lock; ///< MySQL lock - EXAMPLE_SHARE *share; ///< Shared lock info + Example_share *share; ///< Shared lock info + Example_share *get_share(); ///< Get the share public: ha_example(handlerton *hton, TABLE_SHARE *table_arg); @@ -246,8 +252,6 @@ public: int delete_table(const char *from); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); ///< required - bool check_if_incompatible_data(HA_CREATE_INFO *info, - uint table_changes); THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); ///< required diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 432fef05dd5..dcb508a7f29 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -351,7 +351,7 @@ void btr_search_info_update_hash( /*========================*/ btr_search_t* info, /*!< in/out: search info */ - btr_cur_t* cursor) /*!< in: cursor which was just positioned */ + const btr_cur_t* cursor)/*!< in: cursor which was just positioned */ { dict_index_t* index; ulint n_unique; @@ -620,7 +620,7 @@ void btr_search_info_update_slow( /*========================*/ btr_search_t* info, /*!< in/out: search info */ - btr_cur_t* cursor) /*!< in: cursor which was just positioned */ + btr_cur_t* cursor) /*!< in: cursor which was just positioned */ { buf_block_t* block; ibool build_index; @@ -864,7 +864,7 @@ btr_search_guess_on_hash( { buf_pool_t* buf_pool; buf_block_t* block; - rec_t* rec; + const rec_t* rec; ulint fold; index_id_t index_id; #ifdef notdefined @@ -950,7 +950,7 @@ btr_search_guess_on_hash( ut_ad(page_rec_is_user_rec(rec)); - btr_cur_position(index, rec, block, cursor); + btr_cur_position(index, (rec_t*) rec, block, cursor); /* Check the validity of the guess within the page */ diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc index 3ec778f3bec..ae1eb55982a 100644 --- a/storage/innobase/ha/ha0ha.cc +++ b/storage/innobase/ha/ha0ha.cc @@ -173,7 +173,7 @@ ha_insert_for_fold_func( #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG buf_block_t* block, /*!< in: buffer block containing the data */ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - rec_t* data) /*!< in: data, must not be NULL */ + const rec_t* data) /*!< in: data, must not be NULL */ { hash_cell_t* cell; ha_node_t* node; @@ -298,11 +298,11 @@ ha_search_and_update_if_found_func( /*===============================*/ hash_table_t* table, /*!< in/out: hash table */ ulint fold, /*!< in: folded value of the searched data */ - rec_t* data, /*!< in: pointer to the data */ + const rec_t* data, /*!< in: pointer to the data */ #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG buf_block_t* new_block,/*!< in: block containing new_data */ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - rec_t* new_data)/*!< in: new pointer to the data */ + const rec_t* new_data)/*!< in: new pointer to the data */ { ha_node_t* node; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 44bbe20c8d3..68d5cb512f6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1564,7 +1564,7 @@ innobase_get_cset_width( /* Fix bug#46256: allow tables to be dropped if the collation is not found, but issue a warning. */ - if ((log_warnings) + if ((global_system_variables.log_warnings) && (cset != 0)){ sql_print_warning( @@ -3969,7 +3969,7 @@ innobase_close_connection( "but transaction is active"); } - if (trx_is_started(trx) && log_warnings) { + if (trx_is_started(trx) && global_system_variables.log_warnings) { sql_print_warning( "MySQL is closing a connection that has an active " @@ -16482,7 +16482,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { NULL }; -mysql_declare_plugin(innobase) +maria_declare_plugin(innobase) { MYSQL_STORAGE_ENGINE_PLUGIN, &innobase_storage_engine, @@ -16495,8 +16495,8 @@ mysql_declare_plugin(innobase) INNODB_VERSION_SHORT, innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ - NULL, /* reserved */ - 0, /* flags */ + INNODB_VERSION_STR, /* string version */ + MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ }, i_s_innodb_trx, i_s_innodb_locks, @@ -16528,7 +16528,7 @@ i_s_innodb_sys_foreign_cols, i_s_innodb_sys_tablespaces, i_s_innodb_sys_datafiles -mysql_declare_plugin_end; +maria_declare_plugin_end; /** @brief Initialize the default value of innodb_commit_concurrency. diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 4f84f477b3a..25c0793b445 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -747,7 +747,7 @@ static struct st_mysql_information_schema i_s_info = MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION }; -UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx = +UNIV_INTERN struct st_maria_plugin i_s_innodb_trx = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -791,13 +791,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ @@ -1010,7 +1006,7 @@ innodb_locks_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks = +UNIV_INTERN struct st_maria_plugin i_s_innodb_locks = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -1054,13 +1050,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ @@ -1197,7 +1189,7 @@ innodb_lock_waits_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits = +UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -1241,13 +1233,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -1534,7 +1522,7 @@ i_s_cmp_reset_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp = +UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -1578,16 +1566,12 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = +UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -1632,13 +1616,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic tables @@ -1892,7 +1872,7 @@ i_s_cmp_per_index_reset_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index = +UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -1936,16 +1916,12 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset = +UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -1990,13 +1966,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table information_schema.innodb_cmpmem. */ @@ -2191,7 +2163,7 @@ i_s_cmpmem_reset_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem = +UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -2235,16 +2207,12 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = +UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -2289,13 +2257,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */ @@ -2773,7 +2737,7 @@ innodb_metrics_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_metrics = +UNIV_INTERN struct st_maria_plugin i_s_innodb_metrics = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -2817,13 +2781,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_metrics = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */ static ST_FIELD_INFO i_s_stopword_fields_info[] = @@ -2890,7 +2850,7 @@ i_s_stopword_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_default_stopword = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_default_stopword = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -2934,13 +2894,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_default_stopword = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED @@ -3063,7 +3019,7 @@ i_s_fts_deleted_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_deleted = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_deleted = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -3107,13 +3063,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_deleted = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3150,7 +3102,7 @@ i_s_fts_being_deleted_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_being_deleted = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_being_deleted = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -3194,13 +3146,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_being_deleted = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3287,7 +3235,7 @@ i_s_fts_inserted_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_inserted = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_inserted = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -3331,13 +3279,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_inserted = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and @@ -3554,7 +3498,7 @@ i_s_fts_index_cache_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_cache = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_cache = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -3598,13 +3542,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_cache = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3859,7 +3799,7 @@ i_s_fts_index_table_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_table = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_table = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -3903,13 +3843,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_table = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */ @@ -4063,7 +3999,7 @@ i_s_fts_config_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_config = +UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -4107,13 +4043,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_config = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */ @@ -4586,7 +4518,7 @@ i_s_innodb_buffer_pool_stats_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_stats = +UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -4630,13 +4562,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_stats = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */ @@ -5280,7 +5208,7 @@ i_s_innodb_buffer_page_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_page = +UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -5324,13 +5252,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_page = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = @@ -5826,7 +5750,7 @@ i_s_innodb_buffer_page_lru_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_page_lru = +UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -5870,13 +5794,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_page_lru = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -6122,7 +6042,7 @@ innodb_sys_tables_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tables = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -6166,13 +6086,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tables = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_TABLESTATS ***********************************************/ @@ -6415,7 +6331,7 @@ innodb_sys_tablestats_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablestats = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -6459,13 +6375,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablestats = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_INDEXES **************************************************/ @@ -6670,7 +6582,7 @@ innodb_sys_indexes_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_indexes = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -6714,13 +6626,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_indexes = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_COLUMNS **************************************************/ @@ -6910,7 +6818,7 @@ innodb_sys_columns_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_columns = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -6954,13 +6862,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_columns = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_FIELDS ***************************************************/ @@ -7123,7 +7027,7 @@ innodb_sys_fields_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_fields = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -7167,13 +7071,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_fields = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_FOREIGN ********************************************/ @@ -7351,7 +7251,7 @@ innodb_sys_foreign_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -7395,13 +7295,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_FOREIGN_COLS ********************************************/ @@ -7571,7 +7467,7 @@ innodb_sys_foreign_cols_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign_cols = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -7615,13 +7511,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_foreign_cols = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_TABLESPACES ********************************************/ @@ -7838,7 +7730,7 @@ innodb_sys_tablespaces_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablespaces = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablespaces = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -7882,13 +7774,9 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablespaces = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_DATAFILES ************************************************/ @@ -8030,7 +7918,7 @@ innodb_sys_datafiles_init( DBUG_RETURN(0); } -UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_datafiles = +UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_datafiles = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ /* int */ @@ -8074,11 +7962,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_datafiles = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - /* reserved for dependency checking */ - /* void* */ - STRUCT_FLD(__reserved1, NULL), - - /* Plugin flags */ - /* unsigned long */ - STRUCT_FLD(flags, 0UL), + /* Maria extension */ + STRUCT_FLD(version_info, INNODB_VERSION_STR), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h index 9e3e651706a..05f6fd8ecd2 100644 --- a/storage/innobase/handler/i_s.h +++ b/storage/innobase/handler/i_s.h @@ -28,34 +28,34 @@ Created July 18, 2007 Vasil Dimov const char plugin_author[] = "Oracle Corporation"; -extern struct st_mysql_plugin i_s_innodb_trx; -extern struct st_mysql_plugin i_s_innodb_locks; -extern struct st_mysql_plugin i_s_innodb_lock_waits; -extern struct st_mysql_plugin i_s_innodb_cmp; -extern struct st_mysql_plugin i_s_innodb_cmp_reset; -extern struct st_mysql_plugin i_s_innodb_cmp_per_index; -extern struct st_mysql_plugin i_s_innodb_cmp_per_index_reset; -extern struct st_mysql_plugin i_s_innodb_cmpmem; -extern struct st_mysql_plugin i_s_innodb_cmpmem_reset; -extern struct st_mysql_plugin i_s_innodb_metrics; -extern struct st_mysql_plugin i_s_innodb_ft_default_stopword; -extern struct st_mysql_plugin i_s_innodb_ft_inserted; -extern struct st_mysql_plugin i_s_innodb_ft_deleted; -extern struct st_mysql_plugin i_s_innodb_ft_being_deleted; -extern struct st_mysql_plugin i_s_innodb_ft_index_cache; -extern struct st_mysql_plugin i_s_innodb_ft_index_table; -extern struct st_mysql_plugin i_s_innodb_ft_config; -extern struct st_mysql_plugin i_s_innodb_buffer_page; -extern struct st_mysql_plugin i_s_innodb_buffer_page_lru; -extern struct st_mysql_plugin i_s_innodb_buffer_stats; -extern struct st_mysql_plugin i_s_innodb_sys_tables; -extern struct st_mysql_plugin i_s_innodb_sys_tablestats; -extern struct st_mysql_plugin i_s_innodb_sys_indexes; -extern struct st_mysql_plugin i_s_innodb_sys_columns; -extern struct st_mysql_plugin i_s_innodb_sys_fields; -extern struct st_mysql_plugin i_s_innodb_sys_foreign; -extern struct st_mysql_plugin i_s_innodb_sys_foreign_cols; -extern struct st_mysql_plugin i_s_innodb_sys_tablespaces; -extern struct st_mysql_plugin i_s_innodb_sys_datafiles; +extern struct st_maria_plugin i_s_innodb_trx; +extern struct st_maria_plugin i_s_innodb_locks; +extern struct st_maria_plugin i_s_innodb_lock_waits; +extern struct st_maria_plugin i_s_innodb_cmp; +extern struct st_maria_plugin i_s_innodb_cmp_reset; +extern struct st_maria_plugin i_s_innodb_cmp_per_index; +extern struct st_maria_plugin i_s_innodb_cmp_per_index_reset; +extern struct st_maria_plugin i_s_innodb_cmpmem; +extern struct st_maria_plugin i_s_innodb_cmpmem_reset; +extern struct st_maria_plugin i_s_innodb_metrics; +extern struct st_maria_plugin i_s_innodb_ft_default_stopword; +extern struct st_maria_plugin i_s_innodb_ft_inserted; +extern struct st_maria_plugin i_s_innodb_ft_deleted; +extern struct st_maria_plugin i_s_innodb_ft_being_deleted; +extern struct st_maria_plugin i_s_innodb_ft_index_cache; +extern struct st_maria_plugin i_s_innodb_ft_index_table; +extern struct st_maria_plugin i_s_innodb_ft_config; +extern struct st_maria_plugin i_s_innodb_buffer_page; +extern struct st_maria_plugin i_s_innodb_buffer_page_lru; +extern struct st_maria_plugin i_s_innodb_buffer_stats; +extern struct st_maria_plugin i_s_innodb_sys_tables; +extern struct st_maria_plugin i_s_innodb_sys_tablestats; +extern struct st_maria_plugin i_s_innodb_sys_indexes; +extern struct st_maria_plugin i_s_innodb_sys_columns; +extern struct st_maria_plugin i_s_innodb_sys_fields; +extern struct st_maria_plugin i_s_innodb_sys_foreign; +extern struct st_maria_plugin i_s_innodb_sys_foreign_cols; +extern struct st_maria_plugin i_s_innodb_sys_tablespaces; +extern struct st_maria_plugin i_s_innodb_sys_datafiles; #endif /* i_s_h */ diff --git a/storage/innobase/include/ha0ha.h b/storage/innobase/include/ha0ha.h index 2e4397ea5fc..07ab20ab995 100644 --- a/storage/innobase/include/ha0ha.h +++ b/storage/innobase/include/ha0ha.h @@ -38,7 +38,7 @@ Looks for an element in a hash table. @return pointer to the data of the first hash table node in chain having the fold number, NULL if not found */ UNIV_INLINE -rec_t* +const rec_t* ha_search_and_get_data( /*===================*/ hash_table_t* table, /*!< in: hash table */ @@ -53,11 +53,11 @@ ha_search_and_update_if_found_func( /*===============================*/ hash_table_t* table, /*!< in/out: hash table */ ulint fold, /*!< in: folded value of the searched data */ - rec_t* data, /*!< in: pointer to the data */ + const rec_t* data, /*!< in: pointer to the data */ #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG buf_block_t* new_block,/*!< in: block containing new_data */ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - rec_t* new_data);/*!< in: new pointer to the data */ + const rec_t* new_data);/*!< in: new pointer to the data */ #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG /** Looks for an element when we know the pointer to the data and @@ -226,7 +226,7 @@ struct ha_node_t { #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG buf_block_t* block; /*!< buffer block containing the data, or NULL */ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - rec_t* data; /*!< pointer to the data */ + const rec_t* data; /*!< pointer to the data */ ulint fold; /*!< fold value for the data */ }; diff --git a/storage/innobase/include/ha0ha.ic b/storage/innobase/include/ha0ha.ic index 91794e8f1fc..c478ff54303 100644 --- a/storage/innobase/include/ha0ha.ic +++ b/storage/innobase/include/ha0ha.ic @@ -58,7 +58,7 @@ ha_node_set_data_func( #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG buf_block_t* block, /*!< in: buffer block containing the data */ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - rec_t* data) /*!< in: pointer to the data */ + const rec_t* data) /*!< in: pointer to the data */ { #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG node->block = block; @@ -161,7 +161,7 @@ Looks for an element in a hash table. @return pointer to the data of the first hash table node in chain having the fold number, NULL if not found */ UNIV_INLINE -rec_t* +const rec_t* ha_search_and_get_data( /*===================*/ hash_table_t* table, /*!< in: hash table */ diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index fb44307fa44..b17c1dd7907 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1189,7 +1189,7 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked) { if (my_errno == HA_ERR_OLD_FILE) { - push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, ER_CRASHED_ON_USAGE, zerofill_error_msg); } @@ -2193,8 +2193,8 @@ bool ha_maria::check_and_repair(THD *thd) STATE_MOVED) { /* Remove error about crashed table */ - thd->warning_info->clear_warning_info(thd->query_id); - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + thd->get_stmt_da()->clear_warning_info(thd->query_id); + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_NOTE, ER_CRASHED_ON_USAGE, "Zerofilling moved table %s", table->s->path.str); sql_print_information("Zerofilling moved table: '%s'", @@ -2728,7 +2728,7 @@ int ha_maria::external_lock(THD *thd, int lock_type) This is a bit excessive, ACID requires this only if there are some changes to commit (rollback shouldn't be tested). */ - DBUG_ASSERT(!thd->stmt_da->is_sent || + DBUG_ASSERT(!thd->get_stmt_da()->is_sent() || thd->killed == KILL_CONNECTION); /* autocommit ? rollback a transaction */ #ifdef MARIA_CANNOT_ROLLBACK @@ -3022,7 +3022,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg, ha_create_info->row_type != ROW_TYPE_PAGE && ha_create_info->row_type != ROW_TYPE_NOT_USED && ha_create_info->row_type != ROW_TYPE_DEFAULT) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_ILLEGAL_HA_CREATE_OPTION, "Row format set to PAGE because of TRANSACTIONAL=1 option"); diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c index eb5813f84f1..e69c90c671c 100644 --- a/storage/maria/ma_ft_boolean_search.c +++ b/storage/maria/ma_ft_boolean_search.c @@ -338,7 +338,7 @@ static int _ftb_no_dupes_cmp(void* not_used __attribute__((unused)), /* returns 1 if the search was finished (must-word wasn't found) */ -static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) +static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) { int r; int subkeys=1; @@ -439,7 +439,7 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) ftbw->key_root=info->s->state.key_root[ftb->keynr]; ftbw->keyinfo=info->s->keyinfo+ftb->keynr; ftbw->off=0; - return _ft2_search(ftb, ftbw, 0); + return _ft2_search_no_lock(ftb, ftbw, 0); } /* matching key found */ @@ -469,6 +469,19 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) return 0; } +static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) +{ + int r; + MARIA_SHARE *share= ftb->info->s; + if (share->lock_key_trees) + mysql_rwlock_rdlock(&share->keyinfo[ftb->keynr].root_lock); + r= _ft2_search_no_lock(ftb, ftbw, init_search); + if (share->lock_key_trees) + mysql_rwlock_unlock(&share->keyinfo[ftb->keynr].root_lock); + return r; +} + + static void _ftb_init_index_search(FT_INFO *ftb) { int i; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 3e73bb7c801..9d53372d467 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1849,9 +1849,12 @@ int ha_myisam::info(uint flag) share->db_options_in_use= misam_info.options; stats.block_size= myisam_block_size; /* record block size */ - /* Update share */ - if (share->tmp_table == NO_TMP_TABLE) - mysql_mutex_lock(&share->LOCK_ha_data); + /* + Update share. + lock_shared_ha_data is slighly abused here, since there is no other + way of locking the TABLE_SHARE. + */ + lock_shared_ha_data(); share->keys_in_use.set_prefix(share->keys); share->keys_in_use.intersect_extended(misam_info.key_map); share->keys_for_keyread.intersect(share->keys_in_use); @@ -1860,8 +1863,7 @@ int ha_myisam::info(uint flag) memcpy((char*) table->key_info[0].rec_per_key, (char*) misam_info.rec_per_key, sizeof(table->key_info[0].rec_per_key[0])*share->key_parts); - if (share->tmp_table == NO_TMP_TABLE) - mysql_mutex_unlock(&share->LOCK_ha_data); + unlock_shared_ha_data(); /* Set data_file_name and index_file_name to point at the symlink value diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc index c5df64d9243..b2cbd02bd3f 100644 --- a/storage/perfschema/pfs_digest.cc +++ b/storage/perfschema/pfs_digest.cc @@ -30,6 +30,7 @@ #include "table_helper.h" #include "my_md5.h" #include "sql_lex.h" +#include "sql_get_diagnostics.h" #include "sql_string.h" #include <string.h> diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 25e78ee7b5e..68ec8b149a3 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -1230,7 +1230,7 @@ search: if (! create) { /* No lost counter, just looking for the file existence. */ - return NULL; + DBUG_RETURN(NULL); } while (++attempts <= file_max) @@ -1280,7 +1280,7 @@ search: /* OOM in lf_hash_insert */ file_lost++; - return NULL; + DBUG_RETURN(NULL); } } } diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt index c3a7fe5c72f..08cc21c7483 100644 --- a/storage/perfschema/unittest/CMakeLists.txt +++ b/storage/perfschema/unittest/CMakeLists.txt @@ -25,29 +25,3 @@ ADD_DEFINITIONS(-DMYSQL_SERVER ${SSL_DEFINES}) MY_ADD_TESTS(pfs_instr_class pfs_instr_class-oom pfs_instr pfs_instr-oom pfs_account-oom pfs_host-oom pfs_user-oom pfs EXT "cc" LINK_LIBRARIES perfschema mysys) - -IF(WIN32) - SET(MYSQLD_EXTRA_SOURCES ${CMAKE_SOURCE_DIR}/sql/nt_servc.cc) -ENDIF() - -# We need the server libs to test the blob parser. -# Add sql_builtin.cc here, to force linkage of plugins below. -# Also add mysys/string.c (see Bug#45488) -ADD_EXECUTABLE(pfs_connect_attr-t - pfs_connect_attr-t.cc - ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc - ${CMAKE_SOURCE_DIR}/mysys/string.c - ${MYSQLD_EXTRA_SOURCES} -) -ADD_DEPENDENCIES(pfs_connect_attr-t GenServerSource) -TARGET_LINK_LIBRARIES(pfs_connect_attr-t mytap perfschema) -# We need to explicitly link in everything referenced in sql/sql_builtin.cc -TARGET_LINK_LIBRARIES(pfs_connect_attr-t ${MYSQLD_STATIC_PLUGIN_LIBS}) -TARGET_LINK_LIBRARIES(pfs_connect_attr-t sql binlog rpl master slave sql) -TARGET_LINK_LIBRARIES(pfs_connect_attr-t mysys mysys_ssl) -TARGET_LINK_LIBRARIES(pfs_connect_attr-t vio ${SSL_LIBRARIES}) -TARGET_LINK_LIBRARIES(pfs_connect_attr-t strings dbug regex mysys zlib) -ADD_TEST(pfs_connect_attr pfs_connect_attr-t) - -# On windows, pfs_connect_attr-t may depend on openssl dlls. -COPY_OPENSSL_DLLS(copy_openssl_pfs_unittest) |