From 46496b1a8cbfc1bbc023da253aa05f95d47defd3 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 16:52:18 +0000 Subject: Windows, mtr - correctly determine CPU count, for --parallel=auto --- mysql-test/mysql-test-run.pl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index adabffa4219..d3f82e281e5 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -431,16 +431,21 @@ sub main { my $num_tests= @$tests; if ( $opt_parallel eq "auto" ) { # Try to find a suitable value for number of workers - my $sys_info= My::SysInfo->new(); - - $opt_parallel= $sys_info->num_cpus(); - for my $limit (2000, 1500, 1000, 500){ - $opt_parallel-- if ($sys_info->min_bogomips() < $limit); + if (IS_WINDOWS) + { + $opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1; + } + else + { + my $sys_info= My::SysInfo->new(); + $opt_parallel= $sys_info->num_cpus(); + for my $limit (2000, 1500, 1000, 500){ + $opt_parallel-- if ($sys_info->min_bogomips() < $limit); + } } my $max_par= $ENV{MTR_MAX_PARALLEL} || 8; $opt_parallel= $max_par if ($opt_parallel > $max_par); $opt_parallel= $num_tests if ($opt_parallel > $num_tests); - $opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm()); $opt_parallel= 1 if ($opt_parallel < 1); mtr_report("Using parallel: $opt_parallel"); } -- cgit v1.2.1 From 2dd8a732f3073c8e90a8c7f1a3de189758aac698 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 16:58:57 +0000 Subject: Windows, compiling - disable pkg_config pkg_config usually comes with Strawberry perl, and tends to find packages that might work in mingw compilation, but not with MSVC. Thus disable PKG_CONFIG, otherwise any FIND_PACKAGE() that is using PkgConfig can find something (like LibXml2 from connect), can potentially find something that is not going to compile. --- cmake/os/Windows.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 48184947da5..2dcdecdd72f 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -24,9 +24,6 @@ INCLUDE (CheckCSourceRuns) INCLUDE (CheckSymbolExists) INCLUDE (CheckTypeSize) -# Optionally read user configuration, generated by configure.js. -# This is left for backward compatibility reasons only. -INCLUDE(${CMAKE_BINARY_DIR}/win/configure.data OPTIONAL) # avoid running system checks by using pre-cached check results # system checks are expensive on VS since every tiny program is to be compiled in @@ -63,6 +60,8 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) ENDIF() IF(MSVC) + # Disable mingw based pkg-config found in Strawberry perl + SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") SET(MSVC_CRT_TYPE /MT CACHE STRING "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" ) -- cgit v1.2.1 From 1a10b261d0c810efe56a84ead44eb841762fb5c6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 17:01:07 +0000 Subject: Add some hints for finding bison on its usual locations on Windows. --- appveyor.yml | 2 +- cmake/bison.cmake | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c17c0c3bb77..22939d496c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: build-{build}~branch-{branch} before_build: - md %APPVEYOR_BUILD_FOLDER%\win_build - cd %APPVEYOR_BUILD_FOLDER%\win_build - - cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 -DBISON_EXECUTABLE=C:\cygwin\bin\bison + - cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 build: project: win_build\MySQL.sln diff --git a/cmake/bison.cmake b/cmake/bison.cmake index 0892a213d04..7cf5b0c67d9 100644 --- a/cmake/bison.cmake +++ b/cmake/bison.cmake @@ -20,7 +20,16 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(BISON_EXECUTABLE /opt/csw/bin/bison) ENDIF() ENDIF() -FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") +IF(WIN32) + SET(BISON_PATH_HINTS + HINTS + C:/gnuwin32/bin + C:/cygwin64/bin + C:/cygwin/bin) +ENDIF() +FIND_PROGRAM(BISON_EXECUTABLE bison + ${BISON_PATH_HINTS} + DOC "path to the bison executable") MARK_AS_ADVANCED(BISON_EXECUTABLE "") IF(NOT BISON_EXECUTABLE) MESSAGE("Warning: Bison executable not found in PATH") -- cgit v1.2.1 From ac8e3c85a40467de0ffc908dd9c5214acf23b38a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 18:39:56 +0000 Subject: MDEV-15295 Type mismatch for srv_fatal_semaphore_wait_threshold --- storage/innobase/handler/ha_innodb.cc | 4 ++-- storage/innobase/include/buf0buf.h | 2 +- storage/innobase/include/sync0types.h | 40 +++++++++++++++++++++++++++++++---- storage/innobase/include/trx0purge.h | 4 ++-- storage/innobase/srv/srv0conc.cc | 6 +++--- 5 files changed, 44 insertions(+), 12 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d256f42f2f6..9c22b0e09f2 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -15054,7 +15054,7 @@ ha_innobase::check( && !dict_index_is_corrupted(index)) { /* Enlarge the fatal lock wait timeout during CHECK TABLE. */ - my_atomic_addlint( + my_atomic_addlong( &srv_fatal_semaphore_wait_threshold, SRV_SEMAPHORE_WAIT_EXTENSION); @@ -15063,7 +15063,7 @@ ha_innobase::check( /* Restore the fatal lock wait timeout after CHECK TABLE. */ - my_atomic_addlint( + my_atomic_addlong( &srv_fatal_semaphore_wait_threshold, -SRV_SEMAPHORE_WAIT_EXTENSION); diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 4a54c30629b..063eb6b6fab 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1827,7 +1827,7 @@ struct buf_block_t{ } while (0) # define assert_block_ahi_valid(block) \ ut_a((block)->index \ - || my_atomic_addlint(&(block)->n_pointers, 0) == 0) + || my_atomic_loadlint(&(block)->n_pointers) == 0) # else /* UNIV_AHI_DEBUG || UNIV_DEBUG */ # define assert_block_ahi_empty(block) /* nothing */ # define assert_block_ahi_empty_on_init(block) /* nothing */ diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h index d0a6feb877b..19f992f5f50 100644 --- a/storage/innobase/include/sync0types.h +++ b/storage/innobase/include/sync0types.h @@ -1156,9 +1156,41 @@ enum rw_lock_flag_t { #endif /* UNIV_INNOCHECKSUM */ #ifdef _WIN64 -#define my_atomic_addlint(A,B) my_atomic_add64((int64*) (A), (B)) -#define my_atomic_loadlint(A) my_atomic_load64((int64*) (A)) -#define my_atomic_caslint(A,B,C) my_atomic_cas64((int64*) (A), (int64*) (B), (C)) +static inline ulint my_atomic_addlint(ulint *A, ulint B) +{ + return ulint(my_atomic_add64((volatile int64*)A, B)); +} + +static inline ulint my_atomic_loadlint(const ulint *A) +{ + return ulint(my_atomic_load64((volatile int64*)A)); +} + +static inline lint my_atomic_addlint(volatile lint *A, lint B) +{ + return my_atomic_add64((volatile int64*)A, B); +} + +static inline lint my_atomic_loadlint(const lint *A) +{ + return lint(my_atomic_load64((volatile int64*)A)); +} + +static inline void my_atomic_storelint(ulint *A, ulint B) +{ + my_atomic_store64((volatile int64*)A, B); +} + +static inline lint my_atomic_caslint(volatile lint *A, lint *B, lint C) +{ + return my_atomic_cas64((volatile int64*)A, (int64 *)B, C); +} + +static inline ulint my_atomic_caslint(ulint *A, ulint *B, ulint C) +{ + return my_atomic_cas64((volatile int64*)A, (int64 *)B, (int64)C); +} + #else #define my_atomic_addlint my_atomic_addlong #define my_atomic_loadlint my_atomic_loadlong @@ -1188,7 +1220,7 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) simple_counter #pragma warning (push) #pragma warning (disable : 4244) #endif - return Type(my_atomic_addlint(reinterpret_cast + return Type(my_atomic_addlint(reinterpret_cast (&m_counter), i)); #ifdef _MSC_VER #pragma warning (pop) diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index c9f5edb1432..be98921005d 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -517,9 +517,9 @@ public: parallelized purge operation */ ReadView view; /*!< The purge will not remove undo logs which are >= this view (purge view) */ - volatile ulint n_submitted; /*!< Count of total tasks submitted + ulint n_submitted; /*!< Count of total tasks submitted to the task queue */ - volatile ulint n_completed; /*!< Count of total tasks completed */ + ulint n_completed; /*!< Count of total tasks completed */ /*------------------------------*/ /* The following two fields form the 'purge pointer' which advances diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc index 9f589b57d9c..28eaca39af6 100644 --- a/storage/innobase/srv/srv0conc.cc +++ b/storage/innobase/srv/srv0conc.cc @@ -78,11 +78,11 @@ struct srv_conc_t { This is no longer true. We'll, however, keep the lint datatype to add assertions to catch any corner cases that we may have missed. */ - volatile lint n_active; + ulint n_active; /** Number of OS threads waiting in the FIFO for permission to enter InnoDB */ - volatile lint n_waiting; + ulint n_waiting; }; /* Control variables for tracking concurrency. */ @@ -152,7 +152,7 @@ srv_conc_enter_innodb_with_atomics( return; } - if (srv_conc.n_active < (lint) srv_thread_concurrency) { + if (srv_conc.n_active < srv_thread_concurrency) { ulint n_active; /* Check if there are any free tickets. */ -- cgit v1.2.1 From 24462cece440fa45e35c0938e00a3ec4d76932df Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 19:13:08 +0000 Subject: Disable noisy warning in old compiler (VS2015) --- cmake/os/Windows.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 2dcdecdd72f..c6cbfca2346 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -155,7 +155,11 @@ IF(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") ENDIF() - + IF(MSVC_VERSION LESS 1910) + # Noisy warning C4800: 'type': forcing value to bool 'true' or 'false' (performance warning), + # removed in VS2017 + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800") + ENDIF() ENDIF() # Always link with socket library -- cgit v1.2.1 From 8a923a6de5e1b293383512839886761b97524dc2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 19:45:26 +0000 Subject: Update C/C --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 058fc080b4e..67cc3438a84 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 058fc080b4ee95bce405c182ae8d542576863f8a +Subproject commit 67cc3438a84df9fa3cc0cfbf9ed81242502702da -- cgit v1.2.1 From d49f8e9f05c822c240d1878109eccdb92b285ff2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 14 Feb 2018 23:21:58 +0000 Subject: Windows,tests : fix pcre_test_bat test from pcre library. Tests that are not available in certain configurations, are marked as Test command : NOT_AVAILABLE in ctest output. pcre_test_bat does not work without ctest's -C option (--build-config that was used earlier was wrong). --- mysql-test/suite/unit/suite.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/unit/suite.pm b/mysql-test/suite/unit/suite.pm index 4a46272f041..c92363a8601 100644 --- a/mysql-test/suite/unit/suite.pm +++ b/mysql-test/suite/unit/suite.pm @@ -40,8 +40,8 @@ sub start_test { my $bin=$ENV{MTR_BINDIR} || '..'; return "Not run for embedded server" if $::opt_embedded_server; return "Not configured to run ctest" unless -f "$bin/CTestTestfile.cmake"; - my ($ctest_vs)= $opt_vs_config ? "--build-config $opt_vs_config" : ""; - my (@ctest_list)= `cd "$bin" && ctest $opt_vs_config --show-only --verbose`; + my ($ctest_vs)= $opt_vs_config ? "-C $opt_vs_config" : ""; + my (@ctest_list)= `cd "$bin" && ctest $ctest_vs --show-only --verbose`; return "No ctest" if $?; my ($command, %tests, $prefix); @@ -51,7 +51,9 @@ sub start_test { $command= $'; $prefix= /libmariadb/ ? 'conc_' : ''; } elsif (/^ +Test +#\d+: +/) { - $tests{$prefix.$'}=$command; + if ($command ne "NOT_AVAILABLE") { + $tests{$prefix.$'}=$command; + } } } bless { ctests => { %tests } }; -- cgit v1.2.1 From f082c7557e1e43bea922b517cef99ecdb9c98461 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 15 Feb 2018 01:26:09 +0000 Subject: fix signed/unsigned mismatch on Windows --- storage/innobase/srv/srv0srv.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 9989a24c708..42c2d2d1653 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2589,8 +2589,8 @@ DECLARE_THREAD(srv_worker_thread)( slot = srv_reserve_slot(SRV_WORKER); ut_a(srv_n_purge_threads > 1); - ut_a(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER]) - < static_cast(srv_n_purge_threads)); + ut_a(ulong(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER])) + < srv_n_purge_threads); /* We need to ensure that the worker threads exit after the purge coordinator thread. Otherwise the purge coordinator can -- cgit v1.2.1 From 743b073c4637e76460e01ab14ac34545c661e9b7 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 15 Feb 2018 11:53:46 +0000 Subject: Add more testsuites to Windows buildbot builder --- mysql-test/collections/buildbot_suites.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/collections/buildbot_suites.bat b/mysql-test/collections/buildbot_suites.bat index 40b1aceca10..445d81e4fd1 100644 --- a/mysql-test/collections/buildbot_suites.bat +++ b/mysql-test/collections/buildbot_suites.bat @@ -1,4 +1,5 @@ perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --parallel=4 --suite=^ +vcol,gcol,perfschema,^ main,^ innodb,^ plugins,^ -- cgit v1.2.1 From 54e66eefb8036906fdea377960fff511bf066459 Mon Sep 17 00:00:00 2001 From: Sauron Date: Fri, 2 Feb 2018 20:12:23 +0300 Subject: Prevent building WSREP without INNODB --- wsrep/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wsrep/CMakeLists.txt b/wsrep/CMakeLists.txt index 53c8e853078..ff2bdec4def 100644 --- a/wsrep/CMakeLists.txt +++ b/wsrep/CMakeLists.txt @@ -15,6 +15,10 @@ SET(WSREP_SOURCES wsrep_gtid.c wsrep_uuid.c wsrep_loader.c wsrep_dummy.c) +IF(NOT WITH_INNOBASE_STORAGE_ENGINE) + MESSAGE(WARNING "WSRep is enabled, but innodb is not. This configuration is not supported") +ENDIF() + ADD_CONVENIENCE_LIBRARY(wsrep ${WSREP_SOURCES}) DTRACE_INSTRUMENT(wsrep) -- cgit v1.2.1 From 6f314edac7a4eb23fa2324d99587a9f4e01eabbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 14 Feb 2018 15:18:55 +0200 Subject: MDEV-14648 Restore fix for MySQL BUG#39053 - UNINSTALL PLUGIN does not allow the storage engine to cleanup open connections Also, allow the MariaDB 10.2 server to link InnoDB dynamically against ha_innodb.so (which is what mysql-test-run.pl expects to exist, instead of the default name ha_innobase.so). wsrep_load_data_split(): Instead of referring to innodb_hton_ptr, check the handlerton::db_type. This was recently broken by me in MDEV-11415. innodb_lock_schedule_algorithm: Define as a weak global symbol, so that WITH_WSREP will not depend on InnoDB being linked statically. I tested this manually. Notably, running a test that only does SET GLOBAL wsrep_on=1; with a static or dynamic InnoDB and ./mtr --mysqld=--loose-innodb-lock-schedule-algorithm=fcfs will crash with SIGSEGV at shutdown. With the default VATS combination the wsrep_on is properly refused for both the static and dynamic InnoDB. ha_close_connection(): Do invoke the method also for plugins for which UNINSTALL PLUGIN was deferred due to open connections. Thanks to @svoj for pointing this out. thd_to_trx(): Return a pointer, not a reference to a pointer. check_trx_exists(): Invoke thd_set_ha_data() for assigning a transaction. log_write_checkpoint_info(): Remove an unused DEBUG_SYNC point that would cause an assertion failure on shutdown after deferred UNINSTALL PLUGIN. This was tested as follows: cmake -DWITH_WSREP=1 -DPLUGIN_INNOBASE:STRING=DYNAMIC \ -DWITH_MARIABACKUP:BOOL=OFF ... make cd mysql-test ./mtr innodb.innodb_uninstall --- sql/handler.cc | 6 ++++-- sql/sql_load.cc | 22 ++++++++++++---------- sql/wsrep_var.cc | 5 ++++- storage/innobase/CMakeLists.txt | 1 + storage/innobase/handler/ha_innodb.cc | 32 ++++++++++++-------------------- storage/innobase/handler/ha_innodb.h | 7 +------ storage/innobase/lock/lock0lock.cc | 2 +- storage/innobase/log/log0log.cc | 4 +--- 8 files changed, 36 insertions(+), 43 deletions(-) diff --git a/sql/handler.cc b/sql/handler.cc index 0e72e0276fa..dc45309ebad 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2016, MariaDB + Copyright (c) 2009, 2018, 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 @@ -793,7 +793,9 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin, */ void ha_close_connection(THD* thd) { - plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0); + plugin_foreach_with_mask(thd, closecon_handlerton, + MYSQL_STORAGE_ENGINE_PLUGIN, + PLUGIN_IS_DELETED|PLUGIN_IS_READY, 0); } static my_bool kill_handlerton(THD *thd, plugin_ref plugin, diff --git a/sql/sql_load.cc b/sql/sql_load.cc index e15d4d2fec5..70a6787d63b 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -104,23 +104,25 @@ the transaction after every 10,000 inserted rows. */ static bool wsrep_load_data_split(THD *thd, const TABLE *table, const COPY_INFO &info) { - extern struct handlerton* innodb_hton_ptr; - DBUG_ENTER("wsrep_load_data_split"); - if (wsrep_load_data_splitting && wsrep_on(thd) - && info.records && !(info.records % 10000) - && thd->transaction.stmt.ha_list - && thd->transaction.stmt.ha_list->ht() == binlog_hton - && thd->transaction.stmt.ha_list->next() - && thd->transaction.stmt.ha_list->next()->ht() == innodb_hton_ptr - && !thd->transaction.stmt.ha_list->next()->next()) + if (!wsrep_load_data_splitting || !wsrep_on(thd) + || !info.records || (info.records % 10000) + || !thd->transaction.stmt.ha_list + || thd->transaction.stmt.ha_list->ht() != binlog_hton + || !thd->transaction.stmt.ha_list->next() + || thd->transaction.stmt.ha_list->next()->next()) + DBUG_RETURN(false); + + if (handlerton* hton= thd->transaction.stmt.ha_list->next()->ht()) { + if (hton->db_type != DB_TYPE_INNODB) + DBUG_RETURN(false); WSREP_DEBUG("intermediate transaction commit in LOAD DATA"); if (wsrep_run_wsrep_commit(thd, true) != WSREP_TRX_OK) DBUG_RETURN(true); if (binlog_hton->commit(binlog_hton, thd, true)) DBUG_RETURN(true); wsrep_post_commit(thd, true); - innodb_hton_ptr->commit(innodb_hton_ptr, thd, true); + hton->commit(hton, thd, true); table->file->extra(HA_EXTRA_FAKE_START_STMT); } diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index a6122a7b1bc..b9eb546bf76 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -42,7 +42,10 @@ int wsrep_init_vars() return 0; } -extern ulong innodb_lock_schedule_algorithm; +/* This is intentionally declared as a weak global symbol, so that +linking will succeed even if the server is built with a dynamically +linked InnoDB. */ +ulong innodb_lock_schedule_algorithm __attribute__((weak)); bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type) { diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 1547fa84d7b..db320118b96 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -151,6 +151,7 @@ SET(INNOBASE_SOURCES ut/ut0timer.cc) MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE + MODULE_OUTPUT_NAME ha_innodb DEFAULT RECOMPILE_FOR_EMBEDDED LINK_LIBRARIES ${ZLIB_LIBRARY} diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9c22b0e09f2..1b230c4b91d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -154,12 +154,9 @@ innodb_check_deprecated(void); #ifdef WITH_WSREP #include "dict0priv.h" -#include "../storage/innobase/include/ut0byte.h" +#include "ut0byte.h" #include -class binlog_trx_data; -extern handlerton *binlog_hton; - extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log; static inline wsrep_ws_handle_t* @@ -1961,14 +1958,11 @@ thd_innodb_tmpdir( } /** Obtain the InnoDB transaction of a MySQL thread. -@param[in,out] thd MySQL thread handler. +@param[in,out] thd thread handle @return reference to transaction pointer */ -MY_ATTRIBUTE((warn_unused_result)) -trx_t*& -thd_to_trx( - THD* thd) +static trx_t* thd_to_trx(THD* thd) { - return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr)); + return *reinterpret_cast(thd_ha_data(thd, innodb_hton_ptr)); } #ifdef WITH_WSREP @@ -2877,20 +2871,19 @@ check_trx_exists( /*=============*/ THD* thd) /*!< in: user thread handle */ { - trx_t*& trx = thd_to_trx(thd); - - if (trx == NULL) { + if (trx_t* trx = thd_to_trx(thd)) { + ut_a(trx->magic_n == TRX_MAGIC_N); + innobase_trx_init(thd, trx); + return trx; + } else { trx = innobase_trx_allocate(thd); /* User trx can be forced to rollback, so we unset the disable flag. */ ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE); trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK; - } else { - ut_a(trx->magic_n == TRX_MAGIC_N); - innobase_trx_init(thd, trx); + thd_set_ha_data(thd, innodb_hton_ptr, trx); + return trx; } - - return(trx); } /************************************************************************* @@ -2900,8 +2893,7 @@ innobase_get_trx() { THD *thd=current_thd; if (likely(thd != 0)) { - trx_t*& trx = thd_to_trx(thd); - return(trx); + return thd_to_trx(thd); } else { return(NULL); } diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 4a35f4eae78..9dccfa38016 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, 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 @@ -911,11 +911,6 @@ innodb_base_col_setup_for_stored( create_table_info_t::normalize_table_name_low(norm_name, name, FALSE) #endif /* _WIN32 */ -/** Obtain the InnoDB transaction of a MySQL thread. -@param[in,out] thd MySQL thread handler. -@return reference to transaction pointer */ -trx_t*& thd_to_trx(THD* thd); - /** Converts an InnoDB error code to a MySQL error code. Also tells to MySQL about a possible transaction rollback inside InnoDB caused by a lock wait timeout or a deadlock. diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index d74ac76745d..7f73b35e6e0 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -54,7 +54,7 @@ Created 5/7/1996 Heikki Tuuri #endif /* WITH_WSREP */ /** Lock scheduling algorithm */ -ulong innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS; +ulong innodb_lock_schedule_algorithm; /** The value of innodb_deadlock_detect */ my_bool innobase_deadlock_detect; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 01f3ff1034c..5db77872679 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1584,8 +1584,6 @@ log_write_checkpoint_info(bool sync, lsn_t end_lsn) rw_lock_s_lock(&log_sys->checkpoint_lock); rw_lock_s_unlock(&log_sys->checkpoint_lock); - DEBUG_SYNC_C("checkpoint_completed"); - DBUG_EXECUTE_IF( "crash_after_checkpoint", DBUG_SUICIDE();); -- cgit v1.2.1 From 37af958d23eee5e80aa8f66f4772c84a43485b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 15 Feb 2018 09:46:02 +0200 Subject: MDEV-14905 Fulltext index modification committed during shutdown If CREATE TABLE...FULLTEXT INDEX was initiated right before shutdown, then the function fts_load_stopword() could commit modifications after shutdown was initiated, causing an assertion failure in the function trx_purge_add_update_undo_to_history(). Mark as internal all the read/write transactions that modify fulltext indexes, so that they will be ignored by the assertion that guards against transaction commits after shutdown has been initiated. fts_optimize_free(): Invoke trx_commit_for_mysql() just in case, because in fts_optimize_create() we started the transaction as internal, and fts_free_for_backgruond() would assert that the flag is clear. Transaction commit would clear the flag. --- storage/innobase/fts/fts0fts.cc | 8 +++++++- storage/innobase/fts/fts0opt.cc | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 2002374ce83..dd74270e84a 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2699,6 +2699,7 @@ retry: fts_table.parent = table->name.m_name; trx = trx_allocate_for_background(); + trx_start_internal(trx); trx->op_info = "update the next FTS document id"; @@ -2819,6 +2820,7 @@ fts_update_sync_doc_id( if (!trx) { trx = trx_allocate_for_background(); + trx_start_internal(trx); trx->op_info = "setting last FTS document id"; local_trx = TRUE; @@ -3056,6 +3058,8 @@ fts_commit_table( fts_cache_t* cache = ftt->table->fts->cache; trx_t* trx = trx_allocate_for_background(); + trx_start_internal(trx); + rows = ftt->rows; ftt->fts_trx->trx = trx; @@ -3792,6 +3796,7 @@ fts_doc_fetch_by_doc_id( trx_t* trx = trx_allocate_for_background(); que_t* graph; + trx_start_internal(trx); trx->op_info = "fetching indexed FTS document"; /* The FTS index can be supplied by caller directly with @@ -4138,6 +4143,7 @@ fts_sync_begin( sync->start_time = ut_time(); sync->trx = trx_allocate_for_background(); + trx_start_internal(sync->trx); if (fts_enable_diag_print) { ib::info() << "FTS SYNC for table " << sync->table->name @@ -5008,7 +5014,6 @@ fts_get_rows_count( char table_name[MAX_FULL_NAME_LEN]; trx = trx_allocate_for_background(); - trx->op_info = "fetching FT table rows count"; info = pars_info_create(); @@ -7350,6 +7355,7 @@ fts_load_stopword( if (!trx) { trx = trx_allocate_for_background(); + trx_start_internal(trx); trx->op_info = "upload FTS stopword"; new_trx = TRUE; } diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index d7e434320a3..3a05f1f013a 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. All Rights reserved. +Copyright (c) 2016, 2018, 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 @@ -989,6 +989,7 @@ fts_table_fetch_doc_ids( if (!trx) { trx = trx_allocate_for_background(); + trx_start_internal(trx); alloc_bk_trx = TRUE; } @@ -1619,6 +1620,7 @@ fts_optimize_create( optim->table = table; optim->trx = trx_allocate_for_background(); + trx_start_internal(optim->trx); optim->fts_common_table.parent = table->name.m_name; optim->fts_common_table.table_id = table->id; @@ -1741,6 +1743,7 @@ fts_optimize_free( { mem_heap_t* heap = static_cast(optim->self_heap->arg); + trx_commit_for_mysql(optim->trx); trx_free_for_background(optim->trx); fts_doc_ids_free(optim->to_delete); -- cgit v1.2.1 From 03400d974d4fdf9521b06ca0c4f2281f1a6915de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 15 Feb 2018 09:50:03 +0200 Subject: Dead code removal: sess_t The session object is not really needed for anything. We can directly create and free the dummy purge_sys->query->trx. --- storage/innobase/CMakeLists.txt | 1 - storage/innobase/dict/dict0crea.cc | 3 +- storage/innobase/include/pars0opt.h | 3 +- storage/innobase/include/pars0pars.h | 3 +- storage/innobase/include/pars0sym.h | 3 +- storage/innobase/include/que0que.h | 3 +- storage/innobase/include/que0que.ic | 2 -- storage/innobase/include/trx0purge.h | 5 +-- storage/innobase/include/trx0trx.h | 7 +--- storage/innobase/include/usr0sess.h | 69 ------------------------------------ storage/innobase/include/usr0types.h | 31 ---------------- storage/innobase/lock/lock0lock.cc | 1 - storage/innobase/lock/lock0prdt.cc | 1 - storage/innobase/que/que0que.cc | 3 +- storage/innobase/row/row0ins.cc | 1 - storage/innobase/srv/srv0srv.cc | 3 +- storage/innobase/srv/srv0start.cc | 1 - storage/innobase/trx/trx0purge.cc | 26 ++++++-------- storage/innobase/trx/trx0roll.cc | 1 - storage/innobase/trx/trx0sys.cc | 7 ---- storage/innobase/trx/trx0trx.cc | 6 ---- storage/innobase/usr/usr0sess.cc | 58 ------------------------------ storage/innobase/ut/ut0new.cc | 1 - 23 files changed, 20 insertions(+), 219 deletions(-) delete mode 100644 storage/innobase/include/usr0sess.h delete mode 100644 storage/innobase/include/usr0types.h delete mode 100644 storage/innobase/usr/usr0sess.cc diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index db320118b96..0033cdbae35 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -137,7 +137,6 @@ SET(INNOBASE_SOURCES trx/trx0sys.cc trx/trx0trx.cc trx/trx0undo.cc - usr/usr0sess.cc ut/ut0crc32.cc ut/ut0dbg.cc ut/ut0list.cc diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 8a06cd1db2c..c1ee4f3bc4e 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -38,7 +38,6 @@ Created 1/8/1996 Heikki Tuuri #include "row0mysql.h" #include "pars0pars.h" #include "trx0roll.h" -#include "usr0sess.h" #include "ut0vec.h" #include "dict0priv.h" #include "fts0priv.h" diff --git a/storage/innobase/include/pars0opt.h b/storage/innobase/include/pars0opt.h index 13ea38cc385..d9debcf325e 100644 --- a/storage/innobase/include/pars0opt.h +++ b/storage/innobase/include/pars0opt.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -29,7 +29,6 @@ Created 12/21/1997 Heikki Tuuri #include "univ.i" #include "que0types.h" -#include "usr0types.h" #include "pars0sym.h" #include "dict0types.h" #include "row0sel.h" diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index dad7953424c..37498c1c638 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -29,7 +29,6 @@ Created 11/19/1996 Heikki Tuuri #include "univ.i" #include "que0types.h" -#include "usr0types.h" #include "pars0types.h" #include "row0types.h" #include "trx0types.h" diff --git a/storage/innobase/include/pars0sym.h b/storage/innobase/include/pars0sym.h index 4e511719639..920087b96c2 100644 --- a/storage/innobase/include/pars0sym.h +++ b/storage/innobase/include/pars0sym.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -29,7 +29,6 @@ Created 12/15/1997 Heikki Tuuri #include "univ.i" #include "que0types.h" -#include "usr0types.h" #include "dict0types.h" #include "pars0types.h" #include "row0types.h" diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index 13be7291f00..f01b596a52e 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -33,7 +33,6 @@ Created 5/27/1996 Heikki Tuuri #include "trx0trx.h" #include "trx0roll.h" #include "srv0srv.h" -#include "usr0types.h" #include "que0types.h" #include "row0types.h" #include "pars0types.h" diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.ic index ec61081cfe2..545d5288298 100644 --- a/storage/innobase/include/que0que.ic +++ b/storage/innobase/include/que0que.ic @@ -23,8 +23,6 @@ Query graph Created 5/27/1996 Heikki Tuuri *******************************************************/ -#include "usr0sess.h" - /***********************************************************************//** Gets the trx of a query thread. */ UNIV_INLINE diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index be98921005d..4885809b311 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2017, 2018, 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 @@ -33,7 +33,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0sys.h" #include "que0types.h" #include "page0page.h" -#include "usr0sess.h" #include "fil0fil.h" #include "read0types.h" @@ -494,8 +493,6 @@ public: /** Destruct the purge system. */ ~purge_sys_t(); - sess_t* sess; /*!< System session running the purge - query */ rw_lock_t latch; /*!< The latch protecting the purge view. A purge operation must acquire an x-latch here for the instant at which diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index b2d4952318c..674eee572ed 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2017, MariaDB Corporation. +Copyright (c) 2015, 2018, 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 @@ -38,7 +38,6 @@ Created 3/26/1996 Heikki Tuuri #include "lock0types.h" #include "log0log.h" -#include "usr0types.h" #include "que0types.h" #include "mem0mem.h" #include "trx0xa.h" @@ -55,9 +54,6 @@ class ReadView; // Forward declaration class FlushObserver; -/** Dummy session used currently in MySQL interface */ -extern sess_t* trx_dummy_sess; - /** Set flush observer for the transaction @param[in/out] trx transaction struct @param[in] observer flush observer */ @@ -1139,7 +1135,6 @@ struct trx_t { ulint error_key_num; /*!< if the index creation fails to a duplicate key error, a mysql key number of that index is stored here */ - sess_t* sess; /*!< session of the trx, NULL if none */ que_t* graph; /*!< query currently run in the session, or NULL if none; NOTE that the query belongs to the session, and it can diff --git a/storage/innobase/include/usr0sess.h b/storage/innobase/include/usr0sess.h deleted file mode 100644 index 8e9497a85c5..00000000000 --- a/storage/innobase/include/usr0sess.h +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 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 -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/usr0sess.h -Sessions - -Created 6/25/1996 Heikki Tuuri -*******************************************************/ - -#ifndef usr0sess_h -#define usr0sess_h - -#include "univ.i" -#include "ut0byte.h" -#include "trx0types.h" -#include "srv0srv.h" -#include "trx0types.h" -#include "usr0types.h" -#include "que0types.h" -#include "data0data.h" -#include "rem0rec.h" - -/*********************************************************************//** -Opens a session. -@return own: session object */ -sess_t* -sess_open(void); -/*============*/ -/*********************************************************************//** -Closes a session, freeing the memory occupied by it. */ -void -sess_close( -/*=======*/ - sess_t* sess); /* in, own: session object */ - -/* The session handle. This data structure is only used by purge and is -not really necessary. We should get rid of it. */ -struct sess_t{ - ulint state; /*!< state of the session */ - trx_t* trx; /*!< transaction object permanently - assigned for the session: the - transaction instance designated by the - trx id changes, but the memory - structure is preserved */ -}; - -/* Session states */ -#define SESS_ACTIVE 1 -#define SESS_ERROR 2 /* session contains an error message - which has not yet been communicated - to the client */ -#endif diff --git a/storage/innobase/include/usr0types.h b/storage/innobase/include/usr0types.h deleted file mode 100644 index 6ba937cacc8..00000000000 --- a/storage/innobase/include/usr0types.h +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2009, Oracle and/or its affiliates. All Rights Reserved. - -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 -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file include/usr0types.h -Users and sessions global types - -Created 6/25/1996 Heikki Tuuri -*******************************************************/ - -#ifndef usr0types_h -#define usr0types_h - -struct sess_t; - -#endif diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 7f73b35e6e0..67a40e7639f 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -35,7 +35,6 @@ Created 5/7/1996 Heikki Tuuri #include "lock0lock.h" #include "lock0priv.h" #include "dict0mem.h" -#include "usr0sess.h" #include "trx0purge.h" #include "trx0sys.h" #include "srv0mon.h" diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc index dc2c6e2d15e..0e79dd5b460 100644 --- a/storage/innobase/lock/lock0prdt.cc +++ b/storage/innobase/lock/lock0prdt.cc @@ -29,7 +29,6 @@ Created 9/7/2013 Jimmy Yang #include "lock0priv.h" #include "lock0prdt.h" #include "ha_prototypes.h" -#include "usr0sess.h" #include "trx0purge.h" #include "dict0mem.h" #include "dict0boot.h" diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 839f7ca0100..87d37e347f1 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -27,7 +27,6 @@ Created 5/27/1996 Heikki Tuuri #include "ha_prototypes.h" #include "que0que.h" -#include "usr0sess.h" #include "trx0trx.h" #include "trx0roll.h" #include "row0undo.h" diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index a81594bb0b7..98e94e06464 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -45,7 +45,6 @@ Created 4/20/1996 Heikki Tuuri #include "log0log.h" #include "eval0eval.h" #include "data0data.h" -#include "usr0sess.h" #include "buf0lru.h" #include "fts0fts.h" #include "fts0types.h" diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 42c2d2d1653..16318bad8f5 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, 2017, MariaDB Corporation. +Copyright (c) 2013, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -70,7 +70,6 @@ Created 10/8/1995 Heikki Tuuri #include "sync0sync.h" #include "trx0i_s.h" #include "trx0purge.h" -#include "usr0sess.h" #include "ut0crc32.h" #include "btr0defragment.h" #include "ut0mem.h" diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index d3b7fb6bf94..8c2d0dc8871 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -88,7 +88,6 @@ Created 2/16/1996 Heikki Tuuri #include "dict0load.h" #include "dict0stats_bg.h" #include "que0que.h" -#include "usr0sess.h" #include "lock0lock.h" #include "trx0roll.h" #include "trx0purge.h" diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index a1f16df2304..16ee1d2e8e8 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, 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 @@ -165,21 +165,15 @@ TrxUndoRsegsIterator::set_next() /** Build a purge 'query' graph. The actual purge is performed by executing this query graph. -@param[in,out] sess the purge session @return own: the query graph */ static que_t* -trx_purge_graph_build(sess_t* sess) +purge_graph_build() { ut_a(srv_n_purge_threads > 0); - /* A purge transaction is not a real transaction, we use a transaction - here only because the query threads code requires it. It is otherwise - quite unnecessary. We should get rid of it eventually. */ - trx_t* trx = sess->trx; - ut_ad(trx->sess == sess); - - trx->id = 0; + trx_t* trx = trx_allocate_for_background(); + ut_ad(!trx->id); trx->start_time = ut_time(); trx->state = TRX_STATE_ACTIVE; trx->op_info = "purge trx"; @@ -199,9 +193,9 @@ trx_purge_graph_build(sess_t* sess) /** Construct the purge system. */ purge_sys_t::purge_sys_t() - : sess(sess_open()), latch(), event(os_event_create(0)), + : latch(), event(os_event_create(0)), n_stop(0), running(false), state(PURGE_STATE_INIT), - query(trx_purge_graph_build(sess)), + query(purge_graph_build()), view(), n_submitted(0), n_completed(0), iter(), limit(), #ifdef UNIV_DEBUG @@ -221,10 +215,12 @@ purge_sys_t::~purge_sys_t() { ut_ad(this == purge_sys); + trx_t* trx = query->trx; que_graph_free(query); - ut_a(sess->trx->id == 0); - sess->trx->state = TRX_STATE_NOT_STARTED; - sess_close(sess); + ut_ad(!trx->id); + ut_ad(trx->state == TRX_STATE_ACTIVE); + trx->state = TRX_STATE_NOT_STARTED; + trx_free_for_background(trx); view.close(); rw_lock_free(&latch); /* rw_lock_free() already called latch.~rw_lock_t(); tame the diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index ab500cfbfad..5c2258f25be 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -47,7 +47,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0sys.h" #include "trx0trx.h" #include "trx0undo.h" -#include "usr0sess.h" #include "ha_prototypes.h" /** This many pages must be undone before a truncate is tried within diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index 393dff8c026..f7404e8a303 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -500,8 +500,6 @@ trx_sys_init_at_db_start() mtr.commit(); ut_d(trx_sys->rw_max_trx_id = trx_sys->max_trx_id); - trx_dummy_sess = sess_open(); - trx_lists_init_at_db_start(); /* This mutex is not strictly required, it is here only to satisfy @@ -928,11 +926,6 @@ trx_sys_close(void) " shutdown: " << size << " read views open"; } - if (trx_dummy_sess) { - sess_close(trx_dummy_sess); - trx_dummy_sess = NULL; - } - /* Only prepared transactions may be left in the system. Free them. */ ut_a(UT_LIST_GET_LEN(trx_sys->rw_trx_list) == trx_sys->n_prepared_trx || !srv_was_started diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 19614184507..c6e2bd88d62 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -51,7 +51,6 @@ Created 3/26/1996 Heikki Tuuri #include "trx0rseg.h" #include "trx0undo.h" #include "trx0xa.h" -#include "usr0sess.h" #include "ut0new.h" #include "ut0pool.h" #include "ut0vec.h" @@ -70,9 +69,6 @@ typedef std::set< std::less, ut_allocator > table_id_set; -/** Dummy session used currently in MySQL interface */ -sess_t* trx_dummy_sess = NULL; - /** Constructor */ TrxVersion::TrxVersion(trx_t* trx) : @@ -518,8 +514,6 @@ trx_allocate_for_background(void) trx = trx_create_low(); - trx->sess = trx_dummy_sess; - return(trx); } diff --git a/storage/innobase/usr/usr0sess.cc b/storage/innobase/usr/usr0sess.cc deleted file mode 100644 index 55ce9500e5c..00000000000 --- a/storage/innobase/usr/usr0sess.cc +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 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 -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/**************************************************//** -@file usr/usr0sess.cc -Sessions - -Created 6/25/1996 Heikki Tuuri -*******************************************************/ - -#include "usr0sess.h" -#include "trx0trx.h" - -/*********************************************************************//** -Opens a session. -@return own: session object */ -sess_t* -sess_open(void) -/*===========*/ -{ - sess_t* sess; - - sess = static_cast(ut_zalloc_nokey(sizeof(*sess))); - - sess->state = SESS_ACTIVE; - - sess->trx = trx_allocate_for_background(); - sess->trx->sess = sess; - - return(sess); -} - -/*********************************************************************//** -Closes a session, freeing the memory occupied by it. */ -void -sess_close( -/*=======*/ - sess_t* sess) /*!< in, own: session object */ -{ - trx_free_for_background(sess->trx); - ut_free(sess); -} diff --git a/storage/innobase/ut/ut0new.cc b/storage/innobase/ut/ut0new.cc index bf5515f4de0..052db2fe7bd 100644 --- a/storage/innobase/ut/ut0new.cc +++ b/storage/innobase/ut/ut0new.cc @@ -167,7 +167,6 @@ ut_new_boot() "trx0sys", "trx0trx", "trx0undo", - "usr0sess", "ut0list", "ut0mem", "ut0mutex", -- cgit v1.2.1 From 2bb19230d85e250baad9c056c35b5d2cf755343d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 15 Feb 2018 15:34:15 +0200 Subject: MDEV-15323 Follow-up to MDEV-14905: Skip FTS processing if innodb_read_only fts_cmp_set_sync_doc_id(), fts_load_stopword(): Start the transaction in read-only mode if innodb_read_only is set. fts_update_sync_doc_id(), fts_commit_table(), fts_sync(), fts_optimize_table(): Return DB_READ_ONLY if innodb_read_only is set. fts_doc_fetch_by_doc_id(), fts_table_fetch_doc_ids(): Remove the code to start an internal transaction or to roll back, because this is a read-only operation. --- storage/innobase/fts/fts0fts.cc | 33 +++++++++++++++++++++++---------- storage/innobase/fts/fts0opt.cc | 10 +++++----- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index dd74270e84a..c2628d609fa 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2699,7 +2699,11 @@ retry: fts_table.parent = table->name.m_name; trx = trx_allocate_for_background(); - trx_start_internal(trx); + if (srv_read_only_mode) { + trx_start_internal_read_only(trx); + } else { + trx_start_internal(trx); + } trx->op_info = "update the next FTS document id"; @@ -2808,6 +2812,10 @@ fts_update_sync_doc_id( fts_cache_t* cache = table->fts->cache; char fts_name[MAX_FULL_NAME_LEN]; + if (srv_read_only_mode) { + return DB_READ_ONLY; + } + fts_table.suffix = "CONFIG"; fts_table.table_id = table->id; fts_table.type = FTS_COMMON_TABLE; @@ -3052,6 +3060,10 @@ fts_commit_table( /*=============*/ fts_trx_table_t* ftt) /*!< in: FTS table to commit*/ { + if (srv_read_only_mode) { + return DB_READ_ONLY; + } + const ib_rbt_node_t* node; ib_rbt_t* rows; dberr_t error = DB_SUCCESS; @@ -3796,7 +3808,6 @@ fts_doc_fetch_by_doc_id( trx_t* trx = trx_allocate_for_background(); que_t* graph; - trx_start_internal(trx); trx->op_info = "fetching indexed FTS document"; /* The FTS index can be supplied by caller directly with @@ -3884,13 +3895,7 @@ fts_doc_fetch_by_doc_id( } error = fts_eval_sql(trx, graph); - - if (error == DB_SUCCESS) { - fts_sql_commit(trx); - } else { - fts_sql_rollback(trx); - } - + fts_sql_commit(trx); trx_free_for_background(trx); if (!get_doc) { @@ -4359,6 +4364,10 @@ fts_sync( bool wait, bool has_dict) { + if (srv_read_only_mode) { + return DB_READ_ONLY; + } + ulint i; dberr_t error = DB_SUCCESS; fts_cache_t* cache = sync->table->fts->cache; @@ -7355,7 +7364,11 @@ fts_load_stopword( if (!trx) { trx = trx_allocate_for_background(); - trx_start_internal(trx); + if (srv_read_only_mode) { + trx_start_internal_read_only(trx); + } else { + trx_start_internal(trx); + } trx->op_info = "upload FTS stopword"; new_trx = TRUE; } diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 3a05f1f013a..910721d8b32 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -989,7 +989,6 @@ fts_table_fetch_doc_ids( if (!trx) { trx = trx_allocate_for_background(); - trx_start_internal(trx); alloc_bk_trx = TRUE; } @@ -1018,17 +1017,14 @@ fts_table_fetch_doc_ids( "CLOSE c;"); error = fts_eval_sql(trx, graph); + fts_sql_commit(trx); mutex_enter(&dict_sys->mutex); que_graph_free(graph); mutex_exit(&dict_sys->mutex); if (error == DB_SUCCESS) { - fts_sql_commit(trx); - ib_vector_sort(doc_ids->doc_ids, fts_update_doc_id_cmp); - } else { - fts_sql_rollback(trx); } if (alloc_bk_trx) { @@ -2442,6 +2438,10 @@ fts_optimize_table( /*===============*/ dict_table_t* table) /*!< in: table to optimiza */ { + if (srv_read_only_mode) { + return DB_READ_ONLY; + } + dberr_t error = DB_SUCCESS; fts_optimize_t* optim = NULL; fts_t* fts = table->fts; -- cgit v1.2.1 From 8df787d375ec0aa83d1fb6e2641821aa7438eb55 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Thu, 15 Feb 2018 18:39:29 +0200 Subject: Follow-up for 54db0be3be59 (Added Max_index_length and Temporary) --- .../suite/storage_engine/autoincrement.result | 20 +++++++-------- mysql-test/suite/storage_engine/autoincrement.test | 10 ++++---- .../suite/storage_engine/show_table_status.result | 6 +++++ .../suite/storage_engine/show_table_status.test | 2 +- .../suite/storage_engine/truncate_table.result | 16 ++++++------ .../suite/storage_engine/truncate_table.test | 8 +++--- .../mysql-test/storage_engine/autoincrement.rdiff | 30 +++++++++++----------- .../mysql-test/storage_engine/truncate_table.rdiff | 24 ++++++++--------- 8 files changed, 61 insertions(+), 55 deletions(-) diff --git a/mysql-test/suite/storage_engine/autoincrement.result b/mysql-test/suite/storage_engine/autoincrement.result index 44cb8650441..541486e44de 100644 --- a/mysql-test/suite/storage_engine/autoincrement.result +++ b/mysql-test/suite/storage_engine/autoincrement.result @@ -51,15 +51,15 @@ LAST_INSERT_ID() 5 SET sql_mode = ''; SHOW TABLE STATUS FROM test LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # 6 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # 6 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 5 SHOW TABLE STATUS FROM test LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 8 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 8 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j'); SELECT a,b FROM t1 ORDER BY a; a b @@ -77,12 +77,12 @@ SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 8 SHOW TABLE STATUS FROM test LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 10 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 10 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (20,'k'); SHOW TABLE STATUS FROM test LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 21 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 21 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (NULL,'l'); SELECT a,b FROM t1 ORDER BY a; a b @@ -102,8 +102,8 @@ SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 21 SHOW TABLE STATUS FROM test LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 22 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 22 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (-5,'m'); SELECT a,b FROM t1 ORDER BY a; a b diff --git a/mysql-test/suite/storage_engine/autoincrement.test b/mysql-test/suite/storage_engine/autoincrement.test index ddb0ab1b464..1ca0b650039 100644 --- a/mysql-test/suite/storage_engine/autoincrement.test +++ b/mysql-test/suite/storage_engine/autoincrement.test @@ -50,7 +50,7 @@ if (!$mysql_errname) # SHOW TABLE STATUS shows the auto-increment value in column 11, # that's all we need here and further --source mask_engine.inc - --replace_column 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS FROM test LIKE 't1'; # Mix of automatic and explicit values @@ -58,7 +58,7 @@ if (!$mysql_errname) INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h'); SELECT LAST_INSERT_ID(); - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS FROM test LIKE 't1'; @@ -66,21 +66,21 @@ if (!$mysql_errname) SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS FROM test LIKE 't1'; # Creating a gap in the sequence INSERT INTO t1 (a,b) VALUES (20,'k'); - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS FROM test LIKE 't1'; INSERT INTO t1 (a,b) VALUES (NULL,'l'); SELECT a,b FROM t1 ORDER BY a; SELECT LAST_INSERT_ID(); - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS FROM test LIKE 't1'; # Negative values: we will try to insert one just to check that it does not cause a crash, diff --git a/mysql-test/suite/storage_engine/show_table_status.result b/mysql-test/suite/storage_engine/show_table_status.result index 98de48f816b..b020bbe6a00 100644 --- a/mysql-test/suite/storage_engine/show_table_status.result +++ b/mysql-test/suite/storage_engine/show_table_status.result @@ -23,6 +23,8 @@ Collation latin1_swedish_ci Checksum NULL Create_options Comment +Max_index_length ### +Temporary N Name t2 Engine Version 10 @@ -41,6 +43,8 @@ Collation latin1_swedish_ci Checksum NULL Create_options Comment +Max_index_length ### +Temporary N Name t3 Engine Version 10 @@ -59,4 +63,6 @@ Collation utf8_general_ci Checksum NULL Create_options Comment +Max_index_length ### +Temporary N DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/storage_engine/show_table_status.test b/mysql-test/suite/storage_engine/show_table_status.test index 469d7e33a20..2fd5c6a706a 100644 --- a/mysql-test/suite/storage_engine/show_table_status.test +++ b/mysql-test/suite/storage_engine/show_table_status.test @@ -22,7 +22,7 @@ INSERT INTO t2 (a,b) VALUES (1,'bar'); --let $table_options = CHARACTER SET utf8 --source create_table.inc ---replace_column 2 4 ### 6 ### 7 ### 8 ### 9 ### 10 ### 12 ### 13 ### +--replace_column 2 4 ### 6 ### 7 ### 8 ### 9 ### 10 ### 12 ### 13 ### 19 ### --query_vertical SHOW TABLE STATUS WHERE name IN ( 't1', 't2', 't3' ) DROP TABLE t1, t2, t3; diff --git a/mysql-test/suite/storage_engine/truncate_table.result b/mysql-test/suite/storage_engine/truncate_table.result index d8dc5046442..eac58272e48 100644 --- a/mysql-test/suite/storage_engine/truncate_table.result +++ b/mysql-test/suite/storage_engine/truncate_table.result @@ -8,20 +8,20 @@ a b DROP TABLE t1; CREATE TABLE t1 (a KEY AUTO_INCREMENT, c ) ENGINE= ; SHOW TABLE STATUS LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 1 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 1 # # # # # # # # N INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); SHOW TABLE STATUS LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 4 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 4 # # # # # # # # N TRUNCATE TABLE t1; SHOW TABLE STATUS LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 1 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 1 # # # # # # # # N INSERT INTO t1 (c) VALUES ('d'); SHOW TABLE STATUS LIKE 't1'; -Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment -t1 # # # # # # # # # 2 # # # # # # # +Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +t1 # # # # # # # # # 2 # # # # # # # # N SELECT a,c FROM t1; a c 1 d diff --git a/mysql-test/suite/storage_engine/truncate_table.test b/mysql-test/suite/storage_engine/truncate_table.test index a9277b39619..6a6301f4be0 100644 --- a/mysql-test/suite/storage_engine/truncate_table.test +++ b/mysql-test/suite/storage_engine/truncate_table.test @@ -36,19 +36,19 @@ if ($mysql_errname) } if (!$mysql_errname) { - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS LIKE 't1'; INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS LIKE 't1'; TRUNCATE TABLE t1; - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS LIKE 't1'; INSERT INTO t1 (c) VALUES ('d'); - --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # + --replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 # 19 # SHOW TABLE STATUS LIKE 't1'; SELECT a,c FROM t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff index 68264bdeb8d..cc04b800793 100644 --- a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff @@ -12,40 +12,40 @@ @@ -52,14 +52,14 @@ SET sql_mode = ''; SHOW TABLE STATUS FROM test LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # 6 # # # # # # # -+t1 # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # 6 # # # # # # # # N ++t1 # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h'); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() 5 SHOW TABLE STATUS FROM test LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 8 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 8 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j'); SELECT a,b FROM t1 ORDER BY a; a b @@ -78,11 +78,11 @@ 8 SHOW TABLE STATUS FROM test LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 10 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 10 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (20,'k'); SHOW TABLE STATUS FROM test LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 21 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 21 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (NULL,'l'); SELECT a,b FROM t1 ORDER BY a; a b @@ -103,7 +103,7 @@ 21 SHOW TABLE STATUS FROM test LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 22 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 22 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (a,b) VALUES (-5,'m'); SELECT a,b FROM t1 ORDER BY a; a b diff --git a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff index bb2e5585910..e429bbdb177 100644 --- a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff @@ -3,24 +3,24 @@ @@ -9,19 +9,19 @@ CREATE TABLE t1 (a KEY AUTO_INCREMENT, c ) ENGINE= ; SHOW TABLE STATUS LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 1 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 1 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (c) VALUES ('a'),('b'),('c'); SHOW TABLE STATUS LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 4 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 4 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N TRUNCATE TABLE t1; SHOW TABLE STATUS LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 1 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 1 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N INSERT INTO t1 (c) VALUES ('d'); SHOW TABLE STATUS LIKE 't1'; - Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment --t1 # # # # # # # # # 2 # # # # # # # -+t1 # # # # # # # # # 0 # # # # # # # + Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary +-t1 # # # # # # # # # 2 # # # # # # # # N ++t1 # # # # # # # # # 0 # # # # # # # # N SELECT a,c FROM t1; a c 1 d -- cgit v1.2.1 From a08121c978f17e834e852802e7516b0aba6344e6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 15 Feb 2018 17:40:14 +0000 Subject: MDEV-14997 mariabackup crashes with invalid --innodb-flush-method Avoid NULL pointer dereference when shutting down after invalid parameters were parsed. --- extra/mariabackup/xtrabackup.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 7ac168b1778..18c7474a2e8 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3569,7 +3569,9 @@ xtrabackup_backup_func() if(innodb_init_param()) { fail: stop_backup_threads(); - innodb_shutdown(); + if (fil_system) { + innodb_shutdown(); + } return(false); } -- cgit v1.2.1 From 2129eab7e22ac452f9480040c09aa1c645438054 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 15 Feb 2018 21:08:18 +0000 Subject: MDEV-15071 backup does not store xtrabackup_info in the --extra-lsndir directory --- extra/mariabackup/backup_copy.cc | 4 +--- extra/mariabackup/backup_mysql.cc | 6 +++--- extra/mariabackup/backup_mysql.h | 2 +- extra/mariabackup/xtrabackup.cc | 8 +++++++- mysql-test/suite/mariabackup/extra_lsndir.result | 2 ++ mysql-test/suite/mariabackup/extra_lsndir.test | 9 +++++++++ 6 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 mysql-test/suite/mariabackup/extra_lsndir.result create mode 100644 mysql-test/suite/mariabackup/extra_lsndir.test diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 5c18098355f..1542e57c84c 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1464,12 +1464,10 @@ bool backup_finish() return(false); } - if (!write_xtrabackup_info(mysql_connection)) { + if (!write_xtrabackup_info(mysql_connection, XTRABACKUP_INFO, opt_history != 0)) { return(false); } - - return(true); } diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 4a33f9ef4e5..91e659f679e 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -1398,7 +1398,7 @@ PERCONA_SCHEMA.xtrabackup_history and writes a new history record to the table containing all the history info particular to the just completed backup. */ bool -write_xtrabackup_info(MYSQL *connection) +write_xtrabackup_info(MYSQL *connection, const char * filename, bool history) { char *uuid = NULL; @@ -1426,7 +1426,7 @@ write_xtrabackup_info(MYSQL *connection) || xtrabackup_databases_exclude ); - backup_file_printf(XTRABACKUP_INFO, + backup_file_printf(filename, "uuid = %s\n" "name = %s\n" "tool_name = %s\n" @@ -1463,7 +1463,7 @@ write_xtrabackup_info(MYSQL *connection) xb_stream_name[xtrabackup_stream_fmt], /* format */ xtrabackup_compress ? "compressed" : "N"); /* compressed */ - if (!opt_history) { + if (!history) { goto cleanup; } diff --git a/extra/mariabackup/backup_mysql.h b/extra/mariabackup/backup_mysql.h index 3ccd7bdb613..e2c56f88a8c 100644 --- a/extra/mariabackup/backup_mysql.h +++ b/extra/mariabackup/backup_mysql.h @@ -68,7 +68,7 @@ bool write_binlog_info(MYSQL *connection); bool -write_xtrabackup_info(MYSQL *connection); +write_xtrabackup_info(MYSQL *connection, const char * filename, bool history); bool write_backup_config_file(); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 18c7474a2e8..817412c8975 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3513,7 +3513,13 @@ xtrabackup_backup_low() "to '%s'.\n", filename); return false; } - + sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, + XTRABACKUP_INFO); + if (!write_xtrabackup_info(mysql_connection, filename, false)) { + msg("mariabackup: Error: failed to write info " + "to '%s'.\n", filename); + return false; + } } return true; diff --git a/mysql-test/suite/mariabackup/extra_lsndir.result b/mysql-test/suite/mariabackup/extra_lsndir.result new file mode 100644 index 00000000000..a25c45a13d1 --- /dev/null +++ b/mysql-test/suite/mariabackup/extra_lsndir.result @@ -0,0 +1,2 @@ +xtrabackup_checkpoints +xtrabackup_info diff --git a/mysql-test/suite/mariabackup/extra_lsndir.test b/mysql-test/suite/mariabackup/extra_lsndir.test new file mode 100644 index 00000000000..092ee34c6cc --- /dev/null +++ b/mysql-test/suite/mariabackup/extra_lsndir.test @@ -0,0 +1,9 @@ +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $extra_lsndir=$MYSQLTEST_VARDIR/tmp/extra_lsndir; +mkdir $extra_lsndir; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --extra-lsndir=$extra_lsndir; +--enable_result_log +list_files $extra_lsndir; +rmdir $extra_lsndir; +rmdir $targetdir; -- cgit v1.2.1 From 144616034cbe792634deec7fee286090490cebec Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 16 Feb 2018 01:35:19 +0200 Subject: Don't run sql_sequence.grant for embeddes server --- mysql-test/suite/sql_sequence/grant.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/suite/sql_sequence/grant.test b/mysql-test/suite/sql_sequence/grant.test index 790b876a831..3a911d79671 100644 --- a/mysql-test/suite/sql_sequence/grant.test +++ b/mysql-test/suite/sql_sequence/grant.test @@ -3,6 +3,10 @@ # Note that replication.test also does some grant testing # +# Grant tests not performed with embedded server +-- source include/not_embedded.inc + + SET @@SQL_MODE = REPLACE(@@SQL_MODE, 'NO_AUTO_CREATE_USER', ''); create database mysqltest_1; use mysqltest_1; -- cgit v1.2.1 From d3fbff38b9e8d6395dccfde4388d46824e7152cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 16 Feb 2018 08:21:19 +0200 Subject: MDEV-14814: encryption.innodb_encryption-page-compression failed in buildbot with timeout on wait condition Problem is that if pages are in buffer pool there is no need for decrypt or page decompression operations. --- .../r/innodb_encryption-page-compression.result | 15 ++++----------- .../t/innodb_encryption-page-compression.test | 22 ++++++++++------------ 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result index ec92825ac8e..88437408c32 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result +++ b/mysql-test/suite/encryption/r/innodb_encryption-page-compression.result @@ -1,5 +1,4 @@ SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_encryption_threads = 4; SET GLOBAL innodb_encrypt_tables = on; set global innodb_compression_algorithm = 1; @@ -139,15 +138,9 @@ count(*) SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; variable_value > 0 1 -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; -variable_value >= 0 -1 SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; variable_value > 0 1 -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; -variable_value >= 0 -1 SET GLOBAL innodb_encryption_threads = 4; SET GLOBAL innodb_encrypt_tables = off; update innodb_page_compressed1 set c1 = c1 + 1; @@ -159,8 +152,8 @@ update innodb_page_compressed6 set c1 = c1 + 1; update innodb_page_compressed7 set c1 = c1 + 1; update innodb_page_compressed8 set c1 = c1 + 1; update innodb_page_compressed9 set c1 = c1 + 1; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; -variable_value >= 0 +SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; +variable_value > 0 1 SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; variable_value > 0 @@ -168,8 +161,8 @@ variable_value > 0 SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; variable_value > 0 1 -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; -variable_value >= 0 +SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; +variable_value > 0 1 drop procedure innodb_insert_proc; drop table innodb_normal; diff --git a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test index ea6bd65d605..0c18b97bfd6 100644 --- a/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test +++ b/mysql-test/suite/encryption/t/innodb_encryption-page-compression.test @@ -1,17 +1,14 @@ -- source include/have_innodb.inc -- source include/have_example_key_management_plugin.inc +-- source include/not_embedded.inc --disable_query_log -let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`; -let $innodb_file_format_orig = `SELECT @@innodb_file_format`; -let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`; let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`; --enable_query_log --disable_warnings SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_encryption_threads = 4; SET GLOBAL innodb_encrypt_tables = on; --enable_warnings @@ -86,11 +83,13 @@ select count(*) from innodb_page_compressed9 where c1 < 500000; let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; --source include/wait_condition.inc +let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED'; +--source include/wait_condition.inc SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; + +--source include/restart_mysqld.inc SET GLOBAL innodb_encryption_threads = 4; SET GLOBAL innodb_encrypt_tables = off; @@ -105,13 +104,15 @@ update innodb_page_compressed7 set c1 = c1 + 1; update innodb_page_compressed8 set c1 = c1 + 1; update innodb_page_compressed9 set c1 = c1 + 1; -let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED'; +let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED'; +--source include/wait_condition.inc +let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED'; --source include/wait_condition.inc -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; +SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted'; SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted'; SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed'; -SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; +SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed'; drop procedure innodb_insert_proc; drop table innodb_normal; @@ -127,9 +128,6 @@ drop table innodb_page_compressed9; # reset system --disable_query_log -EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig; -EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; -EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig; EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig; --enable_query_log -- cgit v1.2.1 From 21e5335154e4eb689df90c52a6b55263cd2067fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 16 Feb 2018 10:19:57 +0200 Subject: MDEV-9962: encryption.innodb_encryption_filekeys stalled waiting for key encryption threads to decrypt all required spaces Test changes. --- .../encryption/r/innodb_encryption_filekeys.result | 24 ++++++--------- .../encryption/t/innodb_encryption_filekeys.test | 35 ++++++++++------------ 2 files changed, 25 insertions(+), 34 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result b/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result index ab958004eab..1c8341137b4 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result +++ b/mysql-test/suite/encryption/r/innodb_encryption_filekeys.result @@ -1,6 +1,4 @@ -call mtr.add_suppression("trying to do an operation on a dropped tablespace .*"); SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_encrypt_tables = OFF; SET GLOBAL innodb_encryption_threads = 4; CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; @@ -14,24 +12,21 @@ t1 CREATE TABLE `t1` ( CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES; CREATE TABLE t3 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO; CREATE TABLE t4 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; -INSERT INTO t2 select * from t1; -INSERT INTO t3 select * from t1; -INSERT INTO t4 select * from t1; SET GLOBAL innodb_encrypt_tables = on; # Wait max 10 min for key encryption threads to encrypt required all spaces # Success! SELECT COUNT(1) FROM t1; COUNT(1) -400 +10 SELECT COUNT(1) FROM t2; COUNT(1) -400 +10 SELECT COUNT(1) FROM t3; COUNT(1) -400 +10 SELECT COUNT(1) FROM t4; COUNT(1) -400 +10 SET GLOBAL innodb_encrypt_tables = off; # Wait max 10 min for key encryption threads to decrypt all required spaces # Success! @@ -50,18 +45,17 @@ INSERT INTO t5 select * from t1; # Success! SELECT COUNT(1) FROM t1; COUNT(1) -400 +10 SELECT COUNT(1) FROM t2; COUNT(1) -400 +10 SELECT COUNT(1) FROM t3; COUNT(1) -400 +10 SELECT COUNT(1) FROM t4; COUNT(1) -400 +10 SELECT COUNT(1) FROM t5; COUNT(1) -400 +10 drop table t1,t2,t3,t4, t5; -set GLOBAL innodb_default_encryption_key_id=1; diff --git a/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test b/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test index 8f0986071f1..f73e78aa5bf 100644 --- a/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test +++ b/mysql-test/suite/encryption/t/innodb_encryption_filekeys.test @@ -1,21 +1,18 @@ -- source include/have_innodb.inc -- source include/have_file_key_management_plugin.inc -# embedded does not support restart --- source include/not_embedded.inc - -call mtr.add_suppression("trying to do an operation on a dropped tablespace .*"); --disable_query_log let $innodb_file_format_orig = `SELECT @@innodb_file_format`; -let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; let $encrypt_tables = `SELECT @@innodb_encrypt_tables`; let $threads = `SELECT @@innodb_encryption_threads`; +let $key_id = `SELECT @@innodb_default_encryption_key_id`; --enable_query_log +--disable_warnings SET GLOBAL innodb_file_format = `Barracuda`; -SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_encrypt_tables = OFF; SET GLOBAL innodb_encryption_threads = 4; +--enable_warnings CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB; SHOW CREATE TABLE t1; @@ -25,21 +22,20 @@ CREATE TABLE t4 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNOD --disable_warnings --disable_query_log -set autocommit=0; -let $i = 400; +begin; +let $i = 10; while ($i) { INSERT INTO t1 values(NULL, substring(MD5(RAND()), -128)); dec $i; } -commit; -set autocommit=1; ---enable_warnings ---enable_query_log INSERT INTO t2 select * from t1; INSERT INTO t3 select * from t1; INSERT INTO t4 select * from t1; +commit; +--enable_warnings +--enable_query_log SET GLOBAL innodb_encrypt_tables = on; @@ -60,7 +56,7 @@ while ($cnt) } if (!$success) { - SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; + SELECT NAME,ENCRYPTION_SHCEME,MIN_KEY_VERSION, ROTATING_OR_FLUSHING FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; SHOW STATUS LIKE 'innodb_encryption%'; -- die Timeout waiting for encryption threads } @@ -90,7 +86,7 @@ while ($cnt) } if (!$success) { - SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; + SELECT NAME,ENCRYPTION_SHCEME,MIN_KEY_VERSION, ROTATING_OR_FLUSHING FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; SHOW STATUS LIKE 'innodb_encryption%'; -- die Timeout waiting for encryption threads } @@ -119,7 +115,7 @@ while ($cnt) } if (!$success) { - SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; + SELECT NAME,ENCRYPTION_SHCEME,MIN_KEY_VERSION, ROTATING_OR_FLUSHING FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION; SHOW STATUS LIKE 'innodb_encryption%'; -- die Timeout waiting for encryption threads } @@ -131,15 +127,16 @@ SELECT COUNT(1) FROM t3; SELECT COUNT(1) FROM t4; SELECT COUNT(1) FROM t5; +drop table t1,t2,t3,t4, t5; + # reset system --disable_query_log -EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; +--disable_warnings EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables; EVAL SET GLOBAL innodb_encryption_threads = $threads; +EVAL set GLOBAL innodb_default_encryption_key_id = $key_id; +--enable_warnings --enable_query_log -drop table t1,t2,t3,t4, t5; - -set GLOBAL innodb_default_encryption_key_id=1; -- cgit v1.2.1 From 6668da22167fbefdd8ae462a64eb986a6e9f1e08 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 16 Feb 2018 13:44:24 +0400 Subject: MDEV-15289 Binding an out-of-range DATETIME value in binary protocol breaks replication --- .../r/binlog_stm_datetime_ranges_mdev15289.result | 19 ++++ .../t/binlog_stm_datetime_ranges_mdev15289.test | 7 ++ sql/item.cc | 2 +- tests/mysql_client_test.c | 114 +++++++++++++++++++++ 4 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/binlog/r/binlog_stm_datetime_ranges_mdev15289.result create mode 100644 mysql-test/suite/binlog/t/binlog_stm_datetime_ranges_mdev15289.test diff --git a/mysql-test/suite/binlog/r/binlog_stm_datetime_ranges_mdev15289.result b/mysql-test/suite/binlog/r/binlog_stm_datetime_ranges_mdev15289.result new file mode 100644 index 00000000000..0c3e72133b8 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_stm_datetime_ranges_mdev15289.result @@ -0,0 +1,19 @@ +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE IF NOT EXISTS client_test_db +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `client_test_db`; create or replace table t1 (t time, d date, dt datetime,ts timestamp) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `client_test_db`; INSERT INTO t1 VALUES (TIMESTAMP'0000-00-00 00:00:00', TIMESTAMP'0000-00-00 00:00:00', TIMESTAMP'0000-00-00 00:00:00', TIMESTAMP'0000-00-00 00:00:00') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `client_test_db`; INSERT INTO t1 VALUES (DATE'0000-00-00', DATE'0000-00-00', DATE'0000-00-00', DATE'0000-00-00') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `client_test_db`; INSERT INTO t1 VALUES (TIME'00:00:00', TIME'00:00:00', TIME'00:00:00', TIME'00:00:00') +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `client_test_db`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # DROP DATABASE IF EXISTS client_test_db diff --git a/mysql-test/suite/binlog/t/binlog_stm_datetime_ranges_mdev15289.test b/mysql-test/suite/binlog/t/binlog_stm_datetime_ranges_mdev15289.test new file mode 100644 index 00000000000..ae4cab62fec --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_stm_datetime_ranges_mdev15289.test @@ -0,0 +1,7 @@ +--source include/not_embedded.inc +--source include/have_binlog_format_statement.inc + +--exec $MYSQL_CLIENT_TEST test_datetime_ranges_mdev15289 > $MYSQLTEST_VARDIR/log/binlog_stm_datetime_ranges_mysql_client_test.out.log 2>&1 + +--let $binlog_file = LAST +source include/show_binlog_events.inc; diff --git a/sql/item.cc b/sql/item.cc index 03949c1ceef..67cf5b3da21 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3562,7 +3562,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type, ErrConvTime str(&value.time); make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, &str, time_type, 0); - set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR); + set_zero_time(&value.time, time_type); } maybe_null= 0; null_value= 0; diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 1124a29e6b9..741e1e53532 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -12333,6 +12333,119 @@ static void test_datetime_ranges() } +/* + This test is used in: + mysql-test/suite/binlog/binlog_stm_datetime_ranges_mdev15289.test +*/ +static void test_datetime_ranges_mdev15289() +{ + const char *stmt_text; + int rc, i; + MYSQL_STMT *stmt; + MYSQL_BIND my_bind[4]; + MYSQL_TIME tm[4]; + + myheader("test_datetime_ranges_mdev15289"); + + stmt_text= "SET sql_mode=''"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt_text= "create or replace table t1 " + "(t time, d date, dt datetime,ts timestamp)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 VALUES (?, ?, ?, ?)"); + check_stmt(stmt); + verify_param_count(stmt, 4); + + /*** Testing DATETIME ***/ + bzero((char*) my_bind, sizeof(my_bind)); + for (i= 0; i < 4; i++) + { + my_bind[i].buffer_type= MYSQL_TYPE_DATETIME; + my_bind[i].buffer= &tm[i]; + } + rc= mysql_stmt_bind_param(stmt, my_bind); + check_execute(stmt, rc); + + /* Notice bad year */ + tm[0].year= 20010; tm[0].month= 1; tm[0].day= 2; + tm[0].hour= 03; tm[0].minute= 04; tm[0].second= 05; + tm[0].second_part= 0; tm[0].neg= 0; + tm[0].time_type= MYSQL_TIMESTAMP_DATETIME; + tm[3]= tm[2]= tm[1]= tm[0]; + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + my_process_warnings(mysql, 4); + + verify_col_data("t1", "t", "00:00:00"); + verify_col_data("t1", "d", "0000-00-00"); + verify_col_data("t1", "dt", "0000-00-00 00:00:00"); + verify_col_data("t1", "ts", "0000-00-00 00:00:00"); + + /*** Testing DATE ***/ + bzero((char*) my_bind, sizeof(my_bind)); + for (i= 0; i < 4; i++) + { + my_bind[i].buffer_type= MYSQL_TYPE_DATE; + my_bind[i].buffer= &tm[i]; + } + rc= mysql_stmt_bind_param(stmt, my_bind); + check_execute(stmt, rc); + + /* Notice bad year */ + tm[0].year= 20010; tm[0].month= 1; tm[0].day= 2; + tm[0].hour= 00; tm[0].minute= 00; tm[0].second= 00; + tm[0].second_part= 0; tm[0].neg= 0; + tm[0].time_type= MYSQL_TIMESTAMP_DATE; + tm[3]= tm[2]= tm[1]= tm[0]; + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + my_process_warnings(mysql, 4); + + verify_col_data("t1", "t", "00:00:00"); + verify_col_data("t1", "d", "0000-00-00"); + verify_col_data("t1", "dt", "0000-00-00 00:00:00"); + verify_col_data("t1", "ts", "0000-00-00 00:00:00"); + + /*** Testing TIME ***/ + bzero((char*) my_bind, sizeof(my_bind)); + for (i= 0; i < 4; i++) + { + my_bind[i].buffer_type= MYSQL_TYPE_TIME; + my_bind[i].buffer= &tm[i]; + } + rc= mysql_stmt_bind_param(stmt, my_bind); + check_execute(stmt, rc); + + /* Notice bad hour */ + tm[0].year= 0; tm[0].month= 0; tm[0].day= 0; + tm[0].hour= 100; tm[0].minute= 64; tm[0].second= 05; + tm[0].second_part= 0; tm[0].neg= 0; + tm[0].time_type= MYSQL_TIMESTAMP_TIME; + tm[3]= tm[2]= tm[1]= tm[0]; + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + my_process_warnings(mysql, 4); + + verify_col_data("t1", "t", "00:00:00"); + verify_col_data("t1", "d", "0000-00-00"); + verify_col_data("t1", "dt", "0000-00-00 00:00:00"); + verify_col_data("t1", "ts", "0000-00-00 00:00:00"); + + mysql_stmt_close(stmt); + + stmt_text= "drop table t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); +} + + static void test_bug4172() { MYSQL_STMT *stmt; @@ -19714,6 +19827,7 @@ static struct my_tests_st my_tests[]= { { "test_bug6081", test_bug6081 }, { "test_bug6096", test_bug6096 }, { "test_datetime_ranges", test_datetime_ranges }, + { "test_datetime_ranges_mdev15289", test_datetime_ranges_mdev15289 }, { "test_bug4172", test_bug4172 }, { "test_conversion", test_conversion }, { "test_rewind", test_rewind }, -- cgit v1.2.1 From a351f40cba21244b8b6c2d8b86631407abd62dd9 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 16 Feb 2018 14:14:43 +0400 Subject: MDEV-14541 - Workaround GCC ICE on ARM64 --- storage/mroonga/vendor/groonga/lib/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt index 6765261feb7..2274e95aa24 100644 --- a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt +++ b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt @@ -177,3 +177,8 @@ if(GRN_WITH_MRUBY) FILES ${EXPRESSION_TREE_RUBY_SCRIPTS} DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}/expression_tree") endif() + +# Workaround GCC ICE on ARM64 +IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + ADD_COMPILE_FLAGS(ts/ts_expr_node.c COMPILE_FLAGS "-fno-tree-loop-vectorize") +ENDIF() -- cgit v1.2.1 From 8bf2c08d5493a60f58aff9bd0f91a266dcce3e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 16 Feb 2018 21:02:35 +0200 Subject: Add a suppression for background page read error --- mysql-test/suite/encryption/r/innodb-missing-key.result | 1 + mysql-test/suite/encryption/t/innodb-missing-key.test | 1 + 2 files changed, 2 insertions(+) diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index 3eb48409f13..b3627cb17b7 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Start server with keys2.txt CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test index 8091d23cf1c..87c617c7aed 100644 --- a/mysql-test/suite/encryption/t/innodb-missing-key.test +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -8,6 +8,7 @@ # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); --echo # Start server with keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- cgit v1.2.1 From 9a46d971495e17664082409e7def042f66b5f88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 17 Feb 2018 14:20:33 +0200 Subject: MDEV-15333 MariaDB (still) slow start This performance regression was introduced in the MariaDB 10.1 file format incompatibility bug fix MDEV-11623 (MariaDB 10.1.21 and MariaDB 10.2.4) and partially fixed in MariaDB 10.1.25 in MDEV-12610 without adding a regression test case. On a normal startup (without crash recovery), InnoDB should not read every .ibd data file, because this is slow. Like in MySQL, for now, InnoDB will still open every data file (without reading), and it will read every .ibd file for which an .isl file exists, or the DATA DIRECTORY attribute has been specified for the table. The test case shuts down InnoDB, moves data files, replaces them with garbage, and then restarts InnoDB, expecting no messages to be issued for the garbage files. (Some messages will for now be issued for the table that uses the DATA DIRECTORY attribute.) Finally, the test shuts down the server, restores the old data files, and restarts again to drop the tables. fil_open_single_table_tablespace(): Remove the condition on flags, and only call fsp_flags_try_adjust() if validate==true (reading the first page has been requested). The only caller with validate==false is at server startup when we are processing all records from SYS_TABLES. The flags passed to this function are actually derived from SYS_TABLES.TYPE and SYS_TABLES.N_COLS, and there never was any problem with SYS_TABLES in MariaDB 10.1. The problem that MDEV-11623 was that incorrect tablespace flags were computed and written to FSP_SPACE_FLAGS. --- mysql-test/suite/innodb/r/restart.result | 26 +++++++++++ mysql-test/suite/innodb/t/restart.test | 78 ++++++++++++++++++++++++++++++++ storage/innobase/fil/fil0fil.cc | 14 +----- storage/xtradb/fil/fil0fil.cc | 12 +---- 4 files changed, 107 insertions(+), 23 deletions(-) create mode 100644 mysql-test/suite/innodb/r/restart.result create mode 100644 mysql-test/suite/innodb/t/restart.test diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result new file mode 100644 index 00000000000..5ebd6753e8a --- /dev/null +++ b/mysql-test/suite/innodb/r/restart.result @@ -0,0 +1,26 @@ +SET GLOBAL innodb_file_format=Barracuda; +SET GLOBAL innodb_file_per_table=1; +# +# MDEV-15333 MariaDB (still) slow start +# +# FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files +# of tables with .isl file or DATA DIRECTORY attribute. +call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in tablespace 2048948345"); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Error invalid tablespace flags in file '.*td\\.ibd'"); +CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT +PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; +CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC +STATS_PERSISTENT=0 DATA DIRECTORY='MYSQL_TMP_DIR'; +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +COUNT(*) +1 +SELECT * FROM tr; +a +SELECT * FROM tc; +a +SELECT * FROM td; +a +DROP TABLE tr,tc,td; diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test new file mode 100644 index 00000000000..242a03400ff --- /dev/null +++ b/mysql-test/suite/innodb/t/restart.test @@ -0,0 +1,78 @@ +--source include/innodb_page_size.inc +--source include/not_embedded.inc + +let datadir= `select @@datadir`; +let page_size= `select @@innodb_page_size`; + +SET GLOBAL innodb_file_format=Barracuda; +SET GLOBAL innodb_file_per_table=1; + +--echo # +--echo # MDEV-15333 MariaDB (still) slow start +--echo # + +# Ensure that on normal startup, no data files are read. +# Note: just like in MySQL, all .ibd files will still be +# opened at least once. + +--echo # FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files +--echo # of tables with .isl file or DATA DIRECTORY attribute. +call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in tablespace 2048948345"); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Error invalid tablespace flags in file '.*td\\.ibd'"); + +CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT; +CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT +PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9; +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC +STATS_PERSISTENT=0 DATA DIRECTORY='$MYSQL_TMP_DIR'; + +--source include/shutdown_mysqld.inc + +--move_file $datadir/test/tr.ibd $datadir/test/tr0.ibd +--move_file $datadir/test/tc.ibd $datadir/test/tc0.ibd +--move_file $MYSQL_TMP_DIR/test/td.ibd $datadir/test/td0.ibd +# TODO: test that MariaDB does not even attempt to open the files +#--mkdir $datadir/test/tr.ibd +#--mkdir $datadir/test/tc.ibd +#--mkdir $MYSQL_TMP_DIR/test/td.ibd + +perl; +die unless open OUT, ">", "$ENV{datadir}/test/tr.ibd"; +print OUT "foo " x $ENV{page_size}; +close OUT or die; +die unless open OUT, ">", "$ENV{datadir}/test/tc.ibd"; +print OUT "bar " x $ENV{page_size}; +close OUT or die; +die unless open OUT, ">", "$ENV{MYSQL_TMP_DIR}/test/td.ibd"; +print OUT "xyz " x $ENV{page_size}; +close OUT or die; +EOF + +--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup +--source include/start_mysqld.inc +--let $restart_parameters= + +SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES +WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); + +--source include/shutdown_mysqld.inc + +# TODO: test that MariaDB does not even attempt to open the files +#--rmdir $datadir/test/tr.ibd +#--rmdir $datadir/test/tc.ibd +#--rmdir $MYSQL_TMP_DIR/test/td.ibd +--remove_file $datadir/test/tr.ibd +--remove_file $datadir/test/tc.ibd +--remove_file $MYSQL_TMP_DIR/test/td.ibd + +--move_file $datadir/test/tr0.ibd $datadir/test/tr.ibd +--move_file $datadir/test/tc0.ibd $datadir/test/tc.ibd +--move_file $datadir/test/td0.ibd $MYSQL_TMP_DIR/test/td.ibd + +--source include/start_mysqld.inc +SELECT * FROM tr; +SELECT * FROM tc; +SELECT * FROM td; +DROP TABLE tr,tc,td; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index b4102e48628..0cdbee09548 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 2018, 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 @@ -4278,17 +4278,7 @@ cleanup_and_exit: mem_free(def.filepath); - /* We need to check fsp flags when no errors has happened and - server was not started on read only mode and tablespace validation - was requested or flags contain other table options except - low order bits to FSP_FLAGS_POS_PAGE_SSIZE position. - Note that flag comparison is pessimistic. Adjust is required - only when flags contain buggy MariaDB 10.1.0 - - MariaDB 10.1.20 flags. */ - if (err == DB_SUCCESS - && !srv_read_only_mode - && (validate - || flags >= (1U << FSP_FLAGS_POS_PAGE_SSIZE))) { + if (err == DB_SUCCESS && validate && !srv_read_only_mode) { fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK); } diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 96902cd77ec..e3a5a351edf 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -4468,17 +4468,7 @@ cleanup_and_exit: mem_free(def.filepath); - /* We need to check fsp flags when no errors has happened and - server was not started on read only mode and tablespace validation - was requested or flags contain other table options except - low order bits to FSP_FLAGS_POS_PAGE_SSIZE position. - Note that flag comparison is pessimistic. Adjust is required - only when flags contain buggy MariaDB 10.1.0 - - MariaDB 10.1.20 flags. */ - if (err == DB_SUCCESS - && !srv_read_only_mode - && (validate - || flags >= (1U << FSP_FLAGS_POS_PAGE_SSIZE))) { + if (err == DB_SUCCESS && validate && !srv_read_only_mode) { fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK); } -- cgit v1.2.1 From fed51b80fb434bebfe240b4d11ccffed945b7c7e Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Sat, 17 Feb 2018 19:16:56 +0400 Subject: Adding "const" qualifier to the MYSQL_TIME parameter of Item_temporal_literal constructors --- sql/item.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sql/item.h b/sql/item.h index 951f7a19207..e045a2a30bf 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4163,13 +4163,14 @@ public: Constructor for Item_date_literal. @param ltime DATE value. */ - Item_temporal_literal(THD *thd, MYSQL_TIME *ltime): Item_basic_constant(thd) + Item_temporal_literal(THD *thd, const MYSQL_TIME *ltime) + :Item_basic_constant(thd) { collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII); decimals= 0; cached_time= *ltime; } - Item_temporal_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg): + Item_temporal_literal(THD *thd, const MYSQL_TIME *ltime, uint dec_arg): Item_basic_constant(thd) { collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII); @@ -4205,7 +4206,7 @@ public: class Item_date_literal: public Item_temporal_literal { public: - Item_date_literal(THD *thd, MYSQL_TIME *ltime) + Item_date_literal(THD *thd, const MYSQL_TIME *ltime) :Item_temporal_literal(thd, ltime) { max_length= MAX_DATE_WIDTH; @@ -4234,7 +4235,7 @@ public: class Item_time_literal: public Item_temporal_literal { public: - Item_time_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg): + Item_time_literal(THD *thd, const MYSQL_TIME *ltime, uint dec_arg): Item_temporal_literal(thd, ltime, dec_arg) { max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0); @@ -4255,7 +4256,7 @@ public: class Item_datetime_literal: public Item_temporal_literal { public: - Item_datetime_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg): + Item_datetime_literal(THD *thd, const MYSQL_TIME *ltime, uint dec_arg): Item_temporal_literal(thd, ltime, dec_arg) { max_length= MAX_DATETIME_WIDTH + (decimals ? decimals + 1 : 0); @@ -4301,7 +4302,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal in sql_mode=TRADITIONAL. */ public: - Item_date_literal_for_invalid_dates(THD *thd, MYSQL_TIME *ltime) + Item_date_literal_for_invalid_dates(THD *thd, const MYSQL_TIME *ltime) :Item_date_literal(thd, ltime) { } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { @@ -4319,7 +4320,7 @@ class Item_datetime_literal_for_invalid_dates: public Item_datetime_literal { public: Item_datetime_literal_for_invalid_dates(THD *thd, - MYSQL_TIME *ltime, uint dec_arg) + const MYSQL_TIME *ltime, uint dec_arg) :Item_datetime_literal(thd, ltime, dec_arg) { } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { -- cgit v1.2.1 From 3c419fde5f22d68f1c60402f37b91cf771c305df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 19 Feb 2018 08:50:42 +0200 Subject: Cleanup after commit ac8e3c85a40467de0ffc908dd9c5214acf23b38a srv_conc_t::n_active: Correct the comment, and remove an assertion that trivially holds now that the type is unsigned. --- storage/innobase/srv/srv0conc.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc index 28eaca39af6..a1ffa8986a8 100644 --- a/storage/innobase/srv/srv0conc.cc +++ b/storage/innobase/srv/srv0conc.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2016, MariaDB Corporation. +Copyright (c) 2015, 2018, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -73,11 +73,7 @@ ulong srv_thread_concurrency = 0; struct srv_conc_t { char pad[CACHE_LINE_SIZE - (sizeof(ulint) + sizeof(lint))]; - /** Number of transactions that have declared_to_be_inside_innodb set. - It used to be a non-error for this value to drop below zero temporarily. - This is no longer true. We'll, however, keep the lint datatype to add - assertions to catch any corner cases that we may have missed. */ - + /** Number of transactions that have declared_to_be_inside_innodb */ ulint n_active; /** Number of OS threads waiting in the FIFO for permission to @@ -273,8 +269,6 @@ srv_conc_force_enter_innodb( return; } - ut_ad(srv_conc.n_active >= 0); - (void) my_atomic_addlint(&srv_conc.n_active, 1); trx->n_tickets_to_enter_innodb = 1; -- cgit v1.2.1 From 112cb56182d578d5e0a56a2c34c5b456dcc7e115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 19 Feb 2018 08:53:49 +0200 Subject: Add suppressions for background page read errors --- mysql-test/suite/encryption/r/innodb-bad-key-change.result | 1 + mysql-test/suite/encryption/r/innodb-bad-key-change2.result | 1 + mysql-test/suite/encryption/r/innodb-bad-key-change4.result | 1 + mysql-test/suite/encryption/r/innodb-compressed-blob.result | 1 + mysql-test/suite/encryption/r/innodb-encryption-disable.result | 1 + mysql-test/suite/encryption/r/innodb-force-corrupt.result | 1 + mysql-test/suite/encryption/r/innodb-redo-badkey.result | 1 + mysql-test/suite/encryption/r/innodb-redo-nokeys.result | 8 ++------ mysql-test/suite/encryption/t/innodb-bad-key-change.test | 1 + mysql-test/suite/encryption/t/innodb-bad-key-change2.test | 1 + mysql-test/suite/encryption/t/innodb-bad-key-change4.test | 1 + mysql-test/suite/encryption/t/innodb-compressed-blob.test | 1 + mysql-test/suite/encryption/t/innodb-encryption-disable.test | 1 + mysql-test/suite/encryption/t/innodb-force-corrupt.test | 1 + mysql-test/suite/encryption/t/innodb-redo-badkey.test | 1 + mysql-test/suite/encryption/t/innodb-redo-nokeys.test | 10 ++-------- 16 files changed, 18 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index b0f9dfe3e11..1b0fc58ea18 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -1,6 +1,7 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); # Start server with keys2.txt SET GLOBAL innodb_file_per_table = ON; diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result index b1f91c0d095..bd765671a0f 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\."); SET GLOBAL innodb_file_per_table = ON; diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result index 7f4b1fbc151..001720be9c6 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); SET GLOBAL innodb_file_per_table = ON; CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB diff --git a/mysql-test/suite/encryption/r/innodb-compressed-blob.result b/mysql-test/suite/encryption/r/innodb-compressed-blob.result index bf43e1b30d6..e156266edc6 100644 --- a/mysql-test/suite/encryption/r/innodb-compressed-blob.result +++ b/mysql-test/suite/encryption/r/innodb-compressed-blob.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); # Restart mysqld --file-key-management-filename=keys2.txt SET GLOBAL innodb_file_per_table = ON; diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result index 90668a3a395..4ccacd4293c 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); create table t5 ( `intcol1` int(32) DEFAULT NULL, diff --git a/mysql-test/suite/encryption/r/innodb-force-corrupt.result b/mysql-test/suite/encryption/r/innodb-force-corrupt.result index 67917ca5f82..6170b70cf63 100644 --- a/mysql-test/suite/encryption/r/innodb-force-corrupt.result +++ b/mysql-test/suite/encryption/r/innodb-force-corrupt.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; # Create and populate tables to be corrupted diff --git a/mysql-test/suite/encryption/r/innodb-redo-badkey.result b/mysql-test/suite/encryption/r/innodb-redo-badkey.result index ee803261b90..101edbf5fdc 100644 --- a/mysql-test/suite/encryption/r/innodb-redo-badkey.result +++ b/mysql-test/suite/encryption/r/innodb-redo-badkey.result @@ -1,6 +1,7 @@ call mtr.add_suppression("Plugin 'file_key_management'"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file .*test/t[1-4]\\.ibd cannot be decrypted"); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Unable to decompress .*.test.t1\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t1 page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\]"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); diff --git a/mysql-test/suite/encryption/r/innodb-redo-nokeys.result b/mysql-test/suite/encryption/r/innodb-redo-nokeys.result index dcbe1f5a395..251ea73cd4c 100644 --- a/mysql-test/suite/encryption/r/innodb-redo-nokeys.result +++ b/mysql-test/suite/encryption/r/innodb-redo-nokeys.result @@ -1,15 +1,11 @@ -call mtr.add_suppression("InnoDB: Block in space_id .*"); call mtr.add_suppression("mysqld: File .*"); call mtr.add_suppression("Plugin 'file_key_management' .*"); call mtr.add_suppression("InnoDB: cannot enable encryption, encryption plugin is not available"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t4 cannot be decrypted."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted."); +call mtr.add_suppression("InnoDB: The page \\[page id: space=[0-9]+, page number=[0-9]+\\] in file '.*test.t[1-4]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Restart mysqld --file-key-management-filename=keys2.txt -SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; create table t1(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=20; create table t2(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 48691fb19a2..79e5725e271 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -11,6 +11,7 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); --echo # Start server with keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test index 3c9e10efc90..1b742882765 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test @@ -9,6 +9,7 @@ # MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\."); diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test index a2305aa968b..982c57d90f0 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test @@ -8,6 +8,7 @@ # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.test b/mysql-test/suite/encryption/t/innodb-compressed-blob.test index 4f28f8e183d..695864db123 100644 --- a/mysql-test/suite/encryption/t/innodb-compressed-blob.test +++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.test @@ -5,6 +5,7 @@ -- source include/not_embedded.inc call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); --echo # Restart mysqld --file-key-management-filename=keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test index 8c72cf6a3b2..616d613742a 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test @@ -8,6 +8,7 @@ # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test index 4d3bfc2d1e9..aa3cacc8b01 100644 --- a/mysql-test/suite/encryption/t/innodb-force-corrupt.test +++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test @@ -8,6 +8,7 @@ -- source include/not_embedded.inc call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; diff --git a/mysql-test/suite/encryption/t/innodb-redo-badkey.test b/mysql-test/suite/encryption/t/innodb-redo-badkey.test index be8555584bb..70040f7b2de 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-badkey.test +++ b/mysql-test/suite/encryption/t/innodb-redo-badkey.test @@ -6,6 +6,7 @@ call mtr.add_suppression("Plugin 'file_key_management'"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file .*test/t[1-4]\\.ibd cannot be decrypted"); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Unable to decompress .*.test.t1\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]"); call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed file read of tablespace test/t1 page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\]"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); diff --git a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test index e55e2ade153..37565ab4827 100644 --- a/mysql-test/suite/encryption/t/innodb-redo-nokeys.test +++ b/mysql-test/suite/encryption/t/innodb-redo-nokeys.test @@ -3,25 +3,19 @@ # embedded does not support restart -- source include/not_embedded.inc -call mtr.add_suppression("InnoDB: Block in space_id .*"); call mtr.add_suppression("mysqld: File .*"); call mtr.add_suppression("Plugin 'file_key_management' .*"); call mtr.add_suppression("InnoDB: cannot enable encryption, encryption plugin is not available"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t2 cannot be decrypted."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t3 cannot be decrypted."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t4 cannot be decrypted."); -call mtr.add_suppression("InnoDB: The page \[page id: space=[0-9]+, page number=[0-9]+\] in file test/t1 cannot be decrypted."); +call mtr.add_suppression("InnoDB: The page \\[page id: space=[0-9]+, page number=[0-9]+\\] in file '.*test.t[1-4]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); --echo # Restart mysqld --file-key-management-filename=keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- source include/restart_mysqld.inc ---disable_warnings -SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_per_table = ON; ---enable_warnings create table t1(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed encrypted=yes encryption_key_id=20; create table t2(a int not null primary key auto_increment, c char(200), b blob, index(b(10))) engine=innodb row_format=compressed; -- cgit v1.2.1 From 06ba07c269bc4731bf571c12c5fc364b487b6086 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 19 Feb 2018 11:26:25 +0200 Subject: Test case for MDEV-12887 (bug fixed long ago) MDEV-12887 UT_LIST_GET_LEN(trx->lock.trx_locks) == 0 when mysqldump sequence --- mysql-test/suite/sql_sequence/mysqldump.result | 8 ++++++++ mysql-test/suite/sql_sequence/mysqldump.test | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/mysql-test/suite/sql_sequence/mysqldump.result b/mysql-test/suite/sql_sequence/mysqldump.result index 0067709db54..5a3711ebda3 100644 --- a/mysql-test/suite/sql_sequence/mysqldump.result +++ b/mysql-test/suite/sql_sequence/mysqldump.result @@ -39,3 +39,11 @@ CREATE TABLE `x1` ( /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO `x1` VALUES (1,1,9223372036854775806,1,1,1000,0,0); DROP TABLE a1,t1,x1; +set default_storage_engine=InnoDB; +create sequence t1; +LOCK TABLES t1 READ; +SELECT * FROM t1; +next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count +1 1 9223372036854775806 1 1 1000 0 0 +unlock tables; +drop table t1; diff --git a/mysql-test/suite/sql_sequence/mysqldump.test b/mysql-test/suite/sql_sequence/mysqldump.test index 8d5c2d0869d..308f06d5e8d 100644 --- a/mysql-test/suite/sql_sequence/mysqldump.test +++ b/mysql-test/suite/sql_sequence/mysqldump.test @@ -13,3 +13,14 @@ insert into t1 values (1),(2); CREATE SEQUENCE x1 engine=innodb; --exec $MYSQL_DUMP --compact test DROP TABLE a1,t1,x1; + +# +# MDEV-12887 UT_LIST_GET_LEN(trx->lock.trx_locks) == 0 when mysqldump sequence +# + +set default_storage_engine=InnoDB; +create sequence t1; +LOCK TABLES t1 READ; +SELECT * FROM t1; +unlock tables; +drop table t1; -- cgit v1.2.1 From ef3147b1d64b298486fc6f77f9e84b28a9d1c5b3 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 19 Feb 2018 11:27:21 +0200 Subject: Fix for MDEV-15105 (memory loss with LOCK sequence) MDEV 15105 "Bytes lost and Assertion `global_status_var.global_memory_used == 0' fails on shutdown after attempts to LOCK/RENAME sequence" --- mysql-test/suite/sql_sequence/rename.result | 6 ++++++ mysql-test/suite/sql_sequence/rename.test | 6 ++++++ sql/sql_sequence.cc | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/sql_sequence/rename.result create mode 100644 mysql-test/suite/sql_sequence/rename.test diff --git a/mysql-test/suite/sql_sequence/rename.result b/mysql-test/suite/sql_sequence/rename.result new file mode 100644 index 00000000000..26f529b57ef --- /dev/null +++ b/mysql-test/suite/sql_sequence/rename.result @@ -0,0 +1,6 @@ +CREATE SEQUENCE seq1; +RENAME TABLE seq1 TO seq2, seq3 TO seq4; +ERROR 42S02: Table 'test.seq3' doesn't exist +LOCK TABLE seq1 READ; +UNLOCK TABLES; +drop table seq1; diff --git a/mysql-test/suite/sql_sequence/rename.test b/mysql-test/suite/sql_sequence/rename.test new file mode 100644 index 00000000000..232a1bda5ea --- /dev/null +++ b/mysql-test/suite/sql_sequence/rename.test @@ -0,0 +1,6 @@ +CREATE SEQUENCE seq1; +--error ER_NO_SUCH_TABLE +RENAME TABLE seq1 TO seq2, seq3 TO seq4; +LOCK TABLE seq1 READ; +UNLOCK TABLES; +drop table seq1; diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 540b5cb7f09..720b347f445 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -439,7 +439,7 @@ int SEQUENCE::read_initial_values(TABLE *table) DBUG_ASSERT(table->reginfo.lock_type == TL_READ); if (!(error= read_stored_values(table))) initialized= SEQ_READY_TO_USE; - mysql_unlock_tables(thd, lock, 0); + mysql_unlock_tables(thd, lock); if (mdl_lock_used) thd->mdl_context.release_lock(mdl_request.ticket); -- cgit v1.2.1