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) 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; } 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); 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/mysql-test/suite/innodb_fts/r/truncate.result b/mysql-test/suite/innodb_fts/r/truncate.result new file mode 100644 index 00000000000..0e21717a4d3 --- /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 @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 DEBUG_DBUG = @save_dbug; +DROP PROCEDURE insert_t2; +DROP TABLE t1,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..46ba732b019 --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/truncate.test @@ -0,0 +1,50 @@ +--source include/have_innodb.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 @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 DEBUG_DBUG = @save_dbug; + +DROP PROCEDURE insert_t2; + +DROP TABLE t1,t2; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 548142ef523..9d1fe2786ba 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -3046,7 +3046,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.7.19 +GLOBAL_VALUE 5.7.20 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL 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 <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/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index f7ea768f5c1..598da3ff706 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -176,6 +176,17 @@ buf_read_page_low( dst = ((buf_block_t*) bpage)->frame; } + 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); *err = fil_io( @@ -321,6 +332,19 @@ buf_read_ahead_random( that is, reside near the start of the LRU list. */ for (i = low; i < high; i++) { + 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)); 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; } } 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/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/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/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/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() */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index e797fd7bef7..ce124f2fe11 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 7 -#define INNODB_VERSION_BUGFIX 19 +#define INNODB_VERSION_BUGFIX 20 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; 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)); } } 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/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); 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, 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