diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 09a645bdf0d..d63661b3f1a 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -105,6 +105,8 @@ SET(ignored "%ignore /etc/systemd/system" "%ignore /lib" "%ignore /lib/security" + "%ignore /lib64" + "%ignore /lib64/security" "%ignore ${CMAKE_INSTALL_PREFIX}" "%ignore ${CMAKE_INSTALL_PREFIX}/bin" "%ignore ${CMAKE_INSTALL_PREFIX}/include" diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index ab19a7f0f11..49dceccb9d2 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -163,7 +163,7 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock" SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") -SET(INSTALL_PAMDIR_RPM "/lib/security") +SET(INSTALL_PAMDIR_RPM "/${INSTALL_LIBDIR_RPM}/security") # # DEB layout diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff index 89d2cd36112..880627631bd 100644 --- a/mysql-test/main/mysqld--help,win.rdiff +++ b/mysql-test/main/mysqld--help,win.rdiff @@ -1,6 +1,6 @@ --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result -@@ -381,7 +381,6 @@ The following options may be given as the first argument: +@@ -395,7 +395,6 @@ The number of segments in a key cache -L, --language=name Client error messages in given language. May be given as a full path. Deprecated. Use --lc-messages-dir instead. @@ -8,7 +8,7 @@ --lc-messages=name Set the language used for the error messages. -L, --lc-messages-dir=name Directory where error messages are -@@ -603,6 +602,7 @@ The following options may be given as the first argument: +@@ -617,6 +616,7 @@ Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -16,7 +16,7 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -1048,6 +1048,9 @@ The following options may be given as the first argument: +@@ -1073,6 +1073,9 @@ characteristics (isolation level, read only/read write,snapshot - but not any work done / data modified within the transaction). @@ -26,7 +26,7 @@ --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. -@@ -1171,6 +1174,10 @@ The following options may be given as the first argument: +@@ -1196,6 +1199,10 @@ Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -37,15 +37,15 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1190,6 +1197,7 @@ The following options may be given as the first argument: - EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT +@@ -1219,6 +1226,7 @@ + deleting or updating every row in a table. --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) + --standalone Dummy option to start as a standalone program (NT). --standard-compliant-cte Allow only CTEs compliant to SQL standard (Defaults to on; use --skip-standard-compliant-cte to disable.) -@@ -1257,6 +1265,11 @@ The following options may be given as the first argument: +@@ -1286,6 +1294,11 @@ --thread-pool-max-threads=# Maximum allowed number of worker threads in the thread pool @@ -57,7 +57,7 @@ --thread-pool-oversubscribe=# How many additional active worker threads in a group are allowed. -@@ -1295,8 +1308,8 @@ The following options may be given as the first argument: +@@ -1324,8 +1337,8 @@ automatically convert it to an on-disk MyISAM or Aria table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -68,7 +68,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1430,7 +1443,6 @@ key-cache-block-size 1024 +@@ -1462,7 +1475,6 @@ key-cache-division-limit 100 key-cache-file-hash-size 512 key-cache-segments 0 @@ -76,7 +76,7 @@ lc-messages en_US lc-messages-dir MYSQL_SHAREDIR/ lc-time-names en_US -@@ -1502,6 +1514,7 @@ myisam-sort-buffer-size 134216704 +@@ -1534,6 +1546,7 @@ myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -84,7 +84,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1612,6 +1625,8 @@ session-track-schema TRUE +@@ -1645,6 +1658,8 @@ session-track-state-change FALSE session-track-system-variables autocommit,character_set_client,character_set_connection,character_set_results,time_zone session-track-transaction-info OFF @@ -93,15 +93,15 @@ show-slave-auth-info FALSE silent-startup FALSE skip-grant-tables TRUE -@@ -1638,6 +1653,7 @@ slave-transaction-retry-interval 0 +@@ -1671,6 +1686,7 @@ slave-type-conversions slow-launch-time 2 slow-query-log FALSE +slow-start-timeout 15000 sort-buffer-size 2097152 sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION - stack-trace TRUE -@@ -1652,9 +1668,9 @@ sync-relay-log 10000 + sql-safe-updates FALSE +@@ -1686,10 +1702,10 @@ sync-relay-log-info 10000 sysdate-is-now FALSE system-versioning-alter-history ERROR @@ -109,11 +109,13 @@ +table-cache 2000 table-definition-cache 400 -table-open-cache 421 +-table-open-cache-instances 1 +table-open-cache 2000 - table-open-cache-instances 8 ++table-open-cache-instances 8 tc-heuristic-recover OFF tcp-keepalive-interval 0 -@@ -1663,6 +1679,8 @@ tcp-keepalive-time 0 + tcp-keepalive-probes 0 +@@ -1697,6 +1713,8 @@ thread-cache-size 151 thread-pool-idle-timeout 60 thread-pool-max-threads 65536 diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 6e4a109b1b6..40e9a8f4b56 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1689,7 +1689,7 @@ system-versioning-alter-history ERROR table-cache 421 table-definition-cache 400 table-open-cache 421 -table-open-cache-instances 8 +table-open-cache-instances 1 tc-heuristic-recover OFF tcp-keepalive-interval 0 tcp-keepalive-probes 0 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 60de682806b..3777997ba0a 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4732,8 +4732,8 @@ sub extract_warning_lines ($$) { qr/InnoDB: See also */, qr/InnoDB: Cannot open .*ib_buffer_pool.* for reading: No such file or directory*/, qr/InnoDB: Table .*mysql.*innodb_table_stats.* not found./, - qr/InnoDB: User stopword table .* does not exist./ - + qr/InnoDB: User stopword table .* does not exist./, + qr/Detected table cache mutex contention at instance .* waits. Additional table cache instance cannot be activated: consider raising table_open_cache_instances. Number of active instances/ ); my $matched_lines= []; diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result index c2b46661e31..8a6327216d0 100644 --- a/mysql-test/suite/innodb/r/innodb-blob.result +++ b/mysql-test/suite/innodb/r/innodb-blob.result @@ -153,3 +153,9 @@ a SELECT * FROM t2; a DROP TABLE t1,t2,t3; +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT)ENGINE=InnoDB +ROW_FORMAT=REDUNDANT; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1 ; +INSERT INTO t1 VALUES(1, REPEAT(2, @fill_amount)); +UPDATE t1 SET f1 = 2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-blob.test b/mysql-test/suite/innodb/t/innodb-blob.test index fbf0641880b..301966fb41d 100644 --- a/mysql-test/suite/innodb/t/innodb-blob.test +++ b/mysql-test/suite/innodb/t/innodb-blob.test @@ -206,3 +206,10 @@ SELECT a FROM t3; SELECT * FROM t2; DROP TABLE t1,t2,t3; + +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 TEXT)ENGINE=InnoDB + ROW_FORMAT=REDUNDANT; +SET @fill_amount = (@@innodb_page_size / 2 ) + 1 ; +INSERT INTO t1 VALUES(1, REPEAT(2, @fill_amount)); +UPDATE t1 SET f1 = 2; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result new file mode 100644 index 00000000000..85fba6427f7 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result @@ -0,0 +1,6 @@ +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded"); +CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; +set debug_dbug="+d,fts_instrument_sync_request"; +INSERT INTO mdev21563 VALUES('This is a test'); +ALTER TABLE mdev21563 DISCARD TABLESPACE; +DROP TABLE mdev21563; diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test new file mode 100644 index 00000000000..5b0184e5cca --- /dev/null +++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test @@ -0,0 +1,11 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc +call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded"); + +CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; +set debug_dbug="+d,fts_instrument_sync_request"; +INSERT INTO mdev21563 VALUES('This is a test'); +ALTER TABLE mdev21563 DISCARD TABLESPACE; +--source include/restart_mysqld.inc +DROP TABLE mdev21563; diff --git a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result index a0a849c1d7a..a9a683e017b 100644 --- a/mysql-test/suite/sys_vars/r/host_cache_size_auto.result +++ b/mysql-test/suite/sys_vars/r/host_cache_size_auto.result @@ -1,3 +1,3 @@ select @@global.host_cache_size; @@global.host_cache_size -632 +653 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8fe6e6b6d32..60b87b60be4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4495,7 +4495,7 @@ static int init_common_variables() min_connections= 10; /* MyISAM requires two file handles per table. */ wanted_files= (extra_files + max_connections + extra_max_connections + - tc_size * 2); + tc_size * 2 * tc_instances); #if defined(HAVE_POOL_OF_THREADS) && !defined(__WIN__) // add epoll or kevent fd for each threadpool group, in case pool of threads is used wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size; @@ -4524,6 +4524,14 @@ static int init_common_variables() if (files < wanted_files && global_system_variables.log_warnings) sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); + /* If we required too much tc_instances than we reduce */ + SYSVAR_AUTOSIZE_IF_CHANGED(tc_instances, + (uint32) MY_MIN(MY_MAX((files - extra_files - + max_connections)/ + 2/tc_size, + 1), + tc_instances), + uint32); /* If we have requested too much file handles than we bring max_connections in supported bounds. Still leave at least @@ -4531,7 +4539,7 @@ static int init_common_variables() */ SYSVAR_AUTOSIZE_IF_CHANGED(max_connections, (ulong) MY_MAX(MY_MIN(files- extra_files- - min_tc_size*2, + min_tc_size*2*tc_instances, max_connections), min_connections), ulong); @@ -4544,7 +4552,7 @@ static int init_common_variables() */ SYSVAR_AUTOSIZE_IF_CHANGED(tc_size, (ulong) MY_MIN(MY_MAX((files - extra_files - - max_connections) / 2, + max_connections) / 2 / tc_instances, min_tc_size), tc_size), ulong); DBUG_PRINT("warning", diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index db38a20ea8a..59b4e148005 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1858,7 +1858,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, while (!thd->killed && (parser_state.m_lip.found_semicolon != NULL) && ! thd->is_error()) { - thd->get_stmt_da()->set_skip_flush(); /* Multiple queries exist, execute them individually */ diff --git a/sql/table.cc b/sql/table.cc index cbf26031658..5fc05bf34b1 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4251,7 +4251,6 @@ bool check_column_name(const char *name) been opened. @param[in] table The table to check - @param[in] table_f_count Expected number of columns in the table @param[in] table_def Expected structure of the table (column name and type) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 6fc01a9491f..6f64709c9bb 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2253,8 +2253,8 @@ buf_page_realloc( ut_d(block->page.in_page_hash = FALSE); ulint fold = block->page.id.fold(); ut_ad(fold == new_block->page.id.fold()); - HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, (&block->page)); - HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, (&new_block->page)); + HASH_REPLACE(buf_page_t, hash, buf_pool->page_hash, fold, + &block->page, &new_block->page); ut_ad(new_block->page.in_page_hash); @@ -3372,8 +3372,8 @@ buf_relocate( /* relocate buf_pool->page_hash */ ulint fold = bpage->id.fold(); ut_ad(fold == dpage->id.fold()); - HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage); - HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, dpage); + HASH_REPLACE(buf_page_t, hash, buf_pool->page_hash, fold, bpage, + dpage); } /** Hazard Pointer implementation. */ diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index cfe3f9a6bcb..17583eb3399 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 the Free Software @@ -59,6 +59,7 @@ static const ulint BUF_LRU_OLD_TOLERANCE = 20; @see buf_LRU_old_adjust_len */ #define BUF_LRU_NON_OLD_MIN_LEN 5 +#ifdef BTR_CUR_HASH_ADAPT /** When dropping the search hash index entries before deleting an ibd file, we build a local array of pages belonging to that tablespace in the buffer pool. Following is the size of that array. @@ -67,6 +68,7 @@ flush_list when dropping a table. This is to ensure that other threads are not blocked for extended period of time when using very large buffer pools. */ static const ulint BUF_LRU_DROP_SEARCH_SIZE = 1024; +#endif /* BTR_CUR_HASH_ADAPT */ /** We scan these many blocks when looking for a clean page to evict during LRU eviction. */ @@ -376,7 +378,6 @@ drop_ahi: return true; } -#endif /* BTR_CUR_HASH_ADAPT */ /******************************************************************//** While flushing (or removing dirty) pages from a tablespace we don't @@ -465,6 +466,7 @@ buf_flush_try_yield( return(false); } +#endif /* BTR_CUR_HASH_ADAPT */ /******************************************************************//** Removes a single page from a given tablespace inside a specific @@ -640,6 +642,7 @@ rescan: goto rescan; } +#ifdef BTR_CUR_HASH_ADAPT ++processed; /* Yield if we have hogged the CPU and mutexes for too long. */ @@ -649,6 +652,7 @@ rescan: processed = 0; } +#endif /* BTR_CUR_HASH_ADAPT */ /* The check for trx is interrupted is expensive, we want to check every N iterations. */ diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 61703f947e2..4ee027290fd 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 2020, 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 the Free Software @@ -9050,6 +9050,8 @@ i_s_innodb_mutexes_fill_table( ~Locking() { mutex_exit(&rw_lock_list_mutex); } } locking; + char lock_name[sizeof "buf0dump.cc:12345"]; + for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL; lock = UT_LIST_GET_NEXT(list, lock)) { if (lock->count_os_wait == 0) { @@ -9062,11 +9064,16 @@ i_s_innodb_mutexes_fill_table( continue; } - //OK(field_store_string(fields[MUTEXES_NAME], - // lock->lock_name)); - OK(field_store_string( - fields[MUTEXES_CREATE_FILE], - innobase_basename(lock->cfile_name))); + const char* basename = innobase_basename( + lock->cfile_name); + + snprintf(lock_name, sizeof lock_name, "%s:%u", + basename, lock->cline); + + OK(field_store_string(fields[MUTEXES_NAME], + lock_name)); + OK(field_store_string(fields[MUTEXES_CREATE_FILE], + basename)); OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline, true)); fields[MUTEXES_CREATE_LINE]->set_notnull(); @@ -9082,8 +9089,8 @@ i_s_innodb_mutexes_fill_table( snprintf(buf1, sizeof buf1, "combined %s", innobase_basename(block_lock->cfile_name)); - //OK(field_store_string(fields[MUTEXES_NAME], - // block_lock->lock_name)); + OK(field_store_string(fields[MUTEXES_NAME], + "buf_block_t::lock")); OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1)); OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline, diff --git a/storage/innobase/include/hash0hash.h b/storage/innobase/include/hash0hash.h index 5d317a23d4e..4f55b051d80 100644 --- a/storage/innobase/include/hash0hash.h +++ b/storage/innobase/include/hash0hash.h @@ -184,6 +184,18 @@ do {\ HASH_INVALIDATE(DATA, NAME);\ } while (0) +#define HASH_REPLACE(TYPE, NAME, TABLE, FOLD, DATA_OLD, DATA_NEW) \ + do { \ + (DATA_NEW)->NAME = (DATA_OLD)->NAME; \ + \ + hash_cell_t& cell3333 \ + = TABLE->array[hash_calc_hash(FOLD, TABLE)]; \ + TYPE** struct3333 = (TYPE**)&cell3333.node; \ + while (*struct3333 != DATA_OLD) { \ + struct3333 = &((*struct3333)->NAME); \ + } \ + *struct3333 = DATA_NEW; \ + } while (0) /*******************************************************************//** Gets the first struct in a hash chain, NULL if none. */ diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index fa22b3d3086..18ae845955a 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -291,13 +291,6 @@ mem_heap_printf( const char* format, /*!< in: format string */ ...) MY_ATTRIBUTE ((format (printf, 2, 3))); -/** Checks that an object is a memory heap (or a block of it) -@param[in] heap Memory heap to check */ -UNIV_INLINE -void -mem_block_validate( - const mem_heap_t* heap); - #ifdef UNIV_DEBUG /** Validates the contents of a memory heap. Asserts that the memory heap is consistent @@ -312,7 +305,6 @@ mem_heap_validate( /** The info structure stored at the beginning of a heap block */ struct mem_block_info_t { - ulint magic_n;/* magic number for debugging */ #ifdef UNIV_DEBUG char file_name[8];/* file name where the mem heap was created */ unsigned line; /*!< line number where the mem heap was created */ @@ -347,9 +339,6 @@ struct mem_block_info_t { otherwise, this is NULL */ }; -#define MEM_BLOCK_MAGIC_N 764741555 -#define MEM_FREED_BLOCK_MAGIC_N 547711122 - /* Header size for a memory heap block */ #define MEM_BLOCK_HEADER_SIZE UT_CALC_ALIGN(sizeof(mem_block_info_t),\ UNIV_MEM_ALIGNMENT) diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 3b4992a1a98..2a88c0f1065 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2020, 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 the Free Software @@ -144,16 +144,6 @@ mem_block_get_start(mem_block_t* block) return(block->start); } -/** Checks that an object is a memory heap block -@param[in] block Memory block to check. */ -UNIV_INLINE -void -mem_block_validate( - const mem_block_t* block) -{ - ut_a(block->magic_n == MEM_BLOCK_MAGIC_N); -} - /** Allocates and zero-fills n bytes of memory from a memory heap. @param[in] heap memory heap @param[in] n number of bytes; if the heap is allowed to grow into @@ -186,8 +176,6 @@ mem_heap_alloc( byte* buf; ulint free; - ut_d(mem_block_validate(heap)); - block = UT_LIST_GET_LAST(heap->base); n += REDZONE_SIZE; @@ -230,8 +218,6 @@ mem_heap_get_heap_top( mem_block_t* block; byte* buf; - ut_d(mem_block_validate(heap)); - block = UT_LIST_GET_LAST(heap->base); buf = (byte*) block + mem_block_get_free(block); @@ -322,8 +308,6 @@ mem_heap_get_top( mem_block_t* block; byte* buf; - ut_d(mem_block_validate(heap)); - block = UT_LIST_GET_LAST(heap->base); buf = (byte*) block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n); @@ -343,8 +327,6 @@ mem_heap_free_top( { mem_block_t* block; - ut_d(mem_block_validate(heap)); - n += REDZONE_SIZE; block = UT_LIST_GET_LAST(heap->base); @@ -420,8 +402,6 @@ mem_heap_free( mem_block_t* block; mem_block_t* prev_block; - ut_d(mem_block_validate(heap)); - block = UT_LIST_GET_LAST(heap->base); if (heap->free_block) { @@ -448,11 +428,7 @@ mem_heap_get_size( /*==============*/ mem_heap_t* heap) /*!< in: heap */ { - ulint size = 0; - - ut_d(mem_block_validate(heap)); - - size = heap->total_size; + ulint size = heap->total_size; if (heap->free_block) { size += srv_page_size; diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic index 44a471e4156..1564bdfdcc0 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.ic @@ -1410,7 +1410,11 @@ rec_get_converted_size( data_size = dtuple_get_data_size(dtuple, 0); - ut_ad(n_ext == dtuple_get_n_ext(dtuple)); + /* If primary key is being updated then the new record inherits + externally stored fields from the delete-marked old record. + In that case, n_ext may be less value than + dtuple_get_n_ext(tuple). */ + ut_ad(n_ext <= dtuple_get_n_ext(dtuple)); extra_size = rec_get_converted_extra_size( data_size, dtuple_get_n_fields(dtuple), n_ext); diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc index a298a7c0b2f..15dee37cc1f 100644 --- a/storage/innobase/mem/mem0mem.cc +++ b/storage/innobase/mem/mem0mem.cc @@ -210,8 +210,6 @@ mem_heap_validate( block != NULL; block = UT_LIST_GET_NEXT(list, block)) { - mem_block_validate(block); - switch (block->type) { case MEM_HEAP_DYNAMIC: break; @@ -266,7 +264,6 @@ mem_heap_create_block_func( || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH)); if (heap != NULL) { - mem_block_validate(heap); ut_d(mem_heap_validate(heap)); } @@ -308,7 +305,6 @@ mem_heap_create_block_func( block->buf_block = buf_block; block->free_block = NULL; - block->magic_n = MEM_BLOCK_MAGIC_N; ut_d(ut_strlcpy_rev(block->file_name, file_name, sizeof(block->file_name))); ut_d(block->line = line); @@ -356,8 +352,6 @@ mem_heap_add_block( mem_block_t* new_block; ulint new_size; - ut_d(mem_block_validate(heap)); - block = UT_LIST_GET_LAST(heap->base); /* We have to allocate a new block. The size is always at least @@ -410,8 +404,6 @@ mem_heap_block_free( buf_block = static_cast(block->buf_block); - mem_block_validate(block); - UT_LIST_REMOVE(heap->base, block); ut_ad(heap->total_size >= block->len); @@ -419,7 +411,6 @@ mem_heap_block_free( type = heap->type; len = block->len; - block->magic_n = MEM_FREED_BLOCK_MAGIC_N; if (type == MEM_HEAP_DYNAMIC || len < srv_page_size / 2) { ut_ad(!buf_block); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index c9cab91cb1f..6bdc8ce4904 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, 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 the Free Software @@ -3142,6 +3142,16 @@ row_discard_tablespace_for_mysql( } else { ut_ad(!table->n_foreign_key_checks_running); + bool fts_exist = (dict_table_has_fts_index(table) + || DICT_TF2_FLAG_IS_SET( + table, DICT_TF2_FTS_HAS_DOC_ID)); + + if (fts_exist) { + row_mysql_unlock_data_dictionary(trx); + fts_optimize_remove_table(table); + row_mysql_lock_data_dictionary(trx); + } + /* Do foreign key constraint checks. */ err = row_discard_tablespace_foreign_key_checks(trx, table); @@ -3149,6 +3159,10 @@ row_discard_tablespace_for_mysql( if (err == DB_SUCCESS) { err = row_discard_tablespace(trx, table); } + + if (fts_exist && err != DB_SUCCESS) { + fts_optimize_add_table(table); + } } return(row_discard_tablespace_end(trx, table, err)); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 556329e138e..6e7b3e5939f 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2019, MariaDB Corporation. +Copyright (c) 2013, 2020, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -487,7 +487,9 @@ current_time % 60 == 0 and no tasks will be performed when current_time % 5 != 0. */ # define SRV_MASTER_CHECKPOINT_INTERVAL (7) -# define SRV_MASTER_PURGE_INTERVAL (10) +#ifdef MEM_PERIODIC_CHECK +# define SRV_MASTER_MEM_VALIDATE_INTERVAL (13) +#endif /* MEM_PERIODIC_CHECK */ # define SRV_MASTER_DICT_LRU_INTERVAL (47) /** Simulate compression failures. */