diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-06 08:06:35 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-06 08:06:35 +0300 |
commit | 7c584d8270cf192496f36e993e7759616f3b650b (patch) | |
tree | 26e4111ca76af60136ac25c47496909f7e6e3545 | |
parent | 2d2c3da8ec846d8018c112d8901e2ae029f1c795 (diff) | |
parent | 75b9014fedd8bb85d15501a2281fbade6b56fe78 (diff) | |
download | mariadb-git-7c584d8270cf192496f36e993e7759616f3b650b.tar.gz |
Merge 10.2 into 10.3
-rw-r--r-- | extra/innochecksum.cc | 44 | ||||
-rw-r--r-- | include/my_time.h | 5 | ||||
-rw-r--r-- | mysql-test/main/ps.result | 22 | ||||
-rw-r--r-- | mysql-test/main/ps.test | 13 | ||||
-rw-r--r-- | mysql-test/suite/encryption/r/innochecksum.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/encryption/t/innochecksum.test | 4 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/full_backup.result | 1 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/full_backup.test | 9 | ||||
-rw-r--r-- | sql/ha_partition.h | 6 | ||||
-rw-r--r-- | sql/handler.cc | 189 | ||||
-rw-r--r-- | sql/handler.h | 86 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 | ||||
-rw-r--r-- | storage/federatedx/ha_federatedx.cc | 2 | ||||
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 1 |
14 files changed, 84 insertions, 306 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 6c3ae347473..3169b647ea2 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2021, MariaDB Corporation. + Copyright (c) 2014, 2022, 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 @@ -884,7 +884,7 @@ parse_page( is_leaf = (!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL))); - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tIndex page\t\t\t|" "\tindex id=%llu,", cur_page_num, id); @@ -937,7 +937,7 @@ parse_page( index.total_data_bytes += data_bytes; index.pages_in_size_range[size_range_id] ++; } - } else { + } else if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tEncrypted Index page\t\t\t|" "\tkey_version " UINT32PF ",%s\n", cur_page_num, key_version, str); } @@ -948,7 +948,7 @@ parse_page( page_type.n_fil_page_undo_log++; undo_page_type = mach_read_from_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE); - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tUndo log page\t\t\t|", cur_page_num); } @@ -958,7 +958,7 @@ parse_page( switch (undo_page_type) { case TRX_UNDO_ACTIVE: page_type.n_undo_state_active++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Undo log of " "an active transaction"); } @@ -966,7 +966,7 @@ parse_page( case TRX_UNDO_CACHED: page_type.n_undo_state_cached++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Page is " "cached for quick reuse"); } @@ -974,7 +974,7 @@ parse_page( case TRX_UNDO_TO_PURGE: page_type.n_undo_state_to_purge++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Will be " "freed in purge when all undo" "data in it is removed"); @@ -983,7 +983,7 @@ parse_page( case TRX_UNDO_PREPARED: page_type.n_undo_state_prepared++; - if (page_type_dump) { + if (file) { fprintf(file, ", %s", "Undo log of " "an prepared transaction"); } @@ -993,14 +993,14 @@ parse_page( page_type.n_undo_state_other++; break; } - if(page_type_dump) { + if(file) { fprintf(file, ", %s\n", str); } break; case FIL_PAGE_INODE: page_type.n_fil_page_inode++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInode page\t\t\t|" "\t%s\n",cur_page_num, str); } @@ -1008,7 +1008,7 @@ parse_page( case FIL_PAGE_IBUF_FREE_LIST: page_type.n_fil_page_ibuf_free_list++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert buffer free list" " page\t|\t%s\n", cur_page_num, str); } @@ -1016,7 +1016,7 @@ parse_page( case FIL_PAGE_TYPE_ALLOCATED: page_type.n_fil_page_type_allocated++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tFreshly allocated " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1024,7 +1024,7 @@ parse_page( case FIL_PAGE_IBUF_BITMAP: page_type.n_fil_page_ibuf_bitmap++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert Buffer " "Bitmap\t\t|\t%s\n", cur_page_num, str); } @@ -1032,7 +1032,7 @@ parse_page( case FIL_PAGE_TYPE_SYS: page_type.n_fil_page_type_sys++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tSystem page\t\t\t|" "\t%s\n", cur_page_num, str); } @@ -1040,7 +1040,7 @@ parse_page( case FIL_PAGE_TYPE_TRX_SYS: page_type.n_fil_page_type_trx_sys++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tTransaction system " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1048,7 +1048,7 @@ parse_page( case FIL_PAGE_TYPE_FSP_HDR: page_type.n_fil_page_type_fsp_hdr++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tFile Space " "Header\t\t|\t%s\n", cur_page_num, str); } @@ -1056,7 +1056,7 @@ parse_page( case FIL_PAGE_TYPE_XDES: page_type.n_fil_page_type_xdes++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tExtent descriptor " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1064,7 +1064,7 @@ parse_page( case FIL_PAGE_TYPE_BLOB: page_type.n_fil_page_type_blob++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tBLOB page\t\t\t|\t%s\n", cur_page_num, str); } @@ -1072,7 +1072,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB: page_type.n_fil_page_type_zblob++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tCompressed BLOB " "page\t\t|\t%s\n", cur_page_num, str); } @@ -1080,7 +1080,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB2: page_type.n_fil_page_type_zblob2++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tSubsequent Compressed " "BLOB page\t|\t%s\n", cur_page_num, str); } @@ -1088,7 +1088,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED: page_type.n_fil_page_type_page_compressed++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed " "page\t|\t%s\n", cur_page_num, str); } @@ -1096,7 +1096,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED: page_type.n_fil_page_type_page_compressed_encrypted++; - if (page_type_dump) { + if (file) { fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed encrypted " "page\t|\t%s\n", cur_page_num, str); } diff --git a/include/my_time.h b/include/my_time.h index 7c8f3ce909b..304efe8e16f 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -217,9 +217,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals) { ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals); } +#ifdef _WIN32 +#define suseconds_t long +#endif static inline void my_timeval_trunc(struct timeval *tv, uint decimals) { - tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); + tv->tv_usec-= (suseconds_t) my_time_fraction_remainder(tv->tv_usec, decimals); } diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index 0e64973ae07..f8e18561976 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -5564,6 +5564,28 @@ a DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1; +# +# MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or +# different plan upon 2nd execution of PS with EXPLAIN +# +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +# Without the patch the second execution of the 'stmt' prepared statement +# would result in server crash. +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 0 Const row not found +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL +DEALLOCATE PREPARE stmt; +DROP TABLE t1; # End of 10.2 tests # # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index 911737bb6ec..8c59f1e0840 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -5013,6 +5013,19 @@ DEALLOCATE PREPARE stmt; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-19631: Assertion `0' failed in st_select_lex_unit::optimize or +--echo # different plan upon 2nd execution of PS with EXPLAIN +--echo # +CREATE TABLE t1 (a INT); +PREPARE stmt FROM 'EXPLAIN SELECT * FROM t1 HAVING 6 IN ( SELECT 6 UNION SELECT 5 )'; +EXECUTE stmt; +--echo # Without the patch the second execution of the 'stmt' prepared statement +--echo # would result in server crash. +EXECUTE stmt; +# Cleanup +DEALLOCATE PREPARE stmt; +DROP TABLE t1; --echo # End of 10.2 tests --echo # diff --git a/mysql-test/suite/encryption/r/innochecksum.result b/mysql-test/suite/encryption/r/innochecksum.result index 2a37ae1aa00..8d1d0fd91e5 100644 --- a/mysql-test/suite/encryption/r/innochecksum.result +++ b/mysql-test/suite/encryption/r/innochecksum.result @@ -7,7 +7,7 @@ CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FOR CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1; CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; -# Run innochecksum on t1 +# Run innochecksum on t1, check -S does not cause crash for encrypted file # Run innochecksum on t2 # Run innochecksum on t3 # Run innochecksum on t4 diff --git a/mysql-test/suite/encryption/t/innochecksum.test b/mysql-test/suite/encryption/t/innochecksum.test index 06d3ff46b81..16122b77045 100644 --- a/mysql-test/suite/encryption/t/innochecksum.test +++ b/mysql-test/suite/encryption/t/innochecksum.test @@ -55,9 +55,9 @@ let MYSQLD_DATADIR=`select @@datadir`; --source include/shutdown_mysqld.inc ---echo # Run innochecksum on t1 -- disable_result_log ---exec $INNOCHECKSUM $t1_IBD +--echo # Run innochecksum on t1, check -S does not cause crash for encrypted file +--exec $INNOCHECKSUM -S $t1_IBD --echo # Run innochecksum on t2 diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index c387f5328a7..954151bbad7 100644 --- a/mysql-test/suite/mariabackup/full_backup.result +++ b/mysql-test/suite/mariabackup/full_backup.result @@ -1,6 +1,7 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); # xtrabackup backup +NOT FOUND /InnoDB: Allocated tablespace ID/ in backup.log INSERT INTO t VALUES(2); # xtrabackup prepare # shutdown server diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index d1d2ea21c08..66bed34cf3d 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -4,11 +4,18 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backup_log 2>&1; --enable_result_log +# The following warning must not appear after MDEV-27343 fix +--let SEARCH_PATTERN=InnoDB: Allocated tablespace ID +--let SEARCH_FILE=$backup_log +--source include/search_pattern_in_file.inc +--remove_file $backup_log + INSERT INTO t VALUES(2); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 36e18d15c0a..f5c12318b2d 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, 2021, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -1093,10 +1093,6 @@ public: NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION LEVEL which is dynamic, see bug#39084. - HA_READ_RND_SAME: - Not currently used. (Means that the handler supports the rnd_same() call) - (MyISAM, HEAP) - HA_TABLE_SCAN_ON_INDEX: Used to avoid scanning full tables on an index. If this flag is set then the handler always has a primary key (hidden if not defined) and this diff --git a/sql/handler.cc b/sql/handler.cc index 2763cd5c442..cad9019c969 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2019, MariaDB Corporation. + Copyright (c) 2009, 2022, 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 @@ -2703,11 +2703,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows) len*rows/(stats.block_size+1)/TIME_FOR_COMPARE ; } -void **handler::ha_data(THD *thd) const -{ - return thd_ha_data(thd, ht); -} - THD *handler::ha_thd(void) const { DBUG_ASSERT(!table || !table->in_use || table->in_use == current_thd); @@ -6714,17 +6709,6 @@ void handler::unlock_shared_ha_data() mysql_mutex_unlock(&table_share->LOCK_ha_data); } -/** @brief - Dummy function which accept information about log files which is not need - by handlers -*/ -void signal_log_not_needed(struct handlerton, char *log_file) -{ - DBUG_ENTER("signal_log_not_needed"); - DBUG_PRINT("enter", ("logfile '%s'", log_file)); - DBUG_VOID_RETURN; -} - void handler::set_lock_type(enum thr_lock_type lock) { table->reginfo.lock_type= lock; @@ -6827,177 +6811,6 @@ void ha_fake_trx_id(THD *thd) #endif /* WITH_WSREP */ -#ifdef TRANS_LOG_MGM_EXAMPLE_CODE -/* - Example of transaction log management functions based on assumption that logs - placed into a directory -*/ -#include <my_dir.h> -#include <my_sys.h> -int example_of_iterator_using_for_logs_cleanup(handlerton *hton) -{ - void *buffer; - int res= 1; - struct handler_iterator iterator; - struct handler_log_file_data data; - - if (!hton->create_iterator) - return 1; /* iterator creator is not supported */ - - if ((*hton->create_iterator)(hton, HA_TRANSACTLOG_ITERATOR, &iterator) != - HA_ITERATOR_OK) - { - /* error during creation of log iterator or iterator is not supported */ - return 1; - } - while((*iterator.next)(&iterator, (void*)&data) == 0) - { - printf("%s\n", data.filename.str); - if (data.status == HA_LOG_STATUS_FREE && - mysql_file_delete(INSTRUMENT_ME, - data.filename.str, MYF(MY_WME))) - goto err; - } - res= 0; -err: - (*iterator.destroy)(&iterator); - return res; -} - - -/* - Here we should get info from handler where it save logs but here is - just example, so we use constant. - IMHO FN_ROOTDIR ("/") is safe enough for example, because nobody has - rights on it except root and it consist of directories only at lest for - *nix (sorry, can't find windows-safe solution here, but it is only example). -*/ -#define fl_dir FN_ROOTDIR - - -/** @brief - Dummy function to return log status should be replaced by function which - really detect the log status and check that the file is a log of this - handler. -*/ -enum log_status fl_get_log_status(char *log) -{ - MY_STAT stat_buff; - if (mysql_file_stat(INSTRUMENT_ME, log, &stat_buff, MYF(0))) - return HA_LOG_STATUS_INUSE; - return HA_LOG_STATUS_NOSUCHLOG; -} - - -struct fl_buff -{ - LEX_STRING *names; - enum log_status *statuses; - uint32 entries; - uint32 current; -}; - - -int fl_log_iterator_next(struct handler_iterator *iterator, - void *iterator_object) -{ - struct fl_buff *buff= (struct fl_buff *)iterator->buffer; - struct handler_log_file_data *data= - (struct handler_log_file_data *) iterator_object; - if (buff->current >= buff->entries) - return 1; - data->filename= buff->names[buff->current]; - data->status= buff->statuses[buff->current]; - buff->current++; - return 0; -} - - -void fl_log_iterator_destroy(struct handler_iterator *iterator) -{ - my_free(iterator->buffer); -} - - -/** @brief - returns buffer, to be assigned in handler_iterator struct -*/ -enum handler_create_iterator_result -fl_log_iterator_buffer_init(struct handler_iterator *iterator) -{ - MY_DIR *dirp; - struct fl_buff *buff; - char *name_ptr; - uchar *ptr; - FILEINFO *file; - uint32 i; - - /* to be able to make my_free without crash in case of error */ - iterator->buffer= 0; - - if (!(dirp = my_dir(fl_dir, MYF(MY_THREAD_SPECIFIC)))) - { - return HA_ITERATOR_ERROR; - } - if ((ptr= (uchar*)my_malloc(ALIGN_SIZE(sizeof(fl_buff)) + - ((ALIGN_SIZE(sizeof(LEX_STRING)) + - sizeof(enum log_status) + - + FN_REFLEN + 1) * - (uint) dirp->number_off_files), - MYF(MY_THREAD_SPECIFIC))) == 0) - { - return HA_ITERATOR_ERROR; - } - buff= (struct fl_buff *)ptr; - buff->entries= buff->current= 0; - ptr= ptr + (ALIGN_SIZE(sizeof(fl_buff))); - buff->names= (LEX_STRING*) (ptr); - ptr= ptr + ((ALIGN_SIZE(sizeof(LEX_STRING)) * - (uint) dirp->number_off_files)); - buff->statuses= (enum log_status *)(ptr); - name_ptr= (char *)(ptr + (sizeof(enum log_status) * - (uint) dirp->number_off_files)); - for (i=0 ; i < (uint) dirp->number_off_files ; i++) - { - enum log_status st; - file= dirp->dir_entry + i; - if ((file->name[0] == '.' && - ((file->name[1] == '.' && file->name[2] == '\0') || - file->name[1] == '\0'))) - continue; - if ((st= fl_get_log_status(file->name)) == HA_LOG_STATUS_NOSUCHLOG) - continue; - name_ptr= strxnmov(buff->names[buff->entries].str= name_ptr, - FN_REFLEN, fl_dir, file->name, NullS); - buff->names[buff->entries].length= (name_ptr - - buff->names[buff->entries].str); - buff->statuses[buff->entries]= st; - buff->entries++; - } - - iterator->buffer= buff; - iterator->next= &fl_log_iterator_next; - iterator->destroy= &fl_log_iterator_destroy; - my_dirend(dirp); - return HA_ITERATOR_OK; -} - - -/* An example of a iterator creator */ -enum handler_create_iterator_result -fl_create_iterator(enum handler_iterator_type type, - struct handler_iterator *iterator) -{ - switch(type) { - case HA_TRANSACTLOG_ITERATOR: - return fl_log_iterator_buffer_init(iterator); - default: - return HA_ITERATOR_UNSUPPORTED; - } -} -#endif /*TRANS_LOG_MGM_EXAMPLE_CODE*/ - - bool HA_CREATE_INFO::check_conflicting_charset_declarations(CHARSET_INFO *cs) { if ((used_fields & HA_CREATE_USED_DEFAULT_CHARSET) && diff --git a/sql/handler.h b/sql/handler.h index de4fd513070..a39de4b7180 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1021,31 +1021,6 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len, enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX }; extern MYSQL_PLUGIN_IMPORT st_plugin_int *hton2plugin[MAX_HA]; -/* Transaction log maintains type definitions */ -enum log_status -{ - HA_LOG_STATUS_FREE= 0, /* log is free and can be deleted */ - HA_LOG_STATUS_INUSE= 1, /* log can't be deleted because it is in use */ - HA_LOG_STATUS_NOSUCHLOG= 2 /* no such log (can't be returned by - the log iterator status) */ -}; -/* - Function for signaling that the log file changed its state from - LOG_STATUS_INUSE to LOG_STATUS_FREE - - Now it do nothing, will be implemented as part of new transaction - log management for engines. - TODO: implement the function. -*/ -void signal_log_not_needed(struct handlerton, char *log_file); -/* - Data of transaction log iterator. -*/ -struct handler_log_file_data { - LEX_STRING filename; - enum log_status status; -}; - /* Definitions for engine-specific table/field/index options in the CREATE TABLE. @@ -1160,46 +1135,6 @@ typedef struct st_ha_create_table_option { struct st_mysql_sys_var *var; } ha_create_table_option; -enum handler_iterator_type -{ - /* request of transaction log iterator */ - HA_TRANSACTLOG_ITERATOR= 1 -}; -enum handler_create_iterator_result -{ - HA_ITERATOR_OK, /* iterator created */ - HA_ITERATOR_UNSUPPORTED, /* such type of iterator is not supported */ - HA_ITERATOR_ERROR /* error during iterator creation */ -}; - -/* - Iterator structure. Can be used by handler/handlerton for different purposes. - - Iterator should be created in the way to point "before" the first object - it iterate, so next() call move it to the first object or return !=0 if - there is nothing to iterate through. -*/ -struct handler_iterator { - /* - Moves iterator to next record and return 0 or return !=0 - if there is no records. - iterator_object will be filled by this function if next() returns 0. - Content of the iterator_object depend on iterator type. - */ - int (*next)(struct handler_iterator *, void *iterator_object); - /* - Free resources allocated by iterator, after this call iterator - is not usable. - */ - void (*destroy)(struct handler_iterator *); - /* - Pointer to buffer for the iterator to use. - Should be allocated by function which created the iterator and - destroyed by freed by above "destroy" call - */ - void *buffer; -}; - class handler; class group_by_handler; struct Query; @@ -1461,22 +1396,6 @@ struct handlerton const char *query, uint query_length, const char *db, const char *table_name); - /* - Get log status. - If log_status is null then the handler do not support transaction - log information (i.e. log iterator can't be created). - (see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE) - - */ - enum log_status (*get_log_status)(handlerton *hton, char *log); - - /* - Iterators creator. - Presence of the pointer should be checked before using - */ - enum handler_create_iterator_result - (*create_iterator)(handlerton *hton, enum handler_iterator_type type, - struct handler_iterator *fill_this_in); void (*abort_transaction)(handlerton *hton, THD *bf_thd, THD *victim_thd, my_bool signal); int (*set_checkpoint)(handlerton *hton, const XID* xid); @@ -3654,15 +3573,13 @@ public: inline int ha_read_first_row(uchar *buf, uint primary_key); /** - The following 3 function is only needed for tables that may be + The following 2 function is only needed for tables that may be internal temporary tables during joins. */ virtual int remember_rnd_pos() { return HA_ERR_WRONG_COMMAND; } virtual int restart_rnd_next(uchar *buf) { return HA_ERR_WRONG_COMMAND; } - virtual int rnd_same(uchar *buf, uint inx) - { return HA_ERR_WRONG_COMMAND; } virtual ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key) @@ -4377,7 +4294,6 @@ public: TABLE_SHARE* get_table_share() { return table_share; } protected: /* Service methods for use by storage engines. */ - void **ha_data(THD *) const; THD *ha_thd(void) const; /** diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 35715fe2812..8d922ca953f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -26450,8 +26450,11 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) if (unit->is_unit_op() || unit->fake_select_lex) { + ulonglong save_options= 0; + if (unit->union_needs_tmp_table() && unit->fake_select_lex) { + save_options= unit->fake_select_lex->options; unit->fake_select_lex->select_number= FAKE_SELECT_LEX_ID; // just for initialization unit->fake_select_lex->type= unit_operation_text[unit->common_op()]; unit->fake_select_lex->options|= SELECT_DESCRIBE; @@ -26459,6 +26462,9 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) if (!(res= unit->prepare(unit->derived, result, SELECT_NO_UNLOCK | SELECT_DESCRIBE))) res= unit->exec(); + + if (unit->union_needs_tmp_table() && unit->fake_select_lex) + unit->fake_select_lex->options= save_options; } else { diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 9bf66d00f78..ddd6d932724 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1736,7 +1736,7 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key, federatedx_txn *ha_federatedx::get_txn(THD *thd, bool no_create) { - federatedx_txn **txnp= (federatedx_txn **) ha_data(thd); + federatedx_txn **txnp= (federatedx_txn **) thd_ha_data(thd, ht); if (!*txnp && !no_create) *txnp= new federatedx_txn(); return *txnp; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 45a4a280b10..585ac9b767d 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1363,6 +1363,7 @@ fil_space_create( if ((purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_IMPORT) && !recv_recovery_is_on() + && srv_operation != SRV_OPERATION_BACKUP && id > fil_system.max_assigned_id) { if (!fil_system.space_id_reuse_warned) { fil_system.space_id_reuse_warned = true; |