From 9ee840cd0a86145e014252fe106d9798b2abc08b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 13 Oct 2017 22:22:03 +0300 Subject: [PATCH 01/14] mariabackup: Properly call os_thread_exit() with detach=true There is no call to os_thread_join(), so we should detach the thread handles in order to avoid any resource leaks. --- extra/mariabackup/xtrabackup.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 4b6d0d2cc55..6bc506f14d0 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2460,7 +2460,7 @@ static os_thread_ret_t log_copying_thread(void*) log_copying_running = false; my_thread_end(); - os_thread_exit(NULL); + os_thread_exit(); return(0); } @@ -2483,7 +2483,7 @@ static os_thread_ret_t io_watching_thread(void*) io_watching_thread_running = false; - os_thread_exit(NULL); + os_thread_exit(); return(0); } @@ -2523,7 +2523,7 @@ data_copy_thread_func( pthread_mutex_unlock(&ctxt->count_mutex); my_thread_end(); - os_thread_exit(NULL); + os_thread_exit(); OS_THREAD_DUMMY_RETURN; } From bcd1a08eb3379431ac2a66be9a09f753a70a5fde Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 13 Oct 2017 19:40:06 +0000 Subject: [PATCH 02/14] Fix mtr to create a process dump on Window for hanging or looping processes --- mysql-test/lib/My/SafeProcess.pm | 7 +- mysql-test/lib/My/SafeProcess/CMakeLists.txt | 1 + .../lib/My/SafeProcess/safe_kill_win.cc | 82 ++++++++++++++++++- 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index f3ee772cca3..3260a6ed593 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -336,9 +336,14 @@ sub start_kill { sub dump_core { my ($self)= @_; - return if IS_WINDOWS; my $pid= $self->{SAFE_PID}; die "Can't get core from not started process" unless defined $pid; + + if (IS_WINDOWS) { + system("$safe_kill $pid dump"); + return 1; + } + _verbose("Sending ABRT to $self"); kill ("ABRT", $pid); return 1; diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt index ec93f94a3e8..ff842f3468f 100644 --- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt +++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt @@ -25,6 +25,7 @@ SET(INSTALL_ARGS IF (WIN32) MYSQL_ADD_EXECUTABLE(my_safe_process safe_process_win.cc ${INSTALL_ARGS}) MYSQL_ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc ${INSTALL_ARGS}) + TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi) ELSE() MYSQL_ADD_EXECUTABLE(my_safe_process safe_process.cc ${INSTALL_ARGS}) ENDIF() diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc index 2ac29c61bc7..e5ec33af571 100644 --- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc @@ -25,6 +25,80 @@ #include #include #include +#include +#include + +static int create_dump(DWORD pid) +{ + char path[MAX_PATH]; + char working_dir[MAX_PATH]; + int ret= -1; + HANDLE process= INVALID_HANDLE_VALUE; + HANDLE file= INVALID_HANDLE_VALUE; + char *p; + + process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)pid); + if (!process) + { + fprintf(stderr,"safe_kill : cannot open process pid=%u to create dump, last error %u\n", + pid, GetLastError()); + goto exit; + } + + DWORD size = MAX_PATH; + if (QueryFullProcessImageName(process, 0, path, &size) == 0) + { + fprintf(stderr,"safe_kill : cannot read process path for pid %u, last error %u\n", + pid, GetLastError()); + goto exit; + } + + if ((p = strrchr(path, '.')) == 0) + p= path + strlen(path); + + strncpy(p, ".dmp", path + MAX_PATH - p); + + /* Create dump in current directory.*/ + const char *filename= strrchr(path, '\\'); + if (filename == 0) + filename = path; + else + filename++; + + if (!GetCurrentDirectory(MAX_PATH, working_dir)) + { + fprintf(stderr, "GetCurrentDirectory failed, last error %u",GetLastError()); + goto exit; + } + + file = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, + 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + + if (file == INVALID_HANDLE_VALUE) + { + fprintf(stderr,"safe_kill : CreateFile() failed for file %s, working dir %s, last error = %u\n", + filename, working_dir, GetLastError()); + goto exit; + } + + if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0,0,0)) + { + fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %u\n", + filename, working_dir, GetLastError()); + goto exit; + } + + ret = 0; + fprintf(stderr, "Minidump written to %s, directory %s\n", filename, working_dir); + +exit: + if(process!= 0 && process != INVALID_HANDLE_VALUE) + CloseHandle(process); + + if (file != 0 && file != INVALID_HANDLE_VALUE) + CloseHandle(file); + return ret; +} int main(int argc, const char** argv ) { @@ -37,12 +111,16 @@ int main(int argc, const char** argv ) signal(SIGBREAK, SIG_IGN); signal(SIGTERM, SIG_IGN); - if (argc != 2) { - fprintf(stderr, "safe_kill \n"); + if ((argc != 2 && argc != 3) || (argc == 3 && strcmp(argv[2],"dump"))) { + fprintf(stderr, "safe_kill [dump]\n"); exit(2); } pid= atoi(argv[1]); + if (argc == 3) + { + return create_dump(pid); + } _snprintf(safe_process_name, sizeof(safe_process_name), "safe_process[%d]", pid); From ad46ce658ac9d4db2cd14d669049f019863ab478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 14 Oct 2017 14:28:11 +0300 Subject: [PATCH 03/14] MDEV-14055 Assertion `page_rec_is_leaf(rec)' failed in lock_rec_validate_page This was a false alarm in a debug check that was introduced in commit 48192f963a3a85a5127da5cc5cf485f07d72bc9d which was a 10.2 code refactoring in preparation for MDEV-11369 (instant ADD COLUMN) in 10.3.2. The code refactoring only affected debug builds. InnoDB B-tree record locks are only supposed to exist on leaf page records. An assertion failed, because the debug function lock_validate() was invoking lock_rec_block_validate() on a page for which there were no locks set in the record lock bitmap. This could happen on a page split. Especially when the index size grows from a single page to multiple pages, the root page would transform from a leaf node into an internal node, and its record lock bitmap would be emptied. lock_validate(): Skip empty lock bitmaps. --- storage/innobase/lock/lock0lock.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 0141d8105ed..4853304e791 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -6614,15 +6614,15 @@ lock_validate() Release both mutexes during the validation check. */ for (ulint i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) { - const lock_t* lock; ib_uint64_t limit = 0; - while ((lock = lock_rec_validate(i, &limit)) != 0) { - - ulint space = lock->un_member.rec_lock.space; - ulint page_no = lock->un_member.rec_lock.page_no; - - pages.insert(std::make_pair(space, page_no)); + while (const lock_t* lock = lock_rec_validate(i, &limit)) { + if (lock_rec_find_set_bit(lock) == ULINT_UNDEFINED) { + /* The lock bitmap is empty; ignore it. */ + continue; + } + const lock_rec_t& l = lock->un_member.rec_lock; + pages.insert(std::make_pair(l.space, l.page_no)); } } From a63102226e28122373c35bb8921a6656260b7e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Oct 2017 10:58:46 +0300 Subject: [PATCH 04/14] MDEV-14082 Enforcing innodb_open_files leads to fil_system->mutex problem fil_mutex_enter_and_prepare_for_io(): Reacquire fil_system->mutex after failing to close a file and before retrying. --- storage/innobase/fil/fil0fil.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index f90238ffafb..73132754fdf 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1218,6 +1218,7 @@ fil_mutex_enter_and_prepare_for_io( fil_flush_file_spaces(FIL_TYPE_TABLESPACE); count++; + mutex_enter(&fil_system->mutex); continue; } } From 3bc094d32a360b7d51600cf11bc4ce24117ecb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 18 Oct 2017 08:58:39 +0300 Subject: [PATCH 05/14] Remove dead code for pushing down LIMIT to InnoDB FULLTEXT INDEX queries MySQL 5.7 added code to push down the LIMIT to fulltext search in InnoDB: commit 2cd0ebf97e1b265e2282d7ceb5d8dfb663ffc48f Author: Thirunarayanan Balathandayuthapani Date: Fri May 27 13:49:28 2016 +0530 Bug #22709692 FTS QUERY EXCEEDS RESULT CACHE LIMIT The code was disabled when MySQL 5.7.9 was merged to MariaDB 10.2.2. We shall remove the disabled code and unnecessary variables. --- storage/innobase/fts/fts0que.cc | 39 +-------------------------- storage/innobase/handler/ha_innodb.cc | 6 ++--- storage/innobase/include/fts0fts.h | 4 +-- storage/innobase/include/row0mysql.h | 3 --- 4 files changed, 4 insertions(+), 48 deletions(-) diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index 594f337c978..858d84f1a5e 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -149,13 +149,6 @@ struct fts_query_t { bool multi_exist; /*!< multiple FTS_EXIST oper */ st_mysql_ftparser* parser; /*!< fts plugin parser */ - - /** limit value for the fts query */ - ulonglong limit; - - /** number of docs fetched by query. This is to restrict the - result with limit value */ - ulonglong n_docs; }; /** For phrase matching, first we collect the documents and the positions @@ -3228,11 +3221,6 @@ fts_query_filter_doc_ids( ulint decoded = 0; ib_rbt_t* doc_freqs = word_freq->doc_freqs; - if (query->limit != ULONG_UNDEFINED - && query->n_docs >= query->limit) { - return(DB_SUCCESS); - } - /* Decode the ilist and add the doc ids to the query doc_id set. */ while (decoded < len) { ulint freq = 0; @@ -3320,17 +3308,11 @@ fts_query_filter_doc_ids( /* Add the word to the document's matched RB tree. */ fts_query_add_word_to_document(query, doc_id, word); } - - if (query->limit != ULONG_UNDEFINED - && query->limit <= ++query->n_docs) { - goto func_exit; - } } /* Some sanity checks. */ ut_a(doc_id == node->last_doc_id); -func_exit: if (query->total_size > fts_result_cache_limit) { return(DB_FTS_EXCEED_RESULT_CACHE_LIMIT); } else { @@ -3941,7 +3923,6 @@ fts_query_can_optimize( @param[in] query_str FTS query @param[in] query_len FTS query string len in bytes @param[in,out] result result doc ids -@param[in] limit limit value @return DB_SUCCESS if successful otherwise error code */ dberr_t fts_query( @@ -3950,8 +3931,7 @@ fts_query( uint flags, const byte* query_str, ulint query_len, - fts_result_t** result, - ulonglong limit) + fts_result_t** result) { fts_query_t query; dberr_t error = DB_SUCCESS; @@ -4013,10 +3993,6 @@ fts_query( query.total_docs = dict_table_get_n_rows(index->table); - query.limit = limit; - - query.n_docs = 0; - query.fts_common_table.suffix = "DELETED"; /* Read the deleted doc_ids, we need these for filtering. */ @@ -4078,19 +4054,6 @@ fts_query( fts_result_cache_limit = 2048; ); - /* Optimisation is allowed for limit value - when - i) No ranking involved - ii) Only FTS Union operations involved. */ - if (query.limit != ULONG_UNDEFINED - && !fts_ast_node_check_union(ast)) { - query.limit = ULONG_UNDEFINED; - } - - DBUG_EXECUTE_IF("fts_union_limit_off", - query.limit = ULONG_UNDEFINED; - ); - /* Traverse the Abstract Syntax Tree (AST) and execute the query. */ query.error = fts_ast_visit( diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e7bf2b649f9..1463deb6e14 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -10537,10 +10537,8 @@ ha_innobase::ft_init_ext( const byte* q = reinterpret_cast( const_cast(query)); - // JAN: TODO: support for ft_init_ext_with_hints(), remove the line below - m_prebuilt->m_fts_limit= ULONG_UNDEFINED; - dberr_t error = fts_query(trx, index, flags, q, query_len, &result, - m_prebuilt->m_fts_limit); + // FIXME: support ft_init_ext_with_hints(), pass LIMIT + dberr_t error = fts_query(trx, index, flags, q, query_len, &result); if (error != DB_SUCCESS) { my_error(convert_error_code_to_mysql(error, 0, NULL), MYF(0)); diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index f1d53165cdd..30b8b66b83b 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -579,7 +579,6 @@ fts_commit( @param[in] query_str FTS query @param[in] query_len FTS query string len in bytes @param[in,out] result result doc ids -@param[in] limit limit value @return DB_SUCCESS if successful otherwise error code */ dberr_t fts_query( @@ -588,8 +587,7 @@ fts_query( uint flags, const byte* query_str, ulint query_len, - fts_result_t** result, - ulonglong limit) + fts_result_t** result) MY_ATTRIBUTE((warn_unused_result)); /******************************************************************//** diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 8d3752974a6..a7a55d202e8 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -844,9 +844,6 @@ struct row_prebuilt_t { /** The MySQL table object */ TABLE* m_mysql_table; - - /** limit value to avoid fts result overflow */ - ulonglong m_fts_limit; }; /** Callback for row_mysql_sys_index_iterate() */ From 7c9651a3710a1ab84ef2af84b6457d4ccbf8a522 Mon Sep 17 00:00:00 2001 From: Darshan M N Date: Thu, 1 Jun 2017 10:14:05 +0530 Subject: [PATCH 06/14] BUG#25479538 ASSERT:SIZE == SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM Issue ===== The original issue was that the size of a fil_per_table tablespace was calculated incorrectly during truncate in the presence of an fts index. This incorrect calculation was fixed as part of BUG#25053705 along with a testcase to reproduce the bug. The assert that was added as part of it to reproduce the bug was wrong and resulted in this bug. Fix === Although the assert was removed earlier in a seperate commit as it was blocking the ntest, this patch replaces the other parts of the code that were added to reproduce the bug and replaces it with code that tries to reproduce the bug in a different way. The new code basically tries to tweak conditions so as to simulate the random read where a page that doesn't exist is tried to be read. RB: 15890 Reviewed-by: Jimmy Yang Reviewed-by: Satya Bodapati --- mysql-test/suite/innodb_fts/r/truncate.result | 31 ++++++++++++ mysql-test/suite/innodb_fts/t/truncate.opt | 1 + mysql-test/suite/innodb_fts/t/truncate.test | 50 +++++++++++++++++++ storage/innobase/buf/buf0rea.cc | 25 ++++++++++ 4 files changed, 107 insertions(+) create mode 100644 mysql-test/suite/innodb_fts/r/truncate.result create mode 100644 mysql-test/suite/innodb_fts/t/truncate.opt create mode 100644 mysql-test/suite/innodb_fts/t/truncate.test diff --git a/mysql-test/suite/innodb_fts/r/truncate.result b/mysql-test/suite/innodb_fts/r/truncate.result new file mode 100644 index 00000000000..cd88a6f93a9 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/truncate.result @@ -0,0 +1,31 @@ +# +# Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE +# +CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b), +FULLTEXT fts2(c)); +TRUNCATE TABLE t1; +INSERT INTO t1 (a,d,b,c) VALUES ( +'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), +repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc +cuullucocraloracurooulrooauuar','1')); +CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b)); +INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), +repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1')); +create procedure insert_t2(IN total int) +begin +declare i int default 1; +while (i <= total) DO +insert into t2 select * from t2; +set i = i + 1; +end while; +end| +CALL insert_t2(15); +SET SESSION debug="+d,innodb_invalid_read_after_truncate"; +INSERT INTO t1 (a,d,b,c) VALUES ( +'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), +repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc +cuullucocraloracurooulrooauuar','1')); +SET SESSION debug="-d,innodb_invalid_read_after_truncate"; +DROP PROCEDURE insert_t2; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/innodb_fts/t/truncate.opt b/mysql-test/suite/innodb_fts/t/truncate.opt new file mode 100644 index 00000000000..d143088d352 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/truncate.opt @@ -0,0 +1 @@ +--innodb-random-read-ahead=1 diff --git a/mysql-test/suite/innodb_fts/t/truncate.test b/mysql-test/suite/innodb_fts/t/truncate.test new file mode 100644 index 00000000000..dbb24c91d89 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/truncate.test @@ -0,0 +1,50 @@ +--source include/have_innodb_64k.inc +--source include/have_debug.inc + +--echo # +--echo # Bug#25053705 - INVALID I/O ON TABLE AFTER TRUNCATE +--echo # + +CREATE TABLE t1 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b), +FULLTEXT fts2(c)); + +TRUNCATE TABLE t1; + +INSERT INTO t1 (a,d,b,c) VALUES ( +'79795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), +repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc +cuullucocraloracurooulrooauuar','1')); + +# The following CREATE TABLE and INSERTs are used to remove the pages related to table t1 +# from the buffer pool. +CREATE TABLE t2 (a INT, d INT, b VARCHAR(198), c CHAR(158), FULLTEXT fts1(c,b)); + +INSERT INTO t2 VALUES (1, 1, repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), +repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorccuullucocraloracurooulrooauuar','1')); + +delimiter |; +create procedure insert_t2(IN total int) +begin + declare i int default 1; + while (i <= total) DO + insert into t2 select * from t2; + set i = i + 1; + end while; +end| +delimiter ;| + +CALL insert_t2(15); + +SET SESSION debug="+d,innodb_invalid_read_after_truncate"; + +INSERT INTO t1 (a,d,b,c) VALUES ( +'7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), +repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc +cuullucocraloracurooulrooauuar','1')); + +SET SESSION debug="-d,innodb_invalid_read_after_truncate"; + +DROP PROCEDURE insert_t2; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index f7ea768f5c1..bc924f78844 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -176,6 +176,18 @@ buf_read_page_low( dst = ((buf_block_t*) bpage)->frame; } + /* This debug code is only for 5.7. In trunk, with newDD, + the space->name is no longer same as table name. */ + DBUG_EXECUTE_IF("innodb_invalid_read_after_truncate", + fil_space_t* space = fil_space_get(page_id.space()); + + if (space != NULL && strcmp(space->name, "test/t1") == 0 + && page_id.page_no() == space->size - 1) { + type = IORequest::READ; + sync = true; + } + ); + IORequest request(type | IORequest::READ); *err = fil_io( @@ -321,6 +333,19 @@ buf_read_ahead_random( that is, reside near the start of the LRU list. */ for (i = low; i < high; i++) { + /* This debug code is only for 5.7. In trunk, with newDD, + the space->name is no longer same as table name. */ + DBUG_EXECUTE_IF("innodb_invalid_read_after_truncate", + fil_space_t* space = fil_space_get(page_id.space()); + + if (space != NULL + && strcmp(space->name, "test/t1") == 0) { + high = space->size; + buf_pool_mutex_exit(buf_pool); + goto read_ahead; + } + ); + const buf_page_t* bpage = buf_page_hash_get( buf_pool, page_id_t(page_id.space(), i)); From 59d3ba0b5d68b24b7b3339700d05c6c3a6fab13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 18 Oct 2017 07:01:46 +0300 Subject: [PATCH 07/14] Adjust the instrumentation and test --- mysql-test/suite/innodb/t/alter_table.test | 16 +++---- mysql-test/suite/innodb_fts/r/truncate.result | 8 ++-- mysql-test/suite/innodb_fts/t/truncate.test | 10 ++--- storage/innobase/buf/buf0rea.cc | 45 +++++++++---------- 4 files changed, 38 insertions(+), 41 deletions(-) diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test index 13fb574972a..88007227946 100644 --- a/mysql-test/suite/innodb/t/alter_table.test +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -1,10 +1,8 @@ --source include/have_innodb.inc -# -# MDEV-11995 ALTER TABLE proceeds despite reporting ER_TOO_LONG_KEY error -# -set @@sql_mode=strict_trans_tables; -create table t1(a text not null) row_format=dynamic engine=innodb; -create index idx1 on t1(a(3073)); -show create table t1; -drop table t1; -set @@sql_mode=default; +CREATE TABLE t1 ( + id1 INT AUTO_INCREMENT PRIMARY KEY, id2 VARCHAR(30) NOT NULL UNIQUE, + id3 DATETIME +) ENGINE=InnoDB; +ALTER TABLE t1 CHANGE COLUMN id2 id4 VARCHAR(40) NOT NULL; +SELECT * FROM t1 WHERE id4 LIKE 'a'; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/truncate.result b/mysql-test/suite/innodb_fts/r/truncate.result index cd88a6f93a9..0e21717a4d3 100644 --- a/mysql-test/suite/innodb_fts/r/truncate.result +++ b/mysql-test/suite/innodb_fts/r/truncate.result @@ -20,12 +20,12 @@ set i = i + 1; end while; end| CALL insert_t2(15); -SET SESSION debug="+d,innodb_invalid_read_after_truncate"; +SET @save_dbug = @@SESSION.DEBUG_DBUG; +SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate'; INSERT INTO t1 (a,d,b,c) VALUES ( '7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc cuullucocraloracurooulrooauuar','1')); -SET SESSION debug="-d,innodb_invalid_read_after_truncate"; +SET DEBUG_DBUG = @save_dbug; DROP PROCEDURE insert_t2; -DROP TABLE t1; -DROP TABLE t2; +DROP TABLE t1,t2; diff --git a/mysql-test/suite/innodb_fts/t/truncate.test b/mysql-test/suite/innodb_fts/t/truncate.test index dbb24c91d89..46ba732b019 100644 --- a/mysql-test/suite/innodb_fts/t/truncate.test +++ b/mysql-test/suite/innodb_fts/t/truncate.test @@ -1,4 +1,4 @@ ---source include/have_innodb_64k.inc +--source include/have_innodb.inc --source include/have_debug.inc --echo # @@ -35,16 +35,16 @@ delimiter ;| CALL insert_t2(15); -SET SESSION debug="+d,innodb_invalid_read_after_truncate"; +SET @save_dbug = @@SESSION.DEBUG_DBUG; +SET DEBUG_DBUG = '+d,innodb_invalid_read_after_truncate'; INSERT INTO t1 (a,d,b,c) VALUES ( '7795','6',repeat('uololoaroolccaaruolraloouuoocorrcorurlu','1'), repeat('orouculcaocuocloooolooloooaorlroclouulrrucclulalouaulrluorooaclllluuorc cuullucocraloracurooulrooauuar','1')); -SET SESSION debug="-d,innodb_invalid_read_after_truncate"; +SET DEBUG_DBUG = @save_dbug; DROP PROCEDURE insert_t2; -DROP TABLE t1; -DROP TABLE t2; +DROP TABLE t1,t2; diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index bc924f78844..598da3ff706 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -176,17 +176,16 @@ buf_read_page_low( dst = ((buf_block_t*) bpage)->frame; } - /* This debug code is only for 5.7. In trunk, with newDD, - the space->name is no longer same as table name. */ - DBUG_EXECUTE_IF("innodb_invalid_read_after_truncate", - fil_space_t* space = fil_space_get(page_id.space()); - - if (space != NULL && strcmp(space->name, "test/t1") == 0 - && page_id.page_no() == space->size - 1) { - type = IORequest::READ; - sync = true; - } - ); + DBUG_EXECUTE_IF( + "innodb_invalid_read_after_truncate", + if (fil_space_t* space = fil_space_acquire(page_id.space())) { + if (!strcmp(space->name, "test/t1") + && page_id.page_no() == space->size - 1) { + type = 0; + sync = true; + } + fil_space_release(space); + }); IORequest request(type | IORequest::READ); @@ -333,18 +332,18 @@ buf_read_ahead_random( that is, reside near the start of the LRU list. */ for (i = low; i < high; i++) { - /* This debug code is only for 5.7. In trunk, with newDD, - the space->name is no longer same as table name. */ - DBUG_EXECUTE_IF("innodb_invalid_read_after_truncate", - fil_space_t* space = fil_space_get(page_id.space()); - - if (space != NULL - && strcmp(space->name, "test/t1") == 0) { - high = space->size; - buf_pool_mutex_exit(buf_pool); - goto read_ahead; - } - ); + DBUG_EXECUTE_IF( + "innodb_invalid_read_after_truncate", + if (fil_space_t* space = fil_space_acquire( + page_id.space())) { + bool skip = !strcmp(space->name, "test/t1"); + fil_space_release(space); + if (skip) { + high = space->size; + buf_pool_mutex_exit(buf_pool); + goto read_ahead; + } + }); const buf_page_t* bpage = buf_page_hash_get( buf_pool, page_id_t(page_id.space(), i)); From 98cc7a8eeff32eddb37a81635138c76551600e34 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 18 Oct 2017 17:04:15 +0300 Subject: [PATCH 08/14] Fixed compiler warnings --- sql/opt_range.cc | 7 ++++--- sql/sql_test.cc | 8 +++++--- storage/connect/filamtxt.cpp | 2 +- storage/innobase/rem/rem0rec.cc | 7 ++++--- storage/maria/ma_checkpoint.c | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 415b76a28bb..9416fc30a0c 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -4643,6 +4643,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, double roru_index_costs; ha_rows roru_total_records; double roru_intersect_part= 1.0; + ulong n_child_scans; DBUG_ENTER("get_best_disjunct_quick"); DBUG_PRINT("info", ("Full table scan cost: %g", read_time)); @@ -4659,7 +4660,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, } } - size_t n_child_scans= imerge->trees_next - imerge->trees; + n_child_scans= imerge->trees_next - imerge->trees; if (!n_child_scans) DBUG_RETURN(NULL); @@ -4877,8 +4878,8 @@ skip_to_ror_scan: (TIME_FOR_COMPARE_ROWID * M_LN2) + get_sweep_read_cost(param, roru_total_records); - DBUG_PRINT("info", ("ROR-union: cost %g, %d members", roru_total_cost, - n_child_scans)); + DBUG_PRINT("info", ("ROR-union: cost %g, %lu members", + roru_total_cost, n_child_scans)); TRP_ROR_UNION* roru; if (roru_total_cost < read_time) { diff --git a/sql/sql_test.cc b/sql/sql_test.cc index d16edf5b5d5..b7b70f0f55c 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -85,8 +85,9 @@ static my_bool print_cached_tables_callback(TDC_element *element, while ((entry= it++)) { THD *in_use= entry->in_use; - printf("%-14.14s %-32s%6ld%8ld%6d %s\n", - entry->s->db.str, entry->s->table_name.str, element->version, + printf("%-14.14s %-32s%6lu%8ld%6d %s\n", + entry->s->db.str, entry->s->table_name.str, + (ulong) element->version, in_use ? (long) in_use->thread_id : (long) 0, entry->db_stat ? 1 : 0, in_use ? lock_descriptions[(int)entry->reginfo.lock_type] : @@ -106,7 +107,8 @@ static void print_cached_tables(void) tdc_iterate(0, (my_hash_walk_action) print_cached_tables_callback, NULL, true); - printf("\nCurrent refresh version: %ld\n", tdc_refresh_version()); + printf("\nCurrent refresh version: %ld\n", + (long) tdc_refresh_version()); fflush(stdout); /* purecov: end */ return; diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 12727b66335..0f5069bae33 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -1459,7 +1459,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g) // Read the entire next block n = fread(To_Buf, 1, (size_t)BlkLen, Stream); - if (n == BlkLen) { + if ((size_t) n == (size_t) BlkLen) { // ReadBlks++; num_read++; Rbuf = (CurBlk == Block - 1) ? Last : Nrec; diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index c26614d5eae..f755eac84f3 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -570,9 +570,10 @@ rec_get_offsets_func( case REC_STATUS_SUPREMUM: /* infimum or supremum record */ ut_ad(rec_get_heap_no_new(rec) - == (rec_get_status(rec) == REC_STATUS_INFIMUM - ? PAGE_HEAP_NO_INFIMUM - : PAGE_HEAP_NO_SUPREMUM)); + == ulint(rec_get_status(rec) + == REC_STATUS_INFIMUM + ? PAGE_HEAP_NO_INFIMUM + : PAGE_HEAP_NO_SUPREMUM)); n = 1; break; default: diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index 84c142ca151..93983c567a8 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -332,8 +332,8 @@ int ma_checkpoint_init(ulong interval) res= 1; else if (interval > 0) { - compile_time_assert(sizeof(void *) >= sizeof(ulong)); size_t intv= interval; + compile_time_assert(sizeof(void *) >= sizeof(ulong)); if ((res= mysql_thread_create(key_thread_checkpoint, &checkpoint_control.thread, NULL, ma_checkpoint_background, From a75884e70135dc3699a16fd2745750e990e5851c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 8 Oct 2017 21:01:03 +0200 Subject: [PATCH 09/14] MDEV-13836 mariadb_config & mysql_config output differ Use mariadb_config, for C/C config variables --- scripts/mysql_config.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index 52f6d563fe5..cc6db192de2 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -114,6 +114,17 @@ if [ "$basedir" != "/usr" ]; then fi cflags="$include @CFLAGS_FOR_CLIENTS@" +mariadb_config="$basedir/bin/mariadb_config" +if test -x "$basedir/bin/mariadb_config"; then + cflags=`"$mariadb_config" --cflags` + include=`"$mariadb_config" --include` + libs=`"$mariadb_config" --libs` + plugindir=`"$mariadb_config" --plugindir` + socket=`"$mariadb_config" --socket` + port=`"$mariadb_config" --port` + version=`"$mariadb_config" --version` +fi + usage () { cat < Date: Wed, 11 Oct 2017 21:53:43 +0200 Subject: [PATCH 10/14] MDEV-13836 mariadb_config & mysql_config output differ allow to build with the default port number 3306. Now -DMYSQL_TCP_PORT=# sets the default port name and -DMYSQL_TCP_PORT_DEFAULT=# sets the magic port=0 behavior, if it's MYSQL_TCP_PORT_DEFAULT=0 it's enabled, otherwise - disabled. --- cmake/mysql_version.cmake | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 87d61fcf344..02579c9534e 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -69,13 +69,9 @@ ENDMACRO() # Get mysql version and other interesting variables GET_MYSQL_VERSION() -SET(MYSQL_TCP_PORT_DEFAULT "3306") - +SET(MYSQL_TCP_PORT_DEFAULT 0) IF(NOT MYSQL_TCP_PORT) - SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT}) - SET(MYSQL_TCP_PORT_DEFAULT "0") -ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT) - SET(MYSQL_TCP_PORT_DEFAULT "0") + SET(MYSQL_TCP_PORT 3306) ENDIF() IF(NOT COMPILATION_COMMENT) From 4c2c057d4044364a27fb8c217f804f6fb25fcc02 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 16 Oct 2017 17:49:52 +0200 Subject: [PATCH 11/14] MDEV-13968 sst fails with "WSREP_SST_OPT_PORT: readonly variable" --- scripts/wsrep_sst_common.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 0333a2db882..3ffaf8b10ef 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -45,7 +45,7 @@ case "$1" in # "traditional" notation readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*} fi - readonly WSREP_SST_OPT_PORT=$(echo $WSREP_SST_OPT_ADDR | \ + readonly WSREP_SST_OPT_ADDR_PORT=$(echo $WSREP_SST_OPT_ADDR | \ cut -d ']' -f 2 | cut -s -d ':' -f 2 | cut -d '/' -f 1) readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/} shift @@ -124,6 +124,17 @@ readonly WSREP_SST_OPT_BYPASS readonly WSREP_SST_OPT_BINLOG readonly WSREP_SST_OPT_CONF_SUFFIX +if [ -n "$WSREP_SST_OPT_ADDR_PORT" ]; then + if [ -n "$WSREP_SST_OPT_PORT" ]; then + if [ "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then + wsrep_log_error "port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR" + exit 2 + fi + else + readonly WSREP_SST_OPT_PORT="$WSREP_SST_OPT_ADDR_PORT" + fi +fi + # try to use my_print_defaults, mysql and mysqldump that come with the sources # (for MTR suite) SCRIPTS_DIR="$(cd $(dirname "$0"); pwd -P)" From e6df6031f6779677d40b482489c26db4ddcd0986 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 16 Oct 2017 19:33:06 +0200 Subject: [PATCH 12/14] MDEV-13969 sst mysqldump and xtrabackup-v2 handle WSREP_SST_OPT_CONF incorrectly $WSREP_SST_OPT_CONF already includes --defaults-extra-file= prefix. --- scripts/wsrep_sst_mysqldump.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index f7f911ec1e8..8cfdd4e6553 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -117,7 +117,7 @@ GTID_BINLOG_STATE=$(echo "SHOW GLOBAL VARIABLES LIKE 'gtid_binlog_state'" |\ $MYSQL_CLIENT $AUTH -S$WSREP_SST_OPT_SOCKET --disable-reconnect --connect_timeout=10 |\ tail -1 | awk -F ' ' '{ print $2 }') -MYSQL="$MYSQL_CLIENT --defaults-extra-file=$WSREP_SST_OPT_CONF "\ +MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\ "$AUTH -h${WSREP_SST_OPT_HOST_UNESCAPED:-$WSREP_SST_OPT_HOST} "\ "-P$WSREP_SST_OPT_PORT --disable-reconnect --connect_timeout=10" From 607d8f9e97ae9dfbf1434a34fcea017efbb86b09 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 18 Oct 2017 14:37:10 +0200 Subject: [PATCH 13/14] MDEV-14081 ALTER TABLE CHANGE COLUMN Corrupts Index Leading to Crashes in 10.2 remove remnants of 10.0 bugfix, incorrectly merged into 10.2 Using col_names[i] was obviously, wrong, must've been col_names[ifield->col_no]. incorrect column name resulted in innodb having index unique_id2(id1), while the server thought it's unique_id2(id4). But col_names[ifield->col_no] is wrong too, because `table` has non-renamed columns, so the correct column name is always dict_table_get_col_name(table, ifield->col_no) --- mysql-test/suite/innodb/r/alter_table.result | 11 ++++++++++ mysql-test/suite/innodb/r/innodb-alter.result | 2 -- mysql-test/suite/innodb/t/alter_table.test | 14 +++++++++++++ mysql-test/suite/innodb/t/innodb-alter.test | 8 -------- storage/innobase/handler/handler0alter.cc | 2 +- storage/innobase/include/row0merge.h | 5 +---- storage/innobase/row/row0merge.cc | 20 ++----------------- 7 files changed, 29 insertions(+), 33 deletions(-) diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result index 304bc865f75..8a0717aa677 100644 --- a/mysql-test/suite/innodb/r/alter_table.result +++ b/mysql-test/suite/innodb/r/alter_table.result @@ -11,3 +11,14 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC drop table t1; set @@sql_mode=default; +create table t1 ( +id1 int(11) not null auto_increment, +id2 varchar(30) not null, +id3 datetime not null default current_timestamp, +primary key (id1), +unique key unique_id2 (id2) +) engine=innodb; +alter table t1 change column id2 id4 varchar(100) not null; +select * from t1 where id4 like 'a'; +id1 id4 id3 +drop table t1; diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result index b06c6060375..831356fd872 100644 --- a/mysql-test/suite/innodb/r/innodb-alter.result +++ b/mysql-test/suite/innodb/r/innodb-alter.result @@ -640,10 +640,8 @@ CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL; ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX, CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL; ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id); -call mtr.add_suppression("InnoDB: No matching column for `FTS_DOC_ID` in index `ct` of table `test`\\.`t1o`"); ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ADD FULLTEXT INDEX(ct); -ERROR HY000: Index for table 't1o' is corrupt; try to repair it DROP TABLE sys_indexes; CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID; diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test index 13fb574972a..474035436e5 100644 --- a/mysql-test/suite/innodb/t/alter_table.test +++ b/mysql-test/suite/innodb/t/alter_table.test @@ -8,3 +8,17 @@ create index idx1 on t1(a(3073)); show create table t1; drop table t1; set @@sql_mode=default; + +# +# MDEV-14081 ALTER TABLE CHANGE COLUMN Corrupts Index Leading to Crashes in 10.2 +# +create table t1 ( + id1 int(11) not null auto_increment, + id2 varchar(30) not null, + id3 datetime not null default current_timestamp, + primary key (id1), + unique key unique_id2 (id2) +) engine=innodb; +alter table t1 change column id2 id4 varchar(100) not null; +select * from t1 where id4 like 'a'; +drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test index d936dcad15c..1810c61eabe 100644 --- a/mysql-test/suite/innodb/t/innodb-alter.test +++ b/mysql-test/suite/innodb/t/innodb-alter.test @@ -370,16 +370,8 @@ CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL; ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id); -# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE -call mtr.add_suppression("InnoDB: No matching column for `FTS_DOC_ID` in index `ct` of table `test`\\.`t1o`"); ---error ER_NOT_KEYFILE ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, ADD FULLTEXT INDEX(ct); -# FIXME: MDEV-9469 (enable this) -#--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -#ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, -#ALGORITHM=INPLACE; -#end of MDEV-9469 FIXME DROP TABLE sys_indexes; CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index d7fc070d1d7..f270a61e54e 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -4850,7 +4850,7 @@ new_clustered_failed: ctx->add_index[a] = row_merge_create_index( ctx->trx, ctx->new_table, - &index_defs[a], add_v, ctx->col_names); + &index_defs[a], add_v); add_key_nums[a] = index_defs[a].key_number; diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 8ab4e2a2ee3..51ad5cc5cd7 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -265,16 +265,13 @@ row_merge_rename_index_to_drop( @param[in] index_def the index definition @param[in] add_v new virtual columns added along with add index call -@param[in] col_names column names if columns are renamed - or NULL @return index, or NULL on error */ dict_index_t* row_merge_create_index( trx_t* trx, dict_table_t* table, const index_def_t* index_def, - const dict_add_v_col_t* add_v, - const char** col_names) + const dict_add_v_col_t* add_v) MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index b463eedf8f1..beb816d681f 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -4362,16 +4362,13 @@ row_merge_create_index_graph( @param[in] index_def the index definition @param[in] add_v new virtual columns added along with add index call -@param[in] col_names column names if columns are renamed - or NULL @return index, or NULL on error */ dict_index_t* row_merge_create_index( trx_t* trx, dict_table_t* table, const index_def_t* index_def, - const dict_add_v_col_t* add_v, - const char** col_names) + const dict_add_v_col_t* add_v) { dict_index_t* index; dberr_t err; @@ -4411,20 +4408,7 @@ row_merge_create_index( table, ifield->col_no); } } else { - /* - Alter table renaming a column and then adding a index - to this new name e.g ALTER TABLE t - CHANGE COLUMN b c INT NOT NULL, ADD UNIQUE INDEX (c); - requires additional check as column names are not yet - changed when new index definitions are created. Table's - new column names are on a array of column name pointers - if any of the column names are changed. */ - - if (col_names && col_names[i]) { - name = col_names[i]; - } else { - name = dict_table_get_col_name(table, ifield->col_no); - } + name = dict_table_get_col_name(table, ifield->col_no); } dict_mem_index_add_field(index, name, ifield->prefix_len); From 7c42b091b7a995f086399efc1083314479bfb798 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Fri, 20 Oct 2017 13:36:55 +0300 Subject: [PATCH 14/14] Make rocksdb.index_merge_rocksdb2 test stable --- storage/rocksdb/mysql-test/rocksdb/include/index_merge_ror.inc | 1 + .../rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/rocksdb/mysql-test/rocksdb/include/index_merge_ror.inc b/storage/rocksdb/mysql-test/rocksdb/include/index_merge_ror.inc index 2e8a07de349..ed270802db1 100644 --- a/storage/rocksdb/mysql-test/rocksdb/include/index_merge_ror.inc +++ b/storage/rocksdb/mysql-test/rocksdb/include/index_merge_ror.inc @@ -125,6 +125,7 @@ analyze table t1; -- enable_query_log # One row results tests for cases where a single row matches all conditions +--replace_column 9 # explain select key1,key2 from t1 where key1=100 and key2=100; select key1,key2 from t1 where key1=100 and key2=100; if (!$skip_ror_EXPLAIN_for_MyRocks) diff --git a/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result b/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result index ff33e6061b3..4370715925a 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result @@ -603,7 +603,7 @@ count(*) 64801 explain select key1,key2 from t1 where key1=100 and key2=100; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key2,key1 5,5 NULL 2 Using intersect(key2,key1); Using where; Using index +1 SIMPLE t1 index_merge key1,key2 key2,key1 5,5 NULL # Using intersect(key2,key1); Using where; Using index select key1,key2 from t1 where key1=100 and key2=100; key1 key2 100 100