1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge branch '10.11' into 11.4

This commit is contained in:
Oleksandr Byelkin
2025-04-26 10:53:02 +02:00
335 changed files with 7809 additions and 3256 deletions

View File

@ -31,7 +31,7 @@ ENDIF()
# in RPM's:
#set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0056 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135)
FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0056 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135 CMP0091)
IF(POLICY ${p})
CMAKE_POLICY(SET ${p} NEW)
ENDIF()

View File

@ -1,6 +1,42 @@
version: build-{build}~branch-{branch}
clone_depth: 1
clone_depth: 10
skip_branch_with_pr: true
before_build:
- ps: |
function Get-Remote-Ref($ref) {
try {
$result = git ls-remote origin $ref 2>$null
if (-not $result) {
"Warning: Could not fetch remote ref '$ref'"
return $null
}
return ($result -split "`t")[0]
} catch {
"Warning: Exception while running git ls-remote for '$ref': $_"
return $null
}
}
Get-ChildItem Env: | Where-Object { $_.Name -like 'APPVEYOR*COMMIT' } | ForEach-Object { "$($_.Name)=$($_.Value)" }
$commit = $env:APPVEYOR_REPO_COMMIT
$commit2 = $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT
$branch = $env:APPVEYOR_REPO_BRANCH
$latest = $null
$mainBranch = $branch -match '^(main|\d+\.\d+)$'
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null) {
"Branch build detected"
$latest = Get-Remote-Ref "refs/heads/$branch"
} else {
$pr = $env:APPVEYOR_PULL_REQUEST_NUMBER
$latest = Get-Remote-Ref "refs/pull/$pr/head"
$mainBranch = $False
"Pull Request build detected"
}
if ($latest -and ($commit -ne $latest) -and ($commit2 -ne $latest) -and (-not $mainBranch)) {
"Skipping outdated commit (latest is $latest)"
Exit-AppVeyorBuild
}
environment:
OPENSSL_ROOT_DIR: C:/OpenSSL-v32-Win64

View File

@ -162,7 +162,13 @@ static Server_gtid_event_filter *server_id_gtid_filter= NULL;
static char *start_datetime_str, *stop_datetime_str;
static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX;
static my_time_t last_processed_datetime= MY_TIME_T_MAX;
typedef struct _last_processed_ev_t
{
ulonglong position;
my_time_t datetime;
} last_processed_ev_t;
static last_processed_ev_t last_processed_ev= {0, MY_TIME_T_MAX};
static ulonglong rec_count= 0;
static MYSQL* mysql = NULL;
@ -1370,7 +1376,19 @@ err:
end:
rec_count++;
end_skip_count:
last_processed_datetime= ev_when;
/*
Update the last_processed_ev, unless the event is a fake event (i.e. format
description (ev pointer is reset to 0) or rotate event (ev->when is 0)), or
the event is encrypted (i.e. type is Unknown).
*/
if (ev &&
!(ev_type == UNKNOWN_EVENT &&
((Unknown_log_event *) ev)->what == Unknown_log_event::ENCRYPTED) &&
!(ev_type == ROTATE_EVENT && !ev->when))
{
last_processed_ev.position= pos + ev->data_written;
last_processed_ev.datetime= ev_when;
}
DBUG_PRINT("info", ("end event processing"));
/*
@ -2654,6 +2672,9 @@ static Exit_status handle_event_text_mode(PRINT_EVENT_INFO *print_event_info,
if (old_off != BIN_LOG_HEADER_SIZE)
*len= 1; // fake event, don't increment old_off
}
DBUG_ASSERT(old_off + ev->data_written == old_off + (*len - 1) ||
(*len == 1 &&
(type == ROTATE_EVENT || type == FORMAT_DESCRIPTION_EVENT)));
Exit_status retval= process_event(print_event_info, ev, old_off, logname);
if (retval != OK_CONTINUE)
DBUG_RETURN(retval);
@ -3028,6 +3049,8 @@ static Exit_status check_header(IO_CACHE* file,
the new one, so we should not do it ourselves in this
case.
*/
DBUG_ASSERT(tmp_pos + new_description_event->data_written ==
my_b_tell(file));
Exit_status retval= process_event(print_event_info,
new_description_event, tmp_pos,
logname);
@ -3181,20 +3204,17 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
}
// else read_error == 0 means EOF, that's OK, we break in this case
/*
Emit a warning in the event that we finished processing input
before reaching the boundary indicated by --stop-position.
*/
if (((longlong)stop_position != stop_position_default) &&
stop_position > my_b_tell(file))
{
retval = OK_STOP;
warning("Did not reach stop position %llu before "
"end of input", stop_position);
}
goto end;
}
/*
The real location that we have read up to in the file should align with
the size of the event, unless the event is encrypted.
*/
DBUG_ASSERT(
((ev->get_type_code() == UNKNOWN_EVENT &&
((Unknown_log_event *) ev)->what == Unknown_log_event::ENCRYPTED)) ||
old_off + ev->data_written == my_b_tell(file));
if ((retval= process_event(print_event_info, ev, old_off, logname)) !=
OK_CONTINUE)
goto end;
@ -3373,10 +3393,18 @@ int main(int argc, char** argv)
start_position= BIN_LOG_HEADER_SIZE;
}
/*
Emit a warning if we finished processing input before reaching the stop
boundaries indicated by --stop-datetime or --stop-position.
*/
if (stop_datetime != MY_TIME_T_MAX &&
stop_datetime > last_processed_datetime)
stop_datetime > last_processed_ev.datetime)
warning("Did not reach stop datetime '%s' before end of input",
stop_datetime_str);
if ((static_cast<longlong>(stop_position) != stop_position_default) &&
stop_position > last_processed_ev.position)
warning("Did not reach stop position %llu before end of input",
stop_position);
/*
If enable flashback, need to print the events from the end to the

View File

@ -265,7 +265,7 @@ IF(WITH_WSREP)
"galera-4" "rsync" "grep" "gawk" "iproute"
"coreutils" "findutils" "tar")
SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "lsof" "socat" "pv")
SETA(CPACK_RPM_test_PACKAGE_REQUIRES "socat")
SETA(CPACK_RPM_test_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}" "socat")
ENDIF()
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
@ -312,7 +312,7 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7")
ALTERNATIVE_NAME("server" "mariadb-server")
ALTERNATIVE_NAME("server" "mysql-compat-server")
ALTERNATIVE_NAME("test" "mariadb-test")
ELSEIF(RPM MATCHES "(rhel|centos|rocky)[89]")
ELSEIF(RPM MATCHES "(rhel|centos|rocky)")
SET(epoch 3:)
ALTERNATIVE_NAME("backup" "mariadb-backup")
ALTERNATIVE_NAME("client" "mariadb")

View File

@ -15,372 +15,212 @@
# This file includes Windows specific hacks, mostly around compiler flags
INCLUDE (CheckCSourceCompiles)
INCLUDE (CheckCXXSourceCompiles)
INCLUDE (CheckStructHasMember)
INCLUDE (CheckLibraryExists)
INCLUDE (CheckFunctionExists)
INCLUDE (CheckCSourceRuns)
INCLUDE (CheckSymbolExists)
INCLUDE (CheckTypeSize)
IF(MSVC)
IF(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL ARM64)
SET(MSVC_ARM64 1)
SET(MSVC_INTEL 0)
ELSE()
SET(MSVC_INTEL 1)
ENDIF()
ENDIF()
if(MSVC)
if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL ARM64)
set(MSVC_ARM64 1)
set(MSVC_INTEL 0)
else()
set(MSVC_INTEL 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CLANG_CL TRUE)
endif()
endif()
# 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
# a VC solution.
GET_FILENAME_COMPONENT(_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
INCLUDE(${_SCRIPT_DIR}/WindowsCache.cmake)
get_filename_component(_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
include(${_SCRIPT_DIR}/WindowsCache.cmake)
# OS display name (version_compile_os etc).
# Used by the test suite to ignore bugs on some platforms,
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
SET(SYSTEM_TYPE "Win64")
ELSE()
SET(SYSTEM_TYPE "Win32")
ENDIF()
# Used by the test suite to ignore bugs on some platforms
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SYSTEM_TYPE "Win64")
else()
set(SYSTEM_TYPE "Win32")
endif()
# Intel compiler is almost Visual C++
# (same compile flags etc). Set MSVC flag
IF(CMAKE_C_COMPILER MATCHES "icl")
SET(MSVC TRUE)
ENDIF()
function(find_asan_runtime result_list)
set(${result_list} "" PARENT_SCOPE)
if(CMAKE_C_COMPILER_VERSION)
set(CLANG_VERSION "${CMAKE_C_COMPILER_VERSION}")
else()
return()
endif()
IF(MSVC AND CMAKE_CXX_COMPILER_ID MATCHES Clang)
SET(CLANG_CL TRUE)
ENDIF()
get_filename_component(CLANG_BIN_DIR "${CMAKE_C_COMPILER}" DIRECTORY)
get_filename_component(LLVM_ROOT "${CLANG_BIN_DIR}" DIRECTORY)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0A00)
# We do not want the windows.h , or winsvc.h macros min/max
ADD_DEFINITIONS(-DNOMINMAX -DNOSERVICE)
# Speed up build process excluding unused header files
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
# Adjust compiler and linker flags
IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
# mininal architecture flags, i486 enables GCC atomics
ADD_DEFINITIONS(-march=i486)
ENDIF()
MACRO(ENABLE_SANITIZERS)
IF(NOT MSVC)
MESSAGE(FATAL_ERROR "clang-cl or MSVC necessary to enable asan/ubsan")
ENDIF()
# currently, asan is broken with static CRT.
IF(CLANG_CL AND NOT(MSVC_CRT_TYPE STREQUAL "/MD"))
SET(MSVC_CRT_TYPE "/MD" CACHE INTERNAL "" FORCE)
ENDIF()
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(ASAN_ARCH i386)
ELSE()
SET(ASAN_ARCH x86_64)
ENDIF()
# After installation, clang lib directory should be added to PATH
# (e.g C:/Program Files/LLVM/lib/clang/5.0.1/lib/windows)
SET(SANITIZER_LIBS)
SET(SANITIZER_LINK_LIBRARIES)
SET(SANITIZER_COMPILE_FLAGS)
IF(WITH_ASAN)
IF(CLANG_CL)
LIST(APPEND SANITIZER_LIBS
clang_rt.asan_dynamic-${ASAN_ARCH}.lib clang_rt.asan_dynamic_runtime_thunk-${ASAN_ARCH}.lib)
ENDIF()
STRING(APPEND SANITIZER_COMPILE_FLAGS " -fsanitize=address")
ENDIF()
IF(WITH_UBSAN)
STRING(APPEND SANITIZER_COMPILE_FLAGS " -fsanitize=undefined -fno-sanitize=alignment")
ENDIF()
FOREACH(lib ${SANITIZER_LIBS})
FIND_LIBRARY(${lib}_fullpath ${lib})
IF(NOT ${lib}_fullpath)
MESSAGE(FATAL_ERROR "Can't enable sanitizer : missing ${lib}")
ENDIF()
LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${${lib}_fullpath})
STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " \"${${lib}_fullpath}\" ")
STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " \"${${lib}_fullpath}\" ")
ENDFOREACH()
STRING(APPEND CMAKE_C_FLAGS ${SANITIZER_COMPILE_FLAGS})
STRING(APPEND CMAKE_CXX_FLAGS ${SANITIZER_COMPILE_FLAGS})
ENDMACRO()
IF(MSVC)
IF(MSVC_VERSION LESS 1920)
MESSAGE(FATAL_ERROR "Visual Studio 2019 or later is required")
ENDIF()
# Disable mingw based pkg-config found in Strawberry perl
SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "")
SET(MSVC_CRT_TYPE /MD CACHE STRING
"Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)"
# Determine target architecture
execute_process(
COMMAND "${CMAKE_C_COMPILER}" --version
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
SET(VALID_CRT_TYPES /MTd /MDd /MD /MT)
IF (NOT ";${VALID_CRT_TYPES};" MATCHES ";${MSVC_CRT_TYPE};")
MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ")
ENDIF()
# CMake version 3.15 and later uses CMAKE_MSVC_RUNTIME_LIBRARY
# variable for our MSVC_CRT_TYPE.
# Set CMAKE_MSVC_RUNTIME_LIBRARY and pass to external projects
# it is important to keep the same CRT type when linking
#
# Translation rules MSVC_CRT_TYPE -> CMAKE_MSVC_RUNTIME_LIBRARY
# /MT -> MultiThreaded
# /MTd -> MultiThreadedDebug
# /MD -> MultiThreadedDLL
# /MDd -> MultiThreadedDebugDLL
if(CLANG_VERSION_OUTPUT MATCHES "x86_64")
set(ARCH_SUFFIX "x86_64")
elseif(CLANG_VERSION_OUTPUT MATCHES "i686|i386")
set(ARCH_SUFFIX "i386")
elseif(CLANG_VERSION_OUTPUT MATCHES "aarch64")
set(ARCH_SUFFIX "aarch64")
else()
message(FATAL_ERROR "unknown arch")
endif()
SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
IF(MSVC_CRT_TYPE MATCHES "d$")
STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY Debug)
ENDIF()
IF(MSVC_CRT_TYPE MATCHES "D")
STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY DLL)
ENDIF()
string(REGEX MATCH "^[0-9]+" CLANG_MAJOR_VERSION "${CMAKE_C_COMPILER_VERSION}")
set(CLANG_VERSION_DIR "${LLVM_ROOT}/lib/clang/${CLANG_MAJOR_VERSION}")
IF(MSVC_CRT_TYPE MATCHES "/MD")
# Dynamic runtime (DLLs), need to install CRT libraries.
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE)
IF(MSVC_CRT_TYPE STREQUAL "/MDd")
SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
ENDIF()
INCLUDE(InstallRequiredSystemLibraries)
ENDIF()
IF(WITH_ASAN AND (NOT CLANG_CL))
SET(DYNAMIC_UCRT_LINK_DEFAULT OFF)
ELSE()
SET(DYNAMIC_UCRT_LINK_DEFAULT ON)
ENDIF()
OPTION(DYNAMIC_UCRT_LINK "Link Universal CRT dynamically, if MSVC_CRT_TYPE=/MT" ${DYNAMIC_UCRT_LINK_DEFAULT})
SET(DYNAMIC_UCRT_LINKER_OPTION " /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
# Enable debug info also in Release build,
# and create PDB to be able to analyze crashes.
FOREACH(type EXE SHARED MODULE)
SET(CMAKE_${type}_LINKER_FLAGS_RELEASE
"${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
SET(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL
"${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /debug")
ENDFOREACH()
# Force runtime libraries
# Compile with /Zi to get debugging information
FOREACH(lang C CXX)
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
ENDFOREACH()
FOREACH(flag
CMAKE_C_FLAGS CMAKE_CXX_FLAGS
CMAKE_C_FLAGS_INIT CMAKE_CXX_FLAGS_INIT
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
)
STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" )
STRING(REPLACE "/ZI " "/Zi " "${flag}" "${${flag}}")
IF((NOT "${${flag}}" MATCHES "/Zi") AND (NOT "${${flag}}" MATCHES "/Z7"))
STRING(APPEND ${flag} " /Zi")
ENDIF()
# Remove inlining flags, added by CMake, if any.
# Compiler default is fine.
STRING(REGEX REPLACE "/Ob[0-3]" "" "${flag}" "${${flag}}" )
ENDFOREACH()
# Allow to overwrite the inlining flag
SET(MSVC_INLINE "" CACHE STRING
"MSVC Inlining option, either empty, or one of /Ob0,/Ob1,/Ob2,/Ob3")
IF(MSVC_INLINE MATCHES "/Ob[0-3]")
ADD_COMPILE_OPTIONS(${MSVC_INLINE})
ELSEIF(NOT(MSVC_INLINE STREQUAL ""))
MESSAGE(FATAL_ERROR "Invalid option for MSVC_INLINE")
ENDIF()
IF(WITH_ASAN OR WITH_UBSAN)
# Workaround something Linux specific
SET(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE)
ENABLE_SANITIZERS()
ENDIF()
IF(CLANG_CL)
SET(CLANG_CL_FLAGS
"-Wno-unknown-warning-option -Wno-unused-private-field \
-Wno-unused-parameter -Wno-inconsistent-missing-override \
-Wno-unused-command-line-argument -Wno-pointer-sign \
-Wno-deprecated-register -Wno-missing-braces \
-Wno-unused-function -Wno-unused-local-typedef -msse4.2 "
)
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
STRING(APPEND CLANG_CL_FLAGS "-mpclmul ")
set(out)
foreach(name clang_rt.asan_dynamic-${ARCH_SUFFIX}.lib
clang_rt.asan_dynamic_runtime_thunk-${ARCH_SUFFIX}.lib)
set(path "${CLANG_VERSION_DIR}/lib/windows/${name}")
if(EXISTS "${path}")
list(APPEND out ${path})
else()
message(FATAL_ERROR "expected library ${path} not found")
ENDIF()
STRING(APPEND CMAKE_C_FLAGS " ${CLANG_CL_FLAGS} ${MSVC_CRT_TYPE}")
STRING(APPEND CMAKE_CXX_FLAGS " ${CLANG_CL_FLAGS} ${MSVC_CRT_TYPE}")
ENDIF()
endforeach()
set(${result_list} ${out} PARENT_SCOPE)
endfunction()
FOREACH(type EXE SHARED MODULE)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
IF(WITH_ASAN)
SET(build_types RELWITHDEBINFO DEBUG)
ELSE()
SET(build_types RELWITHDEBINFO)
ENDIF()
FOREACH(btype ${build_types})
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_${btype} "${CMAKE_${type}_LINKER_FLAGS_${btype}}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_${btype} "${CMAKE_${type}_LINKER_FLAGS_${btype}}")
ENDFOREACH()
IF(NOT CLANG_CL)
STRING(APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /release /OPT:REF,ICF")
ENDIF()
IF(DYNAMIC_UCRT_LINK AND (MSVC_CRT_TYPE STREQUAL "/MT"))
FOREACH(config RELEASE RELWITHDEBINFO DEBUG MINSIZEREL)
STRING(APPEND CMAKE_${type}_LINKER_FLAGS_${config} ${DYNAMIC_UCRT_LINKER_OPTION})
ENDFOREACH()
ENDIF()
ENDFOREACH()
macro(enable_sanitizers)
# Remove the runtime checks from the compiler flags
# ASAN does the same thing, in many cases better
foreach(lang C CXX)
foreach(suffix "_DEBUG" "_DEBUG_INIT")
string(REGEX REPLACE "/RTC[1su]" "" CMAKE_${lang}_FLAGS${suffix} "${CMAKE_${lang}_FLAGS${suffix}}")
endforeach()
endforeach()
if(WITH_ASAN)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/fsanitize=address>)
endif()
if(WITH_UBSAN)
include(CheckCCompilerFlag)
check_c_compiler_flag(/fsanitize=undefined HAVE_fsanitize_undefined)
if (HAVE_fsanitize_undefined)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/fsanitize=undefined>)
else()
message(FATAL_ERROR "UBSAN not supported by this compiler yet")
endif()
endif()
if(CLANG_CL)
find_asan_runtime(asan_libs)
foreach(lib ${asan_libs})
link_libraries(${lib})
string(APPEND CMAKE_C_STANDARD_LIBRARIES " \"${lib}\"")
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " \"${lib}\"")
endforeach()
else()
add_link_options(/INCREMENTAL:NO)
endif()
endmacro()
if(MSVC)
# Disable mingw based pkg-config found in Strawberry perl
set(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "")
if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
endif()
if(CMAKE_MSVC_RUNTIME_LIBRARY MATCHES "DLL")
# Dynamic runtime (DLLs), need to install CRT libraries.
set(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE)
if(CMAKE_MSVC_RUNTIME_LIBRARY STREQUAL "MultiThreadedDebugDLL")
set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
endif()
include(InstallRequiredSystemLibraries)
endif()
# Compile with /Zi to get debugging information
if (NOT DEFINED CMAKE_MSVC_DEBUG_INFORMATION_FORMAT)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase")
add_link_options(/DEBUG) # Ensure debugging info at link time
endif()
if(WITH_ASAN OR WITH_UBSAN)
# Workaround something Linux specific
set(SECURITY_HARDENED 0 CACHE INTERNAL "" FORCE)
enable_sanitizers()
endif()
add_compile_definitions(
_CRT_SECURE_NO_DEPRECATE
_CRT_NONSTDC_NO_WARNINGS
_WIN32_WINNT=0x0A00
# We do not want the windows.h , or winsvc.h macros min/max
NOMINMAX NOSERVICE
# Speed up build process excluding unused header files
WIN32_LEAN_AND_MEAN
)
if(CLANG_CL)
add_compile_options(
-Wno-unknown-warning-option
-Wno-unused-private-field
-Wno-unused-parameter
-Wno-inconsistent-missing-override
-Wno-unused-command-line-argument
-Wno-pointer-sign
-Wno-deprecated-register
-Wno-missing-braces
-Wno-unused-function
-Wno-unused-local-typedef
-Wno-microsoft-static-assert
-Wno-c++17-extensions
-msse4.2
)
if((CMAKE_SIZEOF_VOID_P MATCHES 8) AND MSVC_INTEL)
add_compile_options(-mpclmul)
endif()
endif()
# Mark 32 bit executables large address aware so they can
# use > 2GB address space
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
STRING(APPEND CMAKE_EXE_LINKER_FLAGS " /LARGEADDRESSAWARE")
ENDIF()
# Speed up multiprocessor build
IF (NOT CLANG_CL)
STRING(APPEND CMAKE_C_FLAGS " /MP")
STRING(APPEND CMAKE_CXX_FLAGS " /MP")
STRING(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " /Gw")
STRING(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Gw")
ENDIF()
#TODO: update the code and remove the disabled warnings
STRING(APPEND CMAKE_C_FLAGS " /we4700 /we4311 /we4477 /we4302 /we4090")
STRING(APPEND CMAKE_CXX_FLAGS " /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
IF(MSVC_VERSION GREATER 1910 AND NOT CLANG_CL)
STRING(APPEND CMAKE_CXX_FLAGS " /permissive-")
STRING(APPEND CMAKE_C_FLAGS " /diagnostics:caret")
STRING(APPEND CMAKE_CXX_FLAGS " /diagnostics:caret")
ENDIF()
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
STRING(APPEND CMAKE_C_FLAGS " /WX")
STRING(APPEND CMAKE_CXX_FLAGS " /WX")
FOREACH(type EXE SHARED MODULE)
FOREACH(cfg RELEASE DEBUG RELWITHDEBINFO)
SET(CMAKE_${type}_LINKER_FLAGS_${cfg} "${CMAKE_${type}_LINKER_FLAGS_${cfg}} /WX")
ENDFOREACH()
ENDFOREACH()
ENDIF()
if(CMAKE_SIZEOF_VOID_P MATCHES 4)
add_link_options(/LARGEADDRESSAWARE)
endif()
IF(FAST_BUILD)
STRING (REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSEIF (NOT CLANG_CL)
STRING(APPEND CMAKE_CXX_FLAGS_RELEASE " /d2OptimizeHugeFunctions")
STRING(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /d2OptimizeHugeFunctions")
ENDIF()
ADD_COMPILE_OPTIONS($<$<COMPILE_LANGUAGE:C,CXX>:/utf-8>)
ENDIF()
# RelWithDebInfo is deoptimized wrt inlining.
# Fix it to default
foreach(lang C CXX)
foreach(suffix "_RELWITHDEBINFO" "_RELWITHDEBINFO_INIT")
string(REGEX REPLACE "/Ob[0-1]" "" CMAKE_${lang}_FLAGS${suffix} "${CMAKE_${lang}_FLAGS${suffix}}")
endforeach()
endforeach()
# Always link with socket/synchronization libraries
STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " ws2_32.lib synchronization.lib")
STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib synchronization.lib")
if(NOT CLANG_CL)
add_link_options("$<$<CONFIG:Release,RelWithDebInfo>:/INCREMENTAL:NO;/RELEASE;/OPT:REF,ICF>")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:$<$<CONFIG:Release,RelWithDebInfo>:/Gw>>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/MP>)
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/we4099;/we4700;/we4311;/we4477;/we4302;/we4090>")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/permissive->)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/diagnostics:caret>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/utf-8>)
if(NOT FAST_BUILD)
add_compile_options($<$<CONFIG:Release,RelWithDebInfo>:$<$<COMPILE_LANGUAGE:C,CXX>:/d2OptimizeHugeFunctions>>)
endif()
endif()
# System checks
SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs
SET(HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1)
if(MYSQL_MAINTAINER_MODE MATCHES "ERR")
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
add_link_options(/WX)
endif()
endif()
# IPv6 constants appeared in Vista SDK first. We need to define them in any case if they are
# not in headers, to handle dual mode sockets correctly.
CHECK_SYMBOL_EXISTS(IPPROTO_IPV6 "winsock2.h" HAVE_IPPROTO_IPV6)
IF(NOT HAVE_IPPROTO_IPV6)
SET(HAVE_IPPROTO_IPV6 41)
ENDIF()
CHECK_SYMBOL_EXISTS(IPV6_V6ONLY "winsock2.h;ws2ipdef.h" HAVE_IPV6_V6ONLY)
IF(NOT HAVE_IPV6_V6ONLY)
SET(IPV6_V6ONLY 27)
ENDIF()
# avoid running system checks by using pre-cached check results
# system checks are expensive on VS generator
get_filename_component(_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
include(${_SCRIPT_DIR}/WindowsCache.cmake)
# Some standard functions exist there under different
# names (e.g popen is _popen or strok_r is _strtok_s)
# If a replacement function exists, HAVE_FUNCTION is
# defined to 1. CMake variable <function_name> will also
# be defined to the replacement name.
# So for example, CHECK_FUNCTION_REPLACEMENT(popen _popen)
# will define HAVE_POPEN to 1 and set variable named popen
# to _popen. If the header template, one needs to have
# cmakedefine popen @popen@ which will expand to
# define popen _popen after CONFIGURE_FILE
# this is out of place, not really a system check
set(FN_NO_CASE_SENSE 1)
set(USE_SYMDIR 1)
set(HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1)
MACRO(CHECK_FUNCTION_REPLACEMENT function replacement)
STRING(TOUPPER ${function} function_upper)
CHECK_FUNCTION_EXISTS(${function} HAVE_${function_upper})
IF(NOT HAVE_${function_upper})
CHECK_FUNCTION_EXISTS(${replacement} HAVE_${replacement})
IF(HAVE_${replacement})
SET(HAVE_${function_upper} 1 )
SET(${function} ${replacement})
ENDIF()
ENDIF()
ENDMACRO()
MACRO(CHECK_SYMBOL_REPLACEMENT symbol replacement header)
STRING(TOUPPER ${symbol} symbol_upper)
CHECK_SYMBOL_EXISTS(${symbol} ${header} HAVE_${symbol_upper})
IF(NOT HAVE_${symbol_upper})
CHECK_SYMBOL_EXISTS(${replacement} ${header} HAVE_${replacement})
IF(HAVE_${replacement})
SET(HAVE_${symbol_upper} 1)
SET(${symbol} ${replacement})
ENDIF()
ENDIF()
ENDMACRO()
CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h)
CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h)
CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h)
CHECK_FUNCTION_REPLACEMENT(popen _popen)
CHECK_FUNCTION_REPLACEMENT(pclose _pclose)
CHECK_FUNCTION_REPLACEMENT(access _access)
CHECK_FUNCTION_REPLACEMENT(strcasecmp _stricmp)
CHECK_FUNCTION_REPLACEMENT(strncasecmp _strnicmp)
CHECK_SYMBOL_REPLACEMENT(snprintf _snprintf stdio.h)
CHECK_FUNCTION_REPLACEMENT(strtok_r strtok_s)
CHECK_FUNCTION_REPLACEMENT(strtoll _strtoi64)
CHECK_FUNCTION_REPLACEMENT(strtoull _strtoui64)
CHECK_FUNCTION_REPLACEMENT(vsnprintf _vsnprintf)
CHECK_TYPE_SIZE(ssize_t SIZE_OF_SSIZE_T)
IF(NOT HAVE_SIZE_OF_SSIZE_T)
SET(ssize_t SSIZE_T)
ENDIF()
SET(FN_NO_CASE_SENSE 1)
SET(USE_SYMDIR 1)
# Force static C runtime for targets in current directory
# (useful to get rid of MFC dll's dependency, or in installer)
MACRO(FORCE_STATIC_CRT)
FOREACH(flag
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT
CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL
)
STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" )
STRING(REPLACE "${DYNAMIC_UCRT_LINKER_OPTION}" "" "${flag}" "${${flag}}")
ENDFOREACH()
ENDMACRO()

View File

@ -202,10 +202,10 @@ SET(HAVE_STRING_H 1 CACHE INTERNAL "")
SET(HAVE_STRNDUP CACHE INTERNAL "")
SET(HAVE_STRNLEN 1 CACHE INTERNAL "")
SET(HAVE_STRPBRK 1 CACHE INTERNAL "")
SET(HAVE_STRTOK_R CACHE INTERNAL "")
SET(HAVE_STRTOLL CACHE INTERNAL "")
SET(HAVE_STRTOK_R 1 CACHE INTERNAL "")
SET(HAVE_STRTOLL 1 CACHE INTERNAL "")
SET(HAVE_STRTOUL 1 CACHE INTERNAL "")
SET(HAVE_STRTOULL CACHE INTERNAL "")
SET(HAVE_STRTOULL 1 CACHE INTERNAL "")
SET(HAVE_SYNCH_H CACHE INTERNAL "")
SET(HAVE_SYSENT_H CACHE INTERNAL "")
SET(HAVE_SYS_DIR_H CACHE INTERNAL "")
@ -293,6 +293,7 @@ SET(HAVE_EVENT_H CACHE INTERNAL "")
SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "")
SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_GETATTR_NP CACHE INTERNAL "")
SET(HAVE_SOCKPEERCRED CACHE INTERNAL "")
SET(HAVE_ABI_CXA_DEMANGLE CACHE INTERNAL "")
SET(HAVE_GCC_C11_ATOMICS CACHE INTERNAL "")
@ -348,4 +349,16 @@ SET(HAVE_SYS_STATVFS_H CACHE INTERNAL "")
SET(HAVE_GETPAGESIZES CACHE INTERNAL "")
SET(HAVE_LINUX_LIMITS_H CACHE INTERNAL "")
SET(HAVE_FILE_UCONTEXT_H CACHE INTERNAL "")
SET(have_C__Werror CACHE INTERNAL "")
SET(HAVE_SIGNAL_H 1 CACHE INTERNAL "")
SET(HAVE_UINT CACHE INTERNAL "")
SET(HAVE_SOCKET_LEN_T CACHE INTERNAL "")
SET(HAVE_GETTHRID CACHE INTERNAL "")
SET(HAVE_THREAD_LOCAL 1 CACHE INTERNAL "")
SET(have_CXX__Wno_unused_but_set_variable CACHE INTERNAL "")
SET(HAVE_UNISTD_H CACHE INTERNAL "")
SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "")
SET(OFF64_T CACHE INTERNAL "")
SET(Z_HAVE_UNISTD_H CACHE INTERNAL "")
SET(HAVE_OFF64_T CACHE FALSE INTERNAL "")
ENDIF(MSVC)

View File

@ -214,6 +214,11 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES})
IF(WIN32)
# A popular library, turns out many plugins need it for gethostname()
TARGET_LINK_LIBRARIES (${target} ws2_32)
ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_OPTIONS(${target} PRIVATE "-Wl,-bE:${CMAKE_SOURCE_DIR}/libservices/mysqlservices_aix.def")
ENDIF()

View File

@ -401,38 +401,27 @@
#cmakedefine SIGNAL_WITH_VIO_CLOSE 1
/* Windows stuff, mostly functions, that have Posix analogs but named differently */
#cmakedefine S_IROTH @S_IROTH@
#cmakedefine S_IFIFO @S_IFIFO@
#cmakedefine IPPROTO_IPV6 @IPPROTO_IPV6@
#cmakedefine IPV6_V6ONLY @IPV6_V6ONLY@
#cmakedefine sigset_t @sigset_t@
#cmakedefine mode_t @mode_t@
#cmakedefine SIGQUIT @SIGQUIT@
#cmakedefine SIGPIPE @SIGPIPE@
#cmakedefine popen @popen@
#cmakedefine pclose @pclose@
#cmakedefine ssize_t @ssize_t@
#cmakedefine strcasecmp @strcasecmp@
#cmakedefine strncasecmp @strncasecmp@
#cmakedefine snprintf @snprintf@
#cmakedefine strtok_r @strtok_r@
#cmakedefine strtoll @strtoll@
#cmakedefine strtoull @strtoull@
#cmakedefine vsnprintf @vsnprintf@
#if defined(_MSC_VER) && (_MSC_VER > 1800)
#ifdef _WIN32
#define S_IROTH _S_IREAD
#define S_IFIFO _S_IFIFO
#define SIGQUIT SIGTERM
#define SIGPIPE SIGINT
#define sigset_t int
#define mode_t int
#define popen _popen
#define pclose _pclose
#define ssize_t SSIZE_T
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strtok_r strtok_s
#define tzname _tzname
#define P_tmpdir "C:\\TEMP"
#endif
#if defined(_MSC_VER) && (_MSC_VER > 1310)
# define HAVE_SETENV
#define setenv(a,b,c) _putenv_s(a,b)
#endif
#define PSAPI_VERSION 1 /* for GetProcessMemoryInfo() */
/* We don't want the min/max macros */
#ifdef _WIN32
#define HAVE_SETENV
#define NOMINMAX 1
#endif
#define PSAPI_VERSION 2 /* for GetProcessMemoryInfo() */
#endif /* _WIN32 */
/*
MySQL features

View File

@ -1791,11 +1791,6 @@ uint xb_client_options_count = array_elements(xb_client_options);
static const char *dbug_option;
#endif
#ifdef HAVE_URING
extern const char *io_uring_may_be_unsafe;
bool innodb_use_native_aio_default();
#endif
static my_bool innodb_log_checkpoint_now;
struct my_option xb_server_options[] =
@ -1943,12 +1938,7 @@ struct my_option xb_server_options[] =
"Use native AIO if supported on this platform.",
(G_PTR*) &srv_use_native_aio,
(G_PTR*) &srv_use_native_aio, 0, GET_BOOL, NO_ARG,
#ifdef HAVE_URING
innodb_use_native_aio_default(),
#else
TRUE,
#endif
0, 0, 0, 0, 0},
TRUE, 0, 0, 0, 0, 0},
{"innodb_page_size", OPT_INNODB_PAGE_SIZE,
"The universal page size of the database.",
(G_PTR*) &innobase_page_size, (G_PTR*) &innobase_page_size, 0,
@ -2527,12 +2517,8 @@ static bool innodb_init_param()
msg("InnoDB: Using Linux native AIO");
}
#elif defined(HAVE_URING)
if (!srv_use_native_aio) {
} else if (io_uring_may_be_unsafe) {
msg("InnoDB: Using liburing on this kernel %s may cause hangs;"
" see https://jira.mariadb.org/browse/MDEV-26674",
io_uring_may_be_unsafe);
} else {
if (srv_use_native_aio) {
msg("InnoDB: Using liburing");
}
#else
@ -2672,7 +2658,7 @@ static bool innodb_init()
}
recv_sys.lsn= log_sys.next_checkpoint_lsn=
log_sys.get_lsn() - SIZE_OF_FILE_CHECKPOINT;
log_get_lsn() - SIZE_OF_FILE_CHECKPOINT;
log_sys.set_latest_format(false); // not encrypted
log_hdr_init();
byte *b= &log_hdr_buf[log_t::START_OFFSET];

View File

@ -387,7 +387,7 @@ int json_find_paths_next(json_engine_t *je, json_find_paths_t *state);
Returns negative integer in the case of an error,
the length of the result otherwise.
*/
int json_unescape(CHARSET_INFO *json_cs,
int __attribute__((warn_unused_result)) json_unescape(CHARSET_INFO *json_cs,
const uchar *json_str, const uchar *json_end,
CHARSET_INFO *res_cs,
uchar *res, uchar *res_end);
@ -401,7 +401,8 @@ int json_unescape(CHARSET_INFO *json_cs,
JSON_ERROR_OUT_OF_SPACE Not enough space in the provided buffer
JSON_ERROR_ILLEGAL_SYMBOL Source symbol cannot be represented in JSON
*/
int json_escape(CHARSET_INFO *str_cs, const uchar *str, const uchar *str_end,
int __attribute__((warn_unused_result)) json_escape(CHARSET_INFO *str_cs,
const uchar *str, const uchar *str_end,
CHARSET_INFO *json_cs, uchar *json, uchar *json_end);

View File

@ -220,7 +220,10 @@ enum ha_extra_function {
/** Start writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_BEGIN_ALTER_COPY,
/** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_END_ALTER_COPY
HA_EXTRA_END_ALTER_COPY,
/** Abort of writing rows during ALTER TABLE..ALGORITHM=COPY or
CREATE..SELCT */
HA_EXTRA_ABORT_ALTER_COPY
};
/* Compatible option, to be deleted in 6.0 */

View File

@ -38,6 +38,8 @@ static inline void *my_get_stack_pointer(void *default_stack)
#if defined(__GNUC__) || defined(__clang__) /* GCC and Clang compilers */
#if defined(__i386__) /* Intel x86 (32-bit) */
__asm__ volatile ("movl %%esp, %0" : "=r" (stack_ptr));
#elif defined(__x86_64__) && defined (__ILP32__) /* Intel x86-64 (64-bit), X32 ABI */
__asm__ volatile ("movl %%esp, %0" : "=r" (stack_ptr));
#elif defined(__x86_64__) /* Intel x86-64 (64-bit) */
__asm__ volatile ("movq %%rsp, %0" : "=r" (stack_ptr));
#elif defined(__powerpc__) /* PowerPC (32-bit) */

View File

@ -138,6 +138,7 @@ sub new {
my $error = delete($opts{'error'});
my $verbose = delete($opts{'verbose'}) || $::opt_verbose;
my $nocore = delete($opts{'nocore'});
my $open_files_limit = delete($opts{'open_files_limit'});
my $host = delete($opts{'host'});
my $shutdown = delete($opts{'shutdown'});
my $user_data= delete($opts{'user_data'});
@ -161,6 +162,8 @@ sub new {
push(@safe_args, "--verbose") if $verbose > 0;
push(@safe_args, "--nocore") if $nocore;
push(@safe_args, "--open-files-limit=$open_files_limit") if $open_files_limit;
# Point the safe_process at the right parent if running on cygwin
push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;

View File

@ -220,6 +220,7 @@ int main(int argc, char* const argv[] )
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
bool nocore = false;
int open_files_limit = 1024;
struct sigaction sa,sa_abort;
sa.sa_handler= handle_signal;
@ -268,7 +269,14 @@ int main(int argc, char* const argv[] )
}
else if ( strncmp (arg, "--env ", 6) == 0 )
{
putenv(strdup(arg+6));
putenv(strdup(arg+6));
}
else if ( strncmp(arg, "--open-files-limit=", 19) == 0 )
{
const char* start = arg + 19;
open_files_limit = atoi(start);
if (open_files_limit <= 0)
die("Invalid value '%s' passed to --open-files-limit", start);
}
else
die("Unknown option: %s", arg);
@ -318,11 +326,8 @@ int main(int argc, char* const argv[] )
if (nocore)
setlimit(RLIMIT_CORE, 0, 0);
/*
mysqld defaults depend on that. make test results stable and independent
from the environment
*/
setlimit(RLIMIT_NOFILE, 1024, 1024);
// Set open files limit
setlimit(RLIMIT_NOFILE, open_files_limit, open_files_limit);
// Signal that child is ready
buf= 37;

View File

@ -12926,9 +12926,8 @@ SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL;
EXPLAIN INSERT INTO t1
SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 144 Using where
2 DERIVED <derived4> ALL NULL NULL NULL NULL 12
2 DERIVED t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 12 Using temporary
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
4 DERIVED t1 ALL NULL NULL NULL NULL 12
EXPLAIN FORMAT=JSON INSERT INTO t1
SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL;
@ -12937,71 +12936,54 @@ EXPLAIN
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"loops": 1,
"rows": 144,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t.f is not null",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived4>",
"access_type": "ALL",
"loops": 1,
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 4,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100
}
}
]
}
}
}
},
{
"block-nl-join": {
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "<derived4>",
"access_type": "ALL",
"loops": 1,
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 4,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 12,
"loops": 1,
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f is not null"
},
"buffer_type": "flat",
"buffer_size": "64",
"join_type": "BNL"
"filtered": 100
}
}
}
]
]
}
}
}
},
{
"block-nl-join": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 12,
"rows": 12,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f is not null"
},
"buffer_type": "flat",
"buffer_size": "64",
"join_type": "BNL"
}
}
}
]
]
}
}
}
SELECT * FROM t1;
@ -13031,72 +13013,55 @@ EXPLAIN
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "<derived2>",
"access_type": "ALL",
"loops": 1,
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t.f is not null",
"materialized": {
"query_block": {
"select_id": 2,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f is not null"
}
},
{
"table": {
"table_name": "<derived4>",
"access_type": "ref",
"possible_keys": ["key0"],
"key": "key0",
"key_length": "4",
"used_key_parts": ["f"],
"ref": ["test.t1.f"],
"loops": 8,
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 4,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f is not null"
}
}
]
}
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f is not null"
}
},
{
"table": {
"table_name": "<derived4>",
"access_type": "ref",
"possible_keys": ["key0"],
"key": "key0",
"key_length": "4",
"used_key_parts": ["f"],
"ref": ["test.t1.f"],
"loops": 8,
"rows": 1,
"cost": "COST_REPLACED",
"filtered": 100,
"materialized": {
"query_block": {
"select_id": 4,
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 8,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f is not null"
}
}
}
]
]
}
}
}
}
}
]
]
}
}
}
SELECT * FROM t1;
@ -23639,6 +23604,27 @@ FROM cte2
GROUP BY 1 ;
( SELECT 1 FROM ( SELECT 1 FROM cte1) dt GROUP BY x HAVING x= 1 )
1
create table t1 (f int);
create view v1 as select f, count(*) c from t1 group by f;
#
# MDEV-25012 Server crash in find_field_in_tables, Assertion `name' failed in find_field_in_table_ref
#
select * from v1 where export_set(1, default(f), 'x', aes_decrypt('secret', f));
f c
show warnings;
Level Code Message
drop view v1;
drop table t1;
create table t(c3 longtext) ;
with cte1 as
(
select default(c3) as a
from t group by 1
)
select * from cte1
where cte1.a >= 1;
a
drop table t;
# End of 10.5 tests
#
# MDEV-28958: condition pushable into view after simplification

View File

@ -4471,6 +4471,28 @@ SELECT
FROM cte2
GROUP BY 1 ;
create table t1 (f int);
create view v1 as select f, count(*) c from t1 group by f;
--echo #
--echo # MDEV-25012 Server crash in find_field_in_tables, Assertion `name' failed in find_field_in_table_ref
--echo #
select * from v1 where export_set(1, default(f), 'x', aes_decrypt('secret', f));
show warnings;
# cleanup
drop view v1;
drop table t1;
create table t(c3 longtext) ;
with cte1 as
(
select default(c3) as a
from t group by 1
)
select * from cte1
where cte1.a >= 1;
drop table t;
--echo # End of 10.5 tests
--echo #

View File

@ -2524,6 +2524,8 @@ SELECT * FROM t1;
a
1
1
1
1
drop table t1,t2;
set optimizer_switch=@save968720_optimizer_switch;
#

View File

@ -1766,6 +1766,43 @@ FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;
data
<root language="de"></root>
#
# MDEV-35614 JSON_UNQUOTE doesn't work with emojis
#
SELECT HEX(JSON_UNQUOTE('"\\ud83d\\ude0a"')) as hex_smiley;
hex_smiley
F09F988A
set names utf8mb4;
SELECT JSON_UNQUOTE('"\\ud83d\\ude0a"') as smiley;
smiley
😊
SELECT JSON_UNQUOTE('"\\ud83d\\ude0a"') = JSON_UNQUOTE('"\\ud83d\\ude0a"') as equal_smileys;
equal_smileys
1
SELECT JSON_UNQUOTE('"\\ud83d\\ude0a"') <= JSON_UNQUOTE('"\\ud83d\\ude0a"') as less_or_equal_smileys;
less_or_equal_smileys
1
set @v='{ "color":"😊" }';
select @v as v, collation(@v) as collation_v;
v collation_v
{ "color":"😊" } utf8mb4_general_ci
select json_valid(@v) as valid;
valid
1
select json_extract(@v,'$.color') as color_extraction, collation(json_extract(@v,'$.color')) as color_extraction_collation;
color_extraction color_extraction_collation
"😊" utf8mb4_general_ci
select json_unquote(json_extract(@v,'$.color')) as unquoted, collation(json_unquote(json_extract(@v,'$.color'))) as unquoted_collation;
unquoted unquoted_collation
😊 utf8mb4_bin
SELECT JSON_UNQUOTE('"\\uc080\\ude0a"') as invalid_utf8mb4;
invalid_utf8mb4
"\uc080\ude0a"
Warnings:
Warning 4035 Broken JSON string in argument 1 to function 'json_unquote' at position 13
show warnings;
Level Code Message
Warning 4035 Broken JSON string in argument 1 to function 'json_unquote' at position 13
#
# End of 10.6 tests
#
#

View File

@ -1196,6 +1196,7 @@ SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a');
SET @@collation_connection= @save_collation_connection;
--echo #
--echo # End of 10.5 tests
--echo #
@ -1233,6 +1234,27 @@ SELECT
data
FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t;
--echo #
--echo # MDEV-35614 JSON_UNQUOTE doesn't work with emojis
--echo #
SELECT HEX(JSON_UNQUOTE('"\\ud83d\\ude0a"')) as hex_smiley;
set names utf8mb4;
SELECT JSON_UNQUOTE('"\\ud83d\\ude0a"') as smiley;
SELECT JSON_UNQUOTE('"\\ud83d\\ude0a"') = JSON_UNQUOTE('"\\ud83d\\ude0a"') as equal_smileys;
SELECT JSON_UNQUOTE('"\\ud83d\\ude0a"') <= JSON_UNQUOTE('"\\ud83d\\ude0a"') as less_or_equal_smileys;
set @v='{ "color":"😊" }';
select @v as v, collation(@v) as collation_v;
select json_valid(@v) as valid;
select json_extract(@v,'$.color') as color_extraction, collation(json_extract(@v,'$.color')) as color_extraction_collation;
select json_unquote(json_extract(@v,'$.color')) as unquoted, collation(json_unquote(json_extract(@v,'$.color'))) as unquoted_collation;
SELECT JSON_UNQUOTE('"\\uc080\\ude0a"') as invalid_utf8mb4;
show warnings;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@ -424,3 +424,22 @@ Warnings:
Note 1003 select 1 like `test`.`t1`.`c1` | `test`.`t1`.`c2` AS `1 LIKE c1|c2`,1 like `test`.`t1`.`c1` & `test`.`t1`.`c2` AS `1 LIKE c1&c2`,1 like `test`.`t1`.`c2` >> `test`.`t1`.`c1` AS `1 LIKE c2>>c1`,2 like `test`.`t1`.`c2` << `test`.`t1`.`c1` AS `2 LIKE c2<<c1`,1 like `test`.`t1`.`c1` or `test`.`t1`.`c2` <> 0 AS `1 LIKE c1||c2`,2 like `test`.`t1`.`c1` + `test`.`t1`.`c2` AS `2 LIKE c1+c2`,-1 like `test`.`t1`.`c1` - `test`.`t1`.`c2` AS `-1 LIKE c1-c2`,2 like `test`.`t1`.`c1` * `test`.`t1`.`c2` AS `2 LIKE c1*c2`,0.5000 like `test`.`t1`.`c1` / `test`.`t1`.`c2` AS `0.5000 LIKE c1/c2`,0 like `test`.`t1`.`c1` DIV `test`.`t1`.`c2` AS `0 LIKE c1 DIV c2`,0 like `test`.`t1`.`c1` MOD `test`.`t1`.`c2` AS `0 LIKE c1 MOD c2` from `test`.`t1` order by `test`.`t1`.`c2`
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-36211 Incorrect query result for binary_column NOT LIKE binary_column
#
CREATE TABLE t1 (c1 BLOB NOT NULL);
INSERT INTO t1 (c1) VALUES (1);
SELECT c1 FROM t1 WHERE c1 NOT LIKE c1;
c1
SELECT c1 FROM t1 WHERE c1 LIKE c1;
c1
1
DROP TABLE t1;
CREATE TABLE t1 (c1 BLOB);
INSERT INTO t1 (c1) VALUES (1);
SELECT c1 FROM t1 WHERE c1 NOT LIKE c1;
c1
SELECT c1 FROM t1 WHERE c1 LIKE c1;
c1
1
DROP TABLE t1;

View File

@ -291,3 +291,18 @@ SELECT * FROM v1;
EXPLAIN EXTENDED SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # MDEV-36211 Incorrect query result for binary_column NOT LIKE binary_column
--echo #
CREATE TABLE t1 (c1 BLOB NOT NULL);
INSERT INTO t1 (c1) VALUES (1);
SELECT c1 FROM t1 WHERE c1 NOT LIKE c1;
SELECT c1 FROM t1 WHERE c1 LIKE c1;
DROP TABLE t1;
CREATE TABLE t1 (c1 BLOB);
INSERT INTO t1 (c1) VALUES (1);
SELECT c1 FROM t1 WHERE c1 NOT LIKE c1;
SELECT c1 FROM t1 WHERE c1 LIKE c1;
DROP TABLE t1;

View File

@ -3010,6 +3010,80 @@ UPDATE t1 SET c=1 ORDER BY (SELECT c);
ERROR 42S22: Unknown column 'c' in 'SET'
DROP TABLE t1;
#
# MDEV-35238: Wrong results from a tables with a single record and an aggregate
#
CREATE OR REPLACE TABLE t1 (a int) ENGINE=myisam;
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
1+0 min(1)
1 NULL
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"message": "Impossible WHERE noticed after reading const tables"
}
}
}
INSERT INTO t1 VALUES (NULL);
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
1+0 min(1)
1 NULL
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
EXPLAIN
{
"query_block": {
"select_id": 1,
"pseudo_bits_condition": "if(uuid_short(),NULL,1)",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 1,
"filtered": 100
}
}
]
}
}
DROP TABLE t1;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=myisam;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (a int NOT NULL) ENGINE=myisam;
INSERT INTO t2 VALUES (10);
SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
1+0 MIN(t1.a)
1 1
explain format=json SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
EXPLAIN
{
"query_block": {
"select_id": 1,
"pseudo_bits_condition": "10 = rand()",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "system",
"rows": 1,
"filtered": 100
}
},
{
"table": {
"table_name": "t2",
"access_type": "system",
"rows": 1,
"filtered": 100
}
}
]
}
}
DROP TABLE t1,t2;
#
# End of 10.5 tests
#
#

View File

@ -2162,6 +2162,28 @@ UPDATE t1 SET c=1 ORDER BY (SELECT c);
UPDATE t1 SET c=1 ORDER BY (SELECT c);
DROP TABLE t1;
--echo #
--echo # MDEV-35238: Wrong results from a tables with a single record and an aggregate
--echo #
CREATE OR REPLACE TABLE t1 (a int) ENGINE=myisam;
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
INSERT INTO t1 VALUES (NULL);
SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
explain format=json SELECT 1+0, min(1) FROM t1 WHERE if(uuid_short(), a,1);
DROP TABLE t1;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=myisam;
INSERT INTO t1 VALUES (1);
CREATE TABLE t2 (a int NOT NULL) ENGINE=myisam;
INSERT INTO t2 VALUES (10);
SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
explain format=json SELECT 1+0, MIN(t1.a) FROM t1,t2 WHERE t2.a = rand();
DROP TABLE t1,t2;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -808,5 +808,75 @@ a
8
drop table t1;
#
# End of 10.5 tests
# MDEV-32086 Server crash when inserting from derived table containing insert target table
# (part 2)
#
create table t1 (pk int, id int);
insert into t1 values (2,2), (3,3), (4,4);
select * from t1;
pk id
2 2
3 3
4 4
select 101+count(*)
from
(
select dt2.id
from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id<1000;
101+count(*)
104
prepare s from '
insert into t1 values(
(select 101+count(*)
from
(
select dt2.id
from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id<1000
), 123
)
';
execute s;
select * from t1;
pk id
2 2
3 3
4 4
104 123
select 101+count(*)
from
(
select dt2.id
from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id<1000;
101+count(*)
105
execute s;
select * from t1;
pk id
2 2
3 3
4 4
104 123
105 123
drop table t1;
#
# Try this: INSERT INTO t1 VALUES ... reference to t1
# RETURNING (subquery not touching t1)
create table t1 (a int, b int);
create table t2 (a int, b int);
# This is accepted:
insert into t1 (a) values
(3),
((select max(a) from t1))
returning
a, b, (select max(a) from t2);
a b (select max(a) from t2)
3 NULL NULL
NULL NULL NULL
drop table t1,t2;
# End of 10.5 tests

View File

@ -675,5 +675,59 @@ select * from t1;
drop table t1;
--echo #
--echo # End of 10.5 tests
--echo # MDEV-32086 Server crash when inserting from derived table containing insert target table
--echo # (part 2)
--echo #
create table t1 (pk int, id int);
insert into t1 values (2,2), (3,3), (4,4);
select * from t1;
select 101+count(*)
from
(
select dt2.id
from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id<1000;
prepare s from '
insert into t1 values(
(select 101+count(*)
from
(
select dt2.id
from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id<1000
), 123
)
';
execute s;
select * from t1;
select 101+count(*)
from
(
select dt2.id
from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id<1000;
execute s;
select * from t1;
drop table t1;
--echo #
--echo # Try this: INSERT INTO t1 VALUES ... reference to t1
--echo # RETURNING (subquery not touching t1)
create table t1 (a int, b int);
create table t2 (a int, b int);
--echo # This is accepted:
insert into t1 (a) values
(3),
((select max(a) from t1))
returning
a, b, (select max(a) from t2);
drop table t1,t2;
--echo # End of 10.5 tests

View File

@ -498,6 +498,8 @@ t1 WHERE id1=1)
5 6
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT id2 FROM t2);
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT 1 UNION SELECT id2 FROM t2);
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t2 (id2, val2) VALUES (6,'f') RETURNING t1.*;
ERROR 42S02: Unknown table 'test.t1'
#

View File

@ -201,6 +201,8 @@ INSERT INTO t2(id2,val2) VALUES(5,'e') RETURNING id2, (SELECT id1+id2 FROM
t1 WHERE id1=1);
--error ER_UPDATE_TABLE_USED
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT id2 FROM t2);
--error ER_UPDATE_TABLE_USED
INSERT INTO t2(id2,val2) VALUES(5,'f') RETURNING (SELECT 1 UNION SELECT id2 FROM t2);
--error ER_BAD_TABLE_ERROR
INSERT INTO t2 (id2, val2) VALUES (6,'f') RETURNING t1.*;

View File

@ -1030,6 +1030,144 @@ a
3
DROP VIEW v1;
DROP TABLE t1;
create table t1 (pk int, id int);
insert into t1 values (2,2), (3,3), (4,4);
insert into t1
select 1,10
from
(
select dt2.id from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id=3;
select * from t1;
pk id
2 2
3 3
4 4
1 10
explain insert into t1
select 1,10
from
(
select dt2.id from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id=3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary
1 SIMPLE t ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
explain format=json insert into t1
select 1,10
from
(
select dt2.id from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id=3;
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": "COST_REPLACED",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.`id` = 3"
}
},
{
"block-nl-join": {
"table": {
"table_name": "t",
"access_type": "ALL",
"loops": 4,
"rows": 4,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t.`id` = 3"
},
"buffer_type": "flat",
"buffer_size": "65",
"join_type": "BNL"
}
}
]
}
}
}
prepare stmt from "insert into t1
select 1,10
from
(
select dt2.id from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id=3";
execute stmt;
select * from t1;
pk id
2 2
3 3
4 4
1 10
1 10
execute stmt;
select * from t1;
pk id
2 2
3 3
4 4
1 10
1 10
1 10
deallocate prepare stmt;
create procedure p() insert into t1
select 1,10
from
(
select dt2.id from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id=3;
call p();
select * from t1;
pk id
2 2
3 3
4 4
1 10
1 10
1 10
1 10
call p();
select * from t1;
pk id
2 2
3 3
4 4
1 10
1 10
1 10
1 10
1 10
drop procedure p;
drop table t1;
#
# End of 10.5 test
# MDEV-33139: Crash of INSERT SELECT when preparing structures for
# split optimization
#
CREATE TABLE v0 ( v1 INT UNIQUE ) ;
INSERT INTO v0 ( v1 ) VALUES
( ( SELECT 1
FROM
( SELECT v1
FROM v0 GROUP BY v1 ) AS v6 NATURAL JOIN
v0 AS v2 NATURAL JOIN
v0 AS v4 NATURAL JOIN
v0 AS v3 NATURAL JOIN
( SELECT v1 FROM v0 ) AS v7 ) ) ;
DROP TABLE v0;
# End of 10.5 tests

View File

@ -591,6 +591,61 @@ SELECT * FROM t1;
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-32086: condition pushdown into two mergeable derived tables,
# one containing the other, when they are forced to be
# materialized in INSERT
#
create table t1 (pk int, id int);
insert into t1 values (2,2), (3,3), (4,4);
let $q=
insert into t1
select 1,10
from
(
select dt2.id from (select id from t1) dt2, t1 t where t.id=dt2.id
) dt
where dt.id=3;
eval $q;
select * from t1;
eval explain $q;
--source include/explain-no-costs.inc
eval explain format=json $q;
eval prepare stmt from "$q";
execute stmt;
select * from t1;
execute stmt;
select * from t1;
deallocate prepare stmt;
eval create procedure p() $q;
call p();
select * from t1;
call p();
select * from t1;
drop procedure p;
drop table t1;
--echo #
--echo # End of 10.5 test
--echo # MDEV-33139: Crash of INSERT SELECT when preparing structures for
--echo # split optimization
--echo #
CREATE TABLE v0 ( v1 INT UNIQUE ) ;
INSERT INTO v0 ( v1 ) VALUES
( ( SELECT 1
FROM
( SELECT v1
FROM v0 GROUP BY v1 ) AS v6 NATURAL JOIN
v0 AS v2 NATURAL JOIN
v0 AS v4 NATURAL JOIN
v0 AS v3 NATURAL JOIN
( SELECT v1 FROM v0 ) AS v7 ) ) ;
DROP TABLE v0;
--echo # End of 10.5 tests

View File

@ -3608,6 +3608,35 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref kp1 kp1 5 test.t1.a 1 Using index condition
drop table t1,t2;
#
# MDEV-36592: If the join_condition is specified via USING (column_list), the query plan depends ...
#
CREATE TABLE t1 (
id int(11),
f1 char(255),
PRIMARY KEY (id)
);
INSERT INTO t1 (id) VALUES (1),(2),(3);
UPDATE t1 SET f1=REPEAT('a',250);
CREATE TABLE t2 (id int(11), f2 INT NOT NULL);
INSERT INTO t2 select seq, seq from seq_1_to_20;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
# In both queries, t1 should use type=index, not type=ALL:
EXPLAIN SELECT count(*) FROM t2 JOIN t1 USING (id);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
EXPLAIN SELECT count(*) FROM t1 JOIN t2 USING (id);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 3 Using index
1 SIMPLE t2 ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
# End of 10.11 tests
#
# MDEV-30256 Wrong result (missing rows) upon join with empty table
#
CREATE TABLE t1 (a INT);

View File

@ -2005,6 +2005,31 @@ where
t2.kp1=t1.a and t2.kp1<=100 and t2.kp2<=20;
drop table t1,t2;
--echo #
--echo # MDEV-36592: If the join_condition is specified via USING (column_list), the query plan depends ...
--echo #
CREATE TABLE t1 (
id int(11),
f1 char(255),
PRIMARY KEY (id)
);
INSERT INTO t1 (id) VALUES (1),(2),(3);
UPDATE t1 SET f1=REPEAT('a',250);
CREATE TABLE t2 (id int(11), f2 INT NOT NULL);
INSERT INTO t2 select seq, seq from seq_1_to_20;
ANALYZE TABLE t1, t2;
--echo # In both queries, t1 should use type=index, not type=ALL:
EXPLAIN SELECT count(*) FROM t2 JOIN t1 USING (id);
EXPLAIN SELECT count(*) FROM t1 JOIN t2 USING (id);
DROP TABLE t1,t2;
--echo # End of 10.11 tests
--echo #
--echo # MDEV-30256 Wrong result (missing rows) upon join with empty table
--echo #

View File

@ -185,7 +185,7 @@ create table myUC (i int);
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
TABLE_SCHEMA TABLE_NAME
mysqltest_lc2 myUC
mysqltest_LC2 myUC
use test;
drop database mysqltest_LC2;
#

View File

@ -16,29 +16,17 @@ create view v1Aa as select * from t1aA;
create view v2aA as select * from v1aA;
create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
insert into v2Aa values ((select max(col1) from v1aA));
ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2Aa'
insert into t1aA values ((select max(col1) from v1Aa));
ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 't1aA'
insert into v2aA values ((select max(col1) from v1aA));
ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2aA'
insert into v2Aa values ((select max(col1) from t1Aa));
ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 'v2Aa'
insert into t1aA values ((select max(col1) from t1Aa));
ERROR HY000: Table 't1aA' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v2aA values ((select max(col1) from t1aA));
ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v2aA'
insert into v2Aa values ((select max(col1) from v2aA));
ERROR HY000: Table 'v2Aa' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into t1Aa values ((select max(col1) from v2Aa));
ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'
insert into v2aA values ((select max(col1) from v2Aa));
ERROR HY000: Table 'v2aA' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v3Aa (col1) values ((select max(col1) from v1Aa));
ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 'v3Aa'
insert into v3aA (col1) values ((select max(col1) from t1aA));
ERROR HY000: The definition of table 'v3aA' prevents operation INSERT on table 'v3aA'
insert into v3Aa (col1) values ((select max(col1) from v2aA));
ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v3Aa'
drop view v3aA,v2Aa,v1aA;
drop table t1Aa,t2Aa;
create table t1Aa (col1 int);

View File

@ -23,29 +23,17 @@ create table t2aA (col1 int);
create view v1Aa as select * from t1aA;
create view v2aA as select * from v1aA;
create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
-- error 1443
insert into v2Aa values ((select max(col1) from v1aA));
-- error 1443
insert into t1aA values ((select max(col1) from v1Aa));
-- error 1443
insert into v2aA values ((select max(col1) from v1aA));
-- error 1443
insert into v2Aa values ((select max(col1) from t1Aa));
-- error 1093
insert into t1aA values ((select max(col1) from t1Aa));
-- error 1443
insert into v2aA values ((select max(col1) from t1aA));
-- error 1093
insert into v2Aa values ((select max(col1) from v2aA));
-- error 1443
insert into t1Aa values ((select max(col1) from v2Aa));
-- error 1093
insert into v2aA values ((select max(col1) from v2Aa));
-- error 1443
insert into v3Aa (col1) values ((select max(col1) from v1Aa));
-- error 1443
insert into v3aA (col1) values ((select max(col1) from t1aA));
-- error 1443
insert into v3Aa (col1) values ((select max(col1) from v2aA));
drop view v3aA,v2Aa,v1aA;
drop table t1Aa,t2Aa;

View File

@ -0,0 +1,21 @@
CREATE TABLE t (c1 VARCHAR(10),c2 VARCHAR(10),PRIMARY KEY(c1,c2),FULLTEXT KEY k (c2)) ENGINE=InnoDB;
INSERT INTO t VALUES ('a','b');
DROP TABLE t;
CREATE TABLE t (c1 VARCHAR(10),c2 VARCHAR(10),PRIMARY KEY(c1,c2),FULLTEXT KEY k (c2)) ENGINE=InnoDB;
DELETE FROM t;
DROP TABLE t;
CREATE TABLE t (a INT(1),d INT(1),b VARCHAR(1),c CHAR(1),c3 INT(1) GENERATED ALWAYS AS ((a + LENGTH (d))) STORED,c2 CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,k1 CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b (1),a,d),KEY d (d),KEY a (a),KEY c_renamed (c (1),b (1)),KEY b (b (1),c (1),a),KEY k1 (k1),KEY a_2 (a,k1),KEY k1_2 (k1,d)) DEFAULT CHARSET=latin1 ENGINE=InnoDB;
DELETE FROM t;
DROP TABLE t;
CREATE TABLE t (a INT,ROW_START TIMESTAMP(6) AS ROW START,ROW_END TIMESTAMP(6) AS ROW END,PERIOD FOR SYSTEM_TIME(ROW_START,ROW_END),INDEX (ROW_START),INDEX (ROW_END),PRIMARY KEY(ROW_END,a,ROW_START),INDEX (ROW_END,ROW_START,a)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
SHOW INDEX FROM t;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t 0 PRIMARY 1 ROW_END A 0 NULL NULL BTREE NO
t 0 PRIMARY 2 a A 0 NULL NULL BTREE NO
t 0 PRIMARY 3 ROW_START A 0 NULL NULL BTREE NO
t 1 ROW_START 1 ROW_START A 0 NULL NULL BTREE NO
t 1 ROW_END 1 ROW_END A 0 NULL NULL BTREE NO
t 1 ROW_END_2 1 ROW_END A 0 NULL NULL BTREE NO
t 1 ROW_END_2 2 ROW_START A 0 NULL NULL BTREE NO
t 1 ROW_END_2 3 a A 0 NULL NULL BTREE NO
DROP TABLE t;

View File

@ -0,0 +1,22 @@
--source include/have_innodb.inc
CREATE TABLE t (c1 VARCHAR(10),c2 VARCHAR(10),PRIMARY KEY(c1,c2),FULLTEXT KEY k (c2)) ENGINE=InnoDB;
INSERT INTO t VALUES ('a','b');
DROP TABLE t;
CREATE TABLE t (c1 VARCHAR(10),c2 VARCHAR(10),PRIMARY KEY(c1,c2),FULLTEXT KEY k (c2)) ENGINE=InnoDB;
DELETE FROM t;
DROP TABLE t;
CREATE TABLE t (a INT(1),d INT(1),b VARCHAR(1),c CHAR(1),c3 INT(1) GENERATED ALWAYS AS ((a + LENGTH (d))) STORED,c2 CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,k1 CHAR(1) GENERATED ALWAYS AS (SUBSTR(b,0,0)) VIRTUAL,PRIMARY KEY(b (1),a,d),KEY d (d),KEY a (a),KEY c_renamed (c (1),b (1)),KEY b (b (1),c (1),a),KEY k1 (k1),KEY a_2 (a,k1),KEY k1_2 (k1,d)) DEFAULT CHARSET=latin1 ENGINE=InnoDB;
DELETE FROM t;
DROP TABLE t;
CREATE TABLE t (a INT,ROW_START TIMESTAMP(6) AS ROW START,ROW_END TIMESTAMP(6) AS ROW END,PERIOD FOR SYSTEM_TIME(ROW_START,ROW_END),INDEX (ROW_START),INDEX (ROW_END),PRIMARY KEY(ROW_END,a,ROW_START),INDEX (ROW_END,ROW_START,a)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
SHOW INDEX FROM t;
DROP TABLE t;

View File

@ -2431,9 +2431,6 @@ create table t1 (a int) engine=myisam;
create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1);
insert into t2 values (1);
connect con1, localhost, root;
start transaction with consistent snapshot;
connection default;
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
update t1,t2 set t1.a=2,t2.a=3;
connection con2;
@ -2456,6 +2453,7 @@ SET DEBUG_SYNC= 'now SIGNAL grlwait';
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
FLUSH TABLES WITH READ LOCK;
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_BACKUP_FTWRL2 Backup lock
@ -2465,7 +2463,6 @@ connection default;
SET DEBUG_SYNC= 'RESET';
drop table t1,t2;
disconnect con2;
disconnect con1;
#
# Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
# failed in open_ltable()

View File

@ -3115,12 +3115,6 @@ create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1);
insert into t2 values (1);
connect (con1, localhost, root);
# disable innodb purge thread, otherwise it might start purging t2,
# and will take an mdl, affecting metadata_lock_info output.
start transaction with consistent snapshot;
connection default;
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
--send update t1,t2 set t1.a=2,t2.a=3
@ -3156,6 +3150,7 @@ FLUSH TABLES WITH READ LOCK;
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info;
--source include/wait_condition.inc
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
unlock tables;
@ -3166,7 +3161,6 @@ connection default;
SET DEBUG_SYNC= 'RESET';
drop table t1,t2;
disconnect con2;
disconnect con1;
--echo #
--echo # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'

View File

@ -1385,6 +1385,26 @@ c1 c2 c3
drop table t1,t2,t3,t;
# End of 10.4 tests
#
# MDEV-31647 Stack looping and SIGSEGV in Item_args::walk_args on UPDATE
#
create table t1 (c int, c2 int) engine=innodb;
update t1 set c=0 where c=(
select 1 from (select 1 as v1) as v2
natural join t1) order by last_value (c2) over (order by c2);
ERROR HY000: Invalid use of group function
update t1 set c=0 where c=(
select 1 from (select 1 as v1) as v2
natural join t1) order by last_value (c2) over ();
ERROR HY000: Invalid use of group function
update t1 set c=0 where c=(
select 1 from (select 1 as v1) as v2
natural join t1) order by c2;
select 1 from (select 1 as v1) as v2
natural join t1 order by last_value (c2) over (order by c2);
1
drop table t1;
# End of 10.5 tests
#
# MDEV-31150: 2nd execution of multi-update with
# mergeable derived table in WHERE
#

View File

@ -1202,6 +1202,34 @@ drop table t1,t2,t3,t;
--echo # End of 10.4 tests
--echo #
--echo # MDEV-31647 Stack looping and SIGSEGV in Item_args::walk_args on UPDATE
--echo #
--source include/have_innodb.inc
create table t1 (c int, c2 int) engine=innodb;
--error ER_INVALID_GROUP_FUNC_USE
update t1 set c=0 where c=(
select 1 from (select 1 as v1) as v2
natural join t1) order by last_value (c2) over (order by c2);
--error ER_INVALID_GROUP_FUNC_USE
update t1 set c=0 where c=(
select 1 from (select 1 as v1) as v2
natural join t1) order by last_value (c2) over ();
update t1 set c=0 where c=(
select 1 from (select 1 as v1) as v2
natural join t1) order by c2;
select 1 from (select 1 as v1) as v2
natural join t1 order by last_value (c2) over (order by c2);
drop table t1;
--echo # End of 10.5 tests
--echo #
--echo # MDEV-31150: 2nd execution of multi-update with
--echo # mergeable derived table in WHERE

View File

@ -2235,6 +2235,29 @@ SET @qc= @@query_cache_size;
set global Query_cache_size=18446744073709547520;
SET GLOBAL query_cache_size= @qc;
#
# MDEV-34075 corruption when query cache cannot allocate block
#
set global query_cache_type=1;
create table t1 (c1 smallint null, c2 binary (25) not null, c3 tinyint(4) null, c4 binary (15) not null primary key, c5 smallint not null unique key,c6 decimal(10,8) not null default 3.141592) engine=innodb;
set global query_cache_size=81920;
select * from t1 where b=1 and c=1;
ERROR 42S22: Unknown column 'b' in 'WHERE'
set session query_cache_type=1;
drop table t1;
create table t1 (c1 int not null, c2 char(5)) engine=innodb partition by linear key(c1) partitions 99;
select * from t1 where c1 <='1998-12-29 00:00:00' order by c1,c2;
c1 c2
select group_concat(a separator '###') as names from t1 having left(names, 1)='j';
ERROR 42S22: Unknown column 'a' in 'SELECT'
select * from t1;
c1 c2
select count(*) from t1;
count(*)
0
select G.a, c.a from t1 c, t1 G;
ERROR 42S22: Unknown column 'G.a' in 'SELECT'
drop table t1;
#
# End of 10.5 tests
#
#

View File

@ -2,6 +2,8 @@
-- source include/long_test.inc
-- source include/no_valgrind_without_big.inc
-- source include/no_view_protocol.inc
-- source include/have_partition.inc
-- source include/have_innodb.inc
--disable_ps2_protocol
set @save_query_cache_size=@@query_cache_size;
@ -1852,6 +1854,26 @@ set global Query_cache_size=18446744073709547520;
SET GLOBAL query_cache_size= @qc;
--enable_warnings
--echo #
--echo # MDEV-34075 corruption when query cache cannot allocate block
--echo #
set global query_cache_type=1;
create table t1 (c1 smallint null, c2 binary (25) not null, c3 tinyint(4) null, c4 binary (15) not null primary key, c5 smallint not null unique key,c6 decimal(10,8) not null default 3.141592) engine=innodb;
set global query_cache_size=81920;
--error ER_BAD_FIELD_ERROR
select * from t1 where b=1 and c=1;
set session query_cache_type=1;
drop table t1;
create table t1 (c1 int not null, c2 char(5)) engine=innodb partition by linear key(c1) partitions 99;
select * from t1 where c1 <='1998-12-29 00:00:00' order by c1,c2;
--error ER_BAD_FIELD_ERROR
select group_concat(a separator '###') as names from t1 having left(names, 1)='j';
select * from t1;
select count(*) from t1;
--error ER_BAD_FIELD_ERROR
select G.a, c.a from t1 c, t1 G;
drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -690,22 +690,24 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
NULL
1
insert into t2 values (1);
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -713,6 +715,7 @@ x
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -722,6 +725,7 @@ x
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
3
@ -738,7 +742,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 23000: Column 'x' cannot be null
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -806,13 +810,21 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
select * from t2;
id
1
2
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
id
1
2
2
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);

View File

@ -425,7 +425,6 @@ create table t2 (a int) ENGINE=MyISAM;
create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
-- error ER_UPDATE_TABLE_USED
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
-- error ER_SUBQUERY_NO_1_ROW
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
@ -460,7 +459,7 @@ create table t3 (a int);
insert into t2 values (1);
insert into t3 values (1),(2);
select * from t1;
-- error ER_UPDATE_TABLE_USED
-- error ER_BAD_NULL_ERROR
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
-- error ER_SUBQUERY_NO_1_ROW
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
@ -500,10 +499,13 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
--disable_prepare_warnings
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
-- error ER_UPDATE_TABLE_USED
-- error ER_SUBQUERY_NO_1_ROW
INSERT INTO t2 VALUES ((SELECT * FROM t2));
-- error ER_UPDATE_TABLE_USED
-- error ER_SUBQUERY_NO_1_ROW
INSERT INTO t2 VALUES ((SELECT id FROM t2));
select * from t2;
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);

View File

@ -136,12 +136,22 @@ DROP TABLE t1;
# access within null pointer
CREATE TABLE x (x INT) ENGINE=InnoDB;
INSERT INTO x (x) VALUES (0);
select NULL IN (SELECT (SELECT x FROM (SELECT x FROM
(SELECT 0 IN (SELECT x=0 FROM (SELECT x FROM (SELECT (SELECT (SELECT (SELECT
(SELECT 0 AS x) FROM x AS x) IN (SELECT 0 AS x) AS x) FROM x AS x) IN
(SELECT x WHERE x=0) AS x FROM x AS x) AS x) AS x GROUP BY x) AS x FROM x) AS x)
AS x) IN (SELECT 0 AS x) AS x FROM x) as exp;
exp
NULL
INSERT INTO x (x) VALUES (x IN (SELECT (SELECT x FROM (SELECT x FROM
(SELECT 0 IN (SELECT x=0 FROM (SELECT x FROM (SELECT (SELECT (SELECT (SELECT
(SELECT 0 AS x) FROM x AS x) IN (SELECT 0 AS x) AS x) FROM x AS x) IN
(SELECT x WHERE x=0) AS x FROM x AS x) AS x) AS x GROUP BY x) AS x FROM x) AS x)
AS x) IN (SELECT 0 AS x) AS x FROM x));
ERROR HY000: Table 'x' is specified twice, both as a target for 'INSERT' and as a separate source for data
select * from x;
x
0
NULL
DROP TABLE x;
# MDEV-28622: Item_subselect eliminated flag set but Item still
# evaluated/used.

View File

@ -133,12 +133,17 @@ DROP TABLE t1;
CREATE TABLE x (x INT) ENGINE=InnoDB;
INSERT INTO x (x) VALUES (0);
--error ER_UPDATE_TABLE_USED
select NULL IN (SELECT (SELECT x FROM (SELECT x FROM
(SELECT 0 IN (SELECT x=0 FROM (SELECT x FROM (SELECT (SELECT (SELECT (SELECT
(SELECT 0 AS x) FROM x AS x) IN (SELECT 0 AS x) AS x) FROM x AS x) IN
(SELECT x WHERE x=0) AS x FROM x AS x) AS x) AS x GROUP BY x) AS x FROM x) AS x)
AS x) IN (SELECT 0 AS x) AS x FROM x) as exp;
INSERT INTO x (x) VALUES (x IN (SELECT (SELECT x FROM (SELECT x FROM
(SELECT 0 IN (SELECT x=0 FROM (SELECT x FROM (SELECT (SELECT (SELECT (SELECT
(SELECT 0 AS x) FROM x AS x) IN (SELECT 0 AS x) AS x) FROM x AS x) IN
(SELECT x WHERE x=0) AS x FROM x AS x) AS x) AS x GROUP BY x) AS x FROM x) AS x)
AS x) IN (SELECT 0 AS x) AS x FROM x));
select * from x;
DROP TABLE x;
--echo # MDEV-28622: Item_subselect eliminated flag set but Item still

View File

@ -694,22 +694,24 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
NULL
1
insert into t2 values (1);
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -717,6 +719,7 @@ x
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -726,6 +729,7 @@ x
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
3
@ -742,7 +746,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 23000: Column 'x' cannot be null
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -810,13 +814,21 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
select * from t2;
id
1
2
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
id
1
2
2
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);

View File

@ -697,22 +697,24 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
NULL
1
insert into t2 values (1);
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -720,6 +722,7 @@ x
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -729,6 +732,7 @@ x
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
3
@ -745,7 +749,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 23000: Column 'x' cannot be null
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -813,13 +817,21 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
select * from t2;
id
1
2
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
id
1
2
2
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);

View File

@ -693,22 +693,24 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
NULL
1
insert into t2 values (1);
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -716,6 +718,7 @@ x
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -725,6 +728,7 @@ x
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
3
@ -741,7 +745,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 23000: Column 'x' cannot be null
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -809,13 +813,21 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
select * from t2;
id
1
2
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
id
1
2
2
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);

View File

@ -696,22 +696,24 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
NULL
1
insert into t2 values (1);
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -719,6 +721,7 @@ x
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -728,6 +731,7 @@ x
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
3
@ -744,7 +748,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 23000: Column 'x' cannot be null
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -812,13 +816,21 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
select * from t2;
id
1
2
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
id
1
2
2
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);

View File

@ -693,22 +693,24 @@ create table t3 (b int);
insert into t2 values (1);
insert into t3 values (1),(2);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
select * from t1;
x
NULL
1
insert into t2 values (1);
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -716,6 +718,7 @@ x
INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
select * from t1;
x
NULL
1
2
3
@ -725,6 +728,7 @@ x
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
NULL
1
2
3
@ -741,7 +745,7 @@ insert into t3 values (1),(2);
select * from t1;
x y
replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 23000: Column 'x' cannot be null
replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
ERROR 21000: Subquery returns more than 1 row
replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
@ -809,13 +813,21 @@ SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
id
2
INSERT INTO t2 VALUES ((SELECT * FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
INSERT INTO t2 VALUES ((SELECT id FROM t2));
ERROR HY000: Table 't2' is specified twice, both as a target for 'INSERT' and as a separate source for data
ERROR 21000: Subquery returns more than 1 row
select * from t2;
id
1
2
INSERT INTO t2 VALUES ((SELECT count(*) FROM t2));
INSERT INTO t2 VALUES ((SELECT max(id) FROM t2));
SELECT * FROM t2;
id
1
2
2
2
CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 values (1),(1);
UPDATE t2 SET id=(SELECT * FROM t1);

View File

@ -397,3 +397,61 @@ indexed_col not_indexed_col
DROP TABLE t2;
DROP TABLE t1;
SET note_verbosity=DEFAULT;
#
# MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
#
CREATE TABLE t1 (c1 BINARY(16), UNIQUE (c1));
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2);
SELECT HEX(c1) FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
HEX(c1)
31000000000000000000000000000000
32000000000000000000000000000000
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '-2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SELECT HEX(c1) FROM t1 IGNORE KEY(c1) WHERE 'a' BETWEEN 0 AND (c1);
HEX(c1)
31000000000000000000000000000000
32000000000000000000000000000000
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '-2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: '2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SELECT HEX(c1) FROM t1 WHERE '#' BETWEEN c1 AND 0;
HEX(c1)
2D310000000000000000000000000000
2D320000000000000000000000000000
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '-2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
SELECT HEX(c1) FROM t1 IGNORE KEY(c1) WHERE '#' BETWEEN c1 AND 0;
HEX(c1)
2D320000000000000000000000000000
2D310000000000000000000000000000
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '-2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
DROP TABLE t1;

View File

@ -178,3 +178,14 @@ DELIMITER ;$$
--source unusable_keys_joins.inc
DROP TABLE t1;
SET note_verbosity=DEFAULT;
--echo #
--echo # MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
--echo #
CREATE TABLE t1 (c1 BINARY(16), UNIQUE (c1));
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2);
SELECT HEX(c1) FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT HEX(c1) FROM t1 IGNORE KEY(c1) WHERE 'a' BETWEEN 0 AND (c1);
SELECT HEX(c1) FROM t1 WHERE '#' BETWEEN c1 AND 0;
SELECT HEX(c1) FROM t1 IGNORE KEY(c1) WHERE '#' BETWEEN c1 AND 0;
DROP TABLE t1;

View File

@ -1419,3 +1419,193 @@ Note 1105 Cannot use key parts with `test`.`t1`.`indexed_col` in the rewritten c
DROP TABLE t2;
DROP TABLE t1;
SET note_verbosity=DEFAULT;
#
# MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
#
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=myisam;
INSERT INTO t1 (c1) VALUES (1);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2)));
INSERT INTO t1 (c1) VALUES (1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
3
4
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE 3 BETWEEN 10*POW(-1,c1) AND (c1);
c1
3
5
SELECT c1 FROM t1 WHERE 'a' BETWEEN 10*POW(-1,c1) AND (c1);
c1
1
3
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=myisam;
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
3
4
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
c1
-2
-1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB NOT NULL);
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
3
4
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
c1
-2
-1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=innodb;
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
3
4
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
c1
-2
-1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
ALTER TABLE t1 engine=myisam;
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
3
4
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
c1
-2
-1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1)) engine=innodb;
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
3
4
5
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
c1
-2
-1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
DROP TABLE t1;

View File

@ -808,3 +808,48 @@ DELIMITER ;$$
--source unusable_keys_joins.inc
DROP TABLE t1;
SET note_verbosity=DEFAULT;
--echo #
--echo # MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
--echo #
# myisam has a special optimization for tables with one row
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=myisam;
INSERT INTO t1 (c1) VALUES (1);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
DROP TABLE t1;
# This case shows that we don't transform the entire WHERE clause
# into a range condition.
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2)));
INSERT INTO t1 (c1) VALUES (1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE 3 BETWEEN 10*POW(-1,c1) AND (c1);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 10*POW(-1,c1) AND (c1);
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=myisam;
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB NOT NULL);
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1(2))) engine=innodb;
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
ALTER TABLE t1 engine=myisam;
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
DROP TABLE t1;
CREATE TABLE t1 (c1 TINYBLOB, UNIQUE (c1)) engine=innodb;
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2),(3),(4),(5);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
DROP TABLE t1;

View File

@ -0,0 +1,42 @@
#
# MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
#
CREATE TABLE t1 (c1 VARBINARY(10), UNIQUE (c1));
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 IGNORE KEY(c1) WHERE 'a' BETWEEN 0 AND (c1);
c1
1
2
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'a'
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
c1
-1
-2
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
SELECT c1 FROM t1 IGNORE KEY(c1) WHERE '#' BETWEEN c1 AND 0;
c1
-2
-1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
Warning 1292 Truncated incorrect DECIMAL value: '#'
DROP TABLE t1;

View File

@ -0,0 +1,10 @@
--echo #
--echo # MDEV-36235 Incorrect result for BETWEEN over unique blob prefix
--echo #
CREATE TABLE t1 (c1 VARBINARY(10), UNIQUE (c1));
INSERT INTO t1 (c1) VALUES (-2),(-1),(1),(2);
SELECT c1 FROM t1 WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 IGNORE KEY(c1) WHERE 'a' BETWEEN 0 AND (c1);
SELECT c1 FROM t1 WHERE '#' BETWEEN c1 AND 0;
SELECT c1 FROM t1 IGNORE KEY(c1) WHERE '#' BETWEEN c1 AND 0;
DROP TABLE t1;

View File

@ -245,6 +245,11 @@ select f() from information_schema.index_statistics;
ERROR 21000: Subquery returns more than 1 row
set global userstat= 0;
drop function f;
#
# End of 10.2 tests
#
# MDEV-36586 USER_STATISTICS.BUSY_TIME is in microseconds
#
select distinct busy_time>1e5, cpu_time>1e5 from information_schema.user_statistics;
busy_time>1e5 cpu_time>1e5
0 0
# End of 10.11 tests

View File

@ -135,6 +135,11 @@ set global userstat= 0;
drop function f;
--enable_ps2_protocol
--echo #
--echo # End of 10.2 tests
--echo #
--echo # MDEV-36586 USER_STATISTICS.BUSY_TIME is in microseconds
--echo #
select distinct busy_time>1e5, cpu_time>1e5 from information_schema.user_statistics;
--echo # End of 10.11 tests

View File

@ -944,31 +944,19 @@ create view v1 as select * from t1;
create view v2 as select * from v1;
create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
insert into v2 values ((select max(col1) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2'
insert into t1 values ((select max(col1) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 't1'
insert into v2 values ((select max(col1) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v2'
insert into v2 values ((select max(col1) from t1));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'
insert into t1 values ((select max(col1) from t1));
ERROR HY000: Table 't1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v2 values ((select max(col1) from t1));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v2'
insert into v2 values ((select max(col1) from v2));
ERROR HY000: Table 'v2' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into t1 values ((select max(col1) from v2));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 't1'
insert into v2 values ((select max(col1) from v2));
ERROR HY000: Table 'v2' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into v3 (col1) values ((select max(col1) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select max(col1) from t1));
ERROR HY000: The definition of table 'v3' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select max(col1) from v2));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
ERROR HY000: The definition of table 'v2' prevents operation INSERT on table 'v3'
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2 LIMIT 1));
ERROR 22003: Out of range value for column 'col1' at row 3
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
insert into t3 values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
ERROR 23000: Column 'col1' cannot be null
@ -978,6 +966,18 @@ insert into t1 (col1) values ((select max(col1) from v4));
select * from t1;
col1
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
1
2
3
@ -1339,9 +1339,26 @@ create view v3 as select * from t1 where 20 < (select (s1) from v2);
insert into v3 values (30);
ERROR HY000: The target table v3 of the INSERT is not insertable-into
create view v4 as select * from v2 where 20 < (select (s1) from t1);
select * from t1;
s1
insert into v4 values (30);
ERROR HY000: The target table v4 of the INSERT is not insertable-into
drop view v4, v3, v2, v1;
select * from t1;
s1
30
create view v5 as select * from v2 where s1 < (select min(s1) from t1) WITH CHECK OPTION;
# can't insert only less then minimum
insert into v5 values (40);
ERROR 44000: CHECK OPTION failed `test`.`v5`
# allow insert the new minimum
insert into v5 values (10);
# always emply view (can't be something less than minimum)
select * from v5;
s1
select * from t1;
s1
30
10
drop view v5, v4, v3, v2, v1;
drop table t1;
create table t1 (a int);
create view v1 as select * from t1;

View File

@ -866,33 +866,21 @@ create table t3 (col1 datetime not null);
create view v1 as select * from t1;
create view v2 as select * from v1;
create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from v1));
-- error ER_VIEW_PREVENT_UPDATE
insert into t1 values ((select max(col1) from v1));
-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from v1));
-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from t1));
-- error ER_UPDATE_TABLE_USED
insert into t1 values ((select max(col1) from t1));
-- error ER_VIEW_PREVENT_UPDATE
insert into v2 values ((select max(col1) from t1));
-- error ER_UPDATE_TABLE_USED
insert into v2 values ((select max(col1) from v2));
-- error ER_VIEW_PREVENT_UPDATE
insert into t1 values ((select max(col1) from v2));
-- error ER_UPDATE_TABLE_USED
insert into v2 values ((select max(col1) from v2));
-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select max(col1) from v1));
-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select max(col1) from t1));
-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select max(col1) from v2));
# check with TZ tables in list
-- error ER_VIEW_PREVENT_UPDATE
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
--error ER_WARN_DATA_OUT_OF_RANGE
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2 LIMIT 1));
insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
-- error ER_BAD_NULL_ERROR
insert into t3 values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
@ -1212,9 +1200,19 @@ create view v3 as select * from t1 where 20 < (select (s1) from v2);
-- error ER_NON_INSERTABLE_TABLE
insert into v3 values (30);
create view v4 as select * from v2 where 20 < (select (s1) from t1);
-- error ER_NON_INSERTABLE_TABLE
select * from t1;
insert into v4 values (30);
drop view v4, v3, v2, v1;
select * from t1;
create view v5 as select * from v2 where s1 < (select min(s1) from t1) WITH CHECK OPTION;
--echo # can't insert only less then minimum
--error ER_VIEW_CHECK_FAILED
insert into v5 values (40);
--echo # allow insert the new minimum
insert into v5 values (10);
--echo # always emply view (can't be something less than minimum)
select * from v5;
select * from t1;
drop view v5, v4, v3, v2, v1;
drop table t1;
#

View File

@ -1979,6 +1979,52 @@ connection default;
DROP VIEW v1;
DROP USER foo;
DROP USER FOO;
#
# MDEV-36380: User has unauthorized access to a sequence through
# a view with security invoker
#
create database db;
use db;
create sequence s;
create sql security invoker view vin as select nextval(s);
create sql security definer view vdn as select nextval(s);
create sql security invoker view vil as select lastval(s);
create sql security definer view vdl as select lastval(s);
create sql security invoker view vis as select setval(s,20);
create sql security definer view vds as select setval(s,30);
create user u@localhost;
grant select on db.vin to u@localhost;
grant select on db.vdn to u@localhost;
grant select on db.vil to u@localhost;
grant select on db.vdl to u@localhost;
grant select on db.vis to u@localhost;
grant select on db.vds to u@localhost;
connect con1,localhost,u,,db;
select nextval(s);
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `db`.`s`
select * from vin;
ERROR HY000: View 'db.vin' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from vdn;
nextval(s)
1
select lastval(s);
ERROR 42000: SELECT command denied to user 'u'@'localhost' for table `db`.`s`
select * from vil;
ERROR HY000: View 'db.vil' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from vdl;
lastval(s)
1
select setval(s,10);
ERROR 42000: INSERT command denied to user 'u'@'localhost' for table `db`.`s`
select * from vis;
ERROR HY000: View 'db.vis' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from vds;
setval(s,30)
30
disconnect con1;
connection default;
drop database db;
drop user u@localhost;
# End of 10.5 tests
# Check that a user without access to the schema 'foo' cannot query
# a JSON_TABLE view in that schema.

View File

@ -2238,6 +2238,53 @@ DROP VIEW v1;
DROP USER foo;
DROP USER FOO;
--echo #
--echo # MDEV-36380: User has unauthorized access to a sequence through
--echo # a view with security invoker
--echo #
create database db;
use db;
create sequence s;
create sql security invoker view vin as select nextval(s);
create sql security definer view vdn as select nextval(s);
create sql security invoker view vil as select lastval(s);
create sql security definer view vdl as select lastval(s);
create sql security invoker view vis as select setval(s,20);
create sql security definer view vds as select setval(s,30);
create user u@localhost;
grant select on db.vin to u@localhost;
grant select on db.vdn to u@localhost;
grant select on db.vil to u@localhost;
grant select on db.vdl to u@localhost;
grant select on db.vis to u@localhost;
grant select on db.vds to u@localhost;
--connect (con1,localhost,u,,db)
--error ER_TABLEACCESS_DENIED_ERROR
select nextval(s);
--error ER_VIEW_INVALID
select * from vin;
--disable_ps2_protocol
select * from vdn;
--enable_ps2_protocol
--error ER_TABLEACCESS_DENIED_ERROR
select lastval(s);
--error ER_VIEW_INVALID
select * from vil;
select * from vdl;
--error ER_TABLEACCESS_DENIED_ERROR
select setval(s,10);
--error ER_VIEW_INVALID
select * from vis;
select * from vds;
--disconnect con1
--connection default
drop database db;
drop user u@localhost;
--echo # End of 10.5 tests
--echo # Check that a user without access to the schema 'foo' cannot query

View File

@ -130,6 +130,8 @@ our $path_language;
our $path_current_testlog;
our $path_testlog;
our $opt_open_files_limit;
our $default_vardir;
our $opt_vardir; # Path to use for var/ dir
our $plugindir;
@ -1279,6 +1281,7 @@ sub command_line_setup {
'list-options' => \$opt_list_options,
'skip-test-list=s' => \@opt_skip_test_list,
'xml-report=s' => \$opt_xml_report,
'open-files-limit=i', => \$opt_open_files_limit,
My::Debugger::options(),
My::CoreDump::options(),
@ -5779,6 +5782,7 @@ sub start_mysqltest ($) {
append => 1,
error => $path_current_testlog,
verbose => $opt_verbose,
open_files_limit => $opt_open_files_limit,
);
mtr_verbose("Started $proc");
return $proc;
@ -6077,6 +6081,8 @@ Misc options
timediff With --timestamp, also print time passed since
*previous* test started
max-connections=N Max number of open connection to server in mysqltest
open-files-limit=N Max number of open files allowed for any of the children
of my_safe_process. Default is 1024.
report-times Report how much time has been spent on different
phases of test execution.
stress=ARGS Run stress test, providing options to

View File

@ -1,6 +1,7 @@
--source include/big_test.inc
# Valgrind is to slow for this test
# Valgrind and msan is to slow for this test
--source include/not_valgrind.inc
--source include/not_msan.inc
--source include/have_archive.inc
CREATE TABLE t1(a BLOB) ENGINE=ARCHIVE;
--disable_query_log

View File

@ -3,7 +3,7 @@ the following:
- Add # before --exec echo "restart" ...
- Force $e (engine), $c (crash point) and $r (crash position) to the values
where things goes wrong. See comments in alter_table.test for how to do this.
where things goes wrong. See comments in alter_table.inc for how to do this.
- start mariadbd in a debugger
run the following in the debugger

View File

@ -1,6 +1,5 @@
--source include/long_test.inc
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_log_bin.inc
if (!$BIG_TEST)

View File

@ -4,4 +4,4 @@
let $engine_count=1;
let $engines='aria';
let $extra_engine=myisam;
--source alter_table.test
--source alter_table.inc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
#
# Test atomic alter table with InnoDB
--source include/have_innodb.inc
let $engine_count=1;
let $engines='innodb';
--source alter_table.inc

View File

@ -0,0 +1,6 @@
#
# Test atomic alter table with MyISAM
let $engine_count=1;
let $engines='myisam';
--source alter_table.inc

View File

@ -3,4 +3,4 @@
let $engine_count=1;
let $engines='rocksdb';
set global rocksdb_flush_log_at_trx_commit=1;
--source alter_table.test
--source alter_table.inc

View File

@ -7,7 +7,7 @@
#
# Testing of atomic create table with crashes in a lot of different places
#
# This is very similar to the alter_table.test, but includes testing of
# This is very similar to the alter_table.inc, but includes testing of
# triggers in with ALTER TABLE .. RENAME.
#

View File

@ -0,0 +1,116 @@
set @@session.gtid_domain_id=1;
set @save_gtid_stric_mode=@@global.gtid_strict_mode;
create table ta (a int) engine=aria;
create table ti (a int) engine=innodb;
create table ti_pk (a int primary key) engine=innodb;
create table t (a int) engine=innodb;
create function f_i()
returns integer
begin
insert into ti set a=1;
return 1;
end |
create function f_ia(arg int)
returns integer
begin
insert into ti_pk set a=1;
insert into ta set a=1;
insert into ti_pk set a=arg;
return 1;
end |
call mtr.add_suppression("Error writing file");
select count(*) as zero from t;
zero
0
select count(*) as zero from ta;
zero
0
select count(*) as zero from ti;
zero
0
# 1. simple Innodb test
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into t set a=1;
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# observe effective rollback
select count(*) as zero from t;
zero
0
# 2. simple Aira test
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into ta values (1),(2);
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# note no rollback
select count(*) as '*NON-zero*' from ta;
*NON-zero*
2
delete from ta;
# 3. multi-engine test
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into ta set a=f_i();
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# note no rollback..
select count(*) as one from ta;
one
1
# ..except transactional engine
select count(*) as zero from ti;
zero
0
delete from ta;
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into t set a=f_ia(0);
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# note no rollback..
select count(*) as one from ta;
one
1
# ..except transactional engine
select count(*) as zero from t;
zero
0
select count(*) as zero from ti_pk;
zero
0
delete from ta;
# 4. create-table-select-f()
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
create table f_x (a int) select f_i() as a;
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# rollback indeed takes place in the pure transactional case
select count(*) as zero from ti;
zero
0
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
create table t_x (a int) engine=aria select f_ia(0) as a;
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
select * from t_x;
ERROR 42S02: Table 'test.t_x' doesn't exist
# **TODO**: fix MDEV-36027
# **TODO**: the empty binlog is buggy ..
include/show_binlog_events.inc
# .. as non-transactional `ta` (and `t_x` sic!) are modified
select count(*) as one from ta;
one
1
select count(*) as zero from ti;
zero
0
delete from ta;
#.
set @@global.gtid_strict_mode=@save_gtid_stric_mode;
drop function f_i;
drop function f_ia;
drop table t, ta, ti, ti_pk;

View File

@ -18,6 +18,51 @@ drop table t1;
# Ensuring file offset of binlog_f2_mid < binlog_f1_end
#
#
# Test using --read-from-remote-server
#
connection default;
#
# --stop-position tests
#
# Case 1.a) With one binlog file, a --stop-position before the end of
# the file should not result in a warning
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_pre_rotate binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
#
# Case 1.b) With one binlog file, a --stop-position at the exact end of
# the file should not result in a warning
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_end binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
#
# Case 1.c) With one binlog file, a --stop-position past the end of the
# file should(!) result in a warning
# MYSQL_BINLOG --read-from-remote-server --short-form --stop-position=binlog_f1_over_eof binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
WARNING: Did not reach stop position <BINLOG_F1_OVER_EOF> before end of input
#
# Case 2.a) With two binlog files, a --stop-position targeting b2 which
# exists in the size of b1 should:
# 1) not provide any warnings
# 2) not prevent b2 from outputting its desired events before the
# stop position
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_mid binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
include/assert_grep.inc [Ensure all intended GTIDs are present]
include/assert_grep.inc [Ensure the next GTID binlogged is _not_ present]
#
# Case 2.b) With two binlog files, a --stop-position targeting the end
# of binlog 2 should:
# 1) not provide any warnings
# 2) not prevent b2 from outputting its entire binary log
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_end binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
include/assert_grep.inc [Ensure a GTID exists for each transaction]
include/assert_grep.inc [Ensure the last GTID binlogged is present]
#
# Case 2.c) With two binlog files, a --stop-position targeting beyond
# the eof of binlog 2 should:
# 1) provide a warning that the stop position was not reached
# 2) not prevent b2 from outputting its entire binary log
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_over_eof binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
WARNING: Did not reach stop position <BINLOG_F2_OVER_EOF> before end of input
include/assert_grep.inc [Ensure a GTID exists for each transaction]
#
#
# Test using local binlog files
#
connection default;

View File

@ -0,0 +1,135 @@
# Tests of commit time failures.
# At committing of an auto-commit statement a failure to commit in its
# binlog branch should rollback at least the transactional part of the statement.
#
# References:
# MDEV-35506 commit policy of one-phase-commit even at errored-out binlogging leads to assert
# MDEV-36027 Errored-out CREATE-SELECT does not binlog results of non-transactional table modification
source include/have_innodb.inc;
source include/have_binlog_format_row.inc;
set @@session.gtid_domain_id=1;
set @save_gtid_stric_mode=@@global.gtid_strict_mode;
create table ta (a int) engine=aria;
create table ti (a int) engine=innodb;
create table ti_pk (a int primary key) engine=innodb;
create table t (a int) engine=innodb;
delimiter |;
create function f_i()
returns integer
begin
insert into ti set a=1;
return 1;
end |
create function f_ia(arg int)
returns integer
begin
insert into ti_pk set a=1;
insert into ta set a=1;
insert into ti_pk set a=arg;
return 1;
end |
delimiter ;|
call mtr.add_suppression("Error writing file");
# Naturally all empty now
select count(*) as zero from t;
select count(*) as zero from ta;
select count(*) as zero from ti;
# Force manual value assignement to gtid::seq_no while in the strict mode
# so that the value is rejected. Despite the errorred out statement
# being at its commit phase it will eventually be rolled back.
# Side effects of non-transactional engines, like Aria, are displayed.
--echo # 1. simple Innodb test
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
# mask possible allowed seq_no shift
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into t set a=1;
--echo # observe effective rollback
select count(*) as zero from t;
--echo # 2. simple Aira test
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into ta values (1),(2);
--echo # note no rollback
select count(*) as '*NON-zero*' from ta;
# local cleanup
delete from ta;
--echo # 3. multi-engine test
# A. non-transactional top-level
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into ta set a=f_i();
--echo # note no rollback..
select count(*) as one from ta;
--echo # ..except transactional engine
select count(*) as zero from ti;
delete from ta;
# B. non-transactional in the leaf
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into t set a=f_ia(0);
--echo # note no rollback..
select count(*) as one from ta;
--echo # ..except transactional engine
select count(*) as zero from t;
select count(*) as zero from ti_pk;
delete from ta;
--echo # 4. create-table-select-f()
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
# A. two phase commit branch
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
create table f_x (a int) select f_i() as a;
--echo # rollback indeed takes place in the pure transactional case
select count(*) as zero from ti;
# B. one phase commit branch
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
create table t_x (a int) engine=aria select f_ia(0) as a;
--error ER_NO_SUCH_TABLE
select * from t_x;
--echo # **TODO**: fix MDEV-36027
--echo # **TODO**: the empty binlog is buggy ..
--source include/show_binlog_events.inc
--echo # .. as non-transactional `ta` (and `t_x` sic!) are modified
select count(*) as one from ta;
select count(*) as zero from ti;
delete from ta;
--echo #.
# cleanup
set @@global.gtid_strict_mode=@save_gtid_stric_mode;
drop function f_i;
drop function f_ia;
drop table t, ta, ti, ti_pk;

View File

@ -64,13 +64,12 @@ if ($binlog_f2_mid > $binlog_f1_end)
--die Mid point chosen to end in binlog 2 does not exist in earlier binlog
}
#--echo #
#--echo #
#--echo # Test using --read-from-remote-server
#--echo #
#--let $read_from_remote_server= 1
#--emit warning is not supported by --read-from-remote-server now
#--source binlog_mysqlbinlog_warn_stop_position.inc
--echo #
--echo #
--echo # Test using --read-from-remote-server
--echo #
--let $read_from_remote_server= 1
--source binlog_mysqlbinlog_warn_stop_position.inc
--echo #
--echo #

View File

@ -7,9 +7,6 @@ connection default;
set global federated_pushdown=1;
#Enable after fix MDEV-31846 or in v. 10.5 and later
--disable_cursor_protocol
connection slave;
DROP TABLE IF EXISTS federated.t1;
@ -170,11 +167,13 @@ insert into federated.t4 select * from federated.t1;
--sorted_result
select * from federated.t4;
--disable_cursor_protocol
select name into @var from federated.t1 where id=3 limit 1 ;
select @var;
--disable_ps2_protocol
select name into outfile 'tmp.txt' from federated.t1;
--enable_ps2_protocol
--enable_cursor_protocol
let $path=`select concat(@@datadir, 'test/tmp.txt')`;
remove_file $path;
@ -860,7 +859,5 @@ connection default;
set global federated_pushdown=0;
--enable_cursor_protocol
source include/federated_cleanup.inc;

View File

@ -12,7 +12,6 @@ connection node_1;
connection node_4;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
connection node_2;
connection node_1;
expected_error
1
connection node_2;

View File

@ -1,29 +1,69 @@
connection node_2;
connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
INSERT INTO t1(f2) SELECT seq FROM seq_1_to_1000;
connection node_2a;
SET SESSION wsrep_sync_wait=0;
connection node_1a;
# Block the applier on node_1 and issue a ddl from node_2
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);;
# DDL 1
ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 VALUES (NULL, 10000, 10000);;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
# This will block on acquiring total order isolation
connection node_1;
# DDL 2
CREATE UNIQUE INDEX i1 ON t1(f2);;
connection node_1a;
# Signal DDL 1
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
connection node_2;
INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 3
1
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
connection node_1;
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 3
1
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
connection node_2;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
EXPECT_2
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) DEFAULT NULL,
`f3` int(11) DEFAULT NULL,
PRIMARY KEY (`f1`),
UNIQUE KEY `i1` (`f2`)
) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
EXPECT_1001
1001
connection node_1;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
EXPECT_2
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) DEFAULT NULL,
`f3` int(11) DEFAULT NULL,
PRIMARY KEY (`f1`),
UNIQUE KEY `i1` (`f2`)
) ENGINE=InnoDB AUTO_INCREMENT=2047 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
EXPECT_1001
1001
DROP TABLE t1;

View File

@ -203,6 +203,9 @@ id b
3 200
4 5
connection node_2;
SELECT COUNT(*) FROM t1;
COUNT(*)
10
SELECT * FROM t1 ORDER BY id;
id b
1 1
@ -228,6 +231,9 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM;
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1;
INSERT INTO t1 (a,b) VALUES (10,20);
SELECT * from t1;
a b
1 20
connection node_2;
SELECT * from t1;
a b

View File

@ -0,0 +1,112 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
Server 4 left the cluster
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
connection node_1;
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
Restarting server 4
Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
SELECT count(*) AS expect1_1 FROM t2;
expect1_1
1
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
SELECT count(*) AS expect2_1 FROM t2;
expect2_1
1
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
SELECT count(*) AS expect3_1 FROM t2;
expect3_1
1
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
SELECT count(*) AS expect4_1 FROM t2;
expect4_1
1
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");

View File

@ -0,0 +1,94 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
DROP TABLE t2;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@ -0,0 +1,102 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
connection node_1;
CALL p1(130);
Waiting for server 3 to leave the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
Server 3 left the cluster, killing it...
Killed server 3.
Restarting server 3...
Waiting for server 3 to rejoin the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
sleeping for 20
Waiting ready
Server 3 restarted.
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_2;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_3;
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@ -2,7 +2,7 @@
# Test the behavior of a Galera async slave if it goes non-prim. Async replication
# should abort with an error but it should be possible to restart it.
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
# The galera_3nodes_as_slave.cnf describes the setup of the nodes
#
--source include/have_innodb.inc
@ -45,9 +45,8 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
--connection node_2
--sleep 5
wait_for_slave_to_stop;
--let $value = query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1)
--connection node_1
--disable_query_log
--eval SELECT "$value" IN ("Error 'Unknown command' on query. Default database: 'test'. Query: 'BEGIN'", "Node has dropped from cluster") AS expected_error
--enable_query_log
@ -75,7 +74,6 @@ START SLAVE;
--connection node_4
DROP TABLE t1;
--sleep 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

View File

@ -1,43 +1,81 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
#
# In this test, we simultaneously send two non-conflicting ALTER TABLE statements
#
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
INSERT INTO t1(f2) SELECT seq FROM seq_1_to_1000;
--connection node_2
--connection node_2a
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);
--let $wait_condition = SELECT COUNT(*) = 1000 FROM t1;
--source include/wait_condition.inc
--connection node_1a
--echo # Block the applier on node_1 and issue a ddl from node_2
SET SESSION wsrep_sync_wait=0;
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc
--connection node_2
--echo # DDL 1
--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 VALUES (NULL, 10000, 10000);
--connection node_1a
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
--echo # This will block on acquiring total order isolation
--connection node_1
--echo # DDL 2
--send CREATE UNIQUE INDEX i1 ON t1(f2);
--connection node_1a
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'acquiring total order%' or STATE LIKE 'Waiting for table metadata%'
--source include/wait_condition.inc
--echo # Signal DDL 1
--source include/galera_clear_sync_point.inc
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_signal_sync_point.inc
--connection node_2
--reap
INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM t1;
--connection node_1
--reap
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM t1;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SHOW CREATE TABLE t1;
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SHOW CREATE TABLE t1;
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
DROP TABLE t1;

View File

@ -22,6 +22,8 @@ SET GLOBAL wsrep_on = ON;
DROP TABLE t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
SHOW TABLES;
# Drop schema that does not exist
@ -33,6 +35,8 @@ SET GLOBAL wsrep_on = ON;
DROP SCHEMA s1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE 's1';
--source include/wait_condition.inc
SHOW SCHEMAS;
# Drop index that does not exist using DROP INDEX
@ -45,6 +49,10 @@ SET GLOBAL wsrep_on = ON;
DROP INDEX idx1 ON t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE NAME LIKE 'idx1';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
@ -58,6 +66,10 @@ SET GLOBAL wsrep_on = ON;
ALTER TABLE t1 DROP INDEX idx1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE NAME LIKE 'idx1';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
@ -71,6 +83,11 @@ SET GLOBAL wsrep_on = ON;
ALTER TABLE t1 DROP COLUMN f2;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE NAME LIKE 'f2';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
@ -93,6 +110,10 @@ DELETE FROM t1 WHERE f1 = 1;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
@ -112,6 +133,10 @@ COMMIT;
SELECT COUNT(*) AS expect_1 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS expect_1 FROM t1;
DROP TABLE t1;
@ -136,6 +161,8 @@ DELETE FROM t1;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE expect_Primary FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@ -171,6 +198,8 @@ SET AUTOCOMMIT=ON;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE expect_Primary FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@ -202,6 +231,8 @@ DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
SELECT COUNT(*) expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@ -219,6 +250,10 @@ CREATE TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KE
INSERT INTO child VALUES (1,1),(2,2),(3,3);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/parent';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/child';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM child;
--source include/wait_condition.inc
@ -233,6 +268,10 @@ SELECT COUNT(*) AS expect_0 FROM parent;
SELECT COUNT(*) AS expect_0 FROM child;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/parent';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/child';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';

View File

@ -21,6 +21,11 @@ INSERT INTO t1 VALUES (2), (3);
INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_5 FROM t1;
DROP TABLE t1;
@ -36,6 +41,13 @@ REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz');
REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_3 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
@ -49,6 +61,9 @@ SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
#
@ -59,6 +74,9 @@ SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
DELETE FROM t1 WHERE f2 = 'zzz';
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
#
@ -69,6 +87,9 @@ SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
TRUNCATE TABLE t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM t1;
DROP TABLE t1;
@ -86,6 +107,15 @@ INSERT INTO t2 VALUES (1);
COMMIT;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t2;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t2;
@ -100,6 +130,11 @@ INSERT INTO t2 VALUES (2);
ROLLBACK;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t2;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_2 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t2;
@ -119,7 +154,13 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
--connection node_2
# The MyISAM update is replicated immediately, so a duplicate key error happens even before the COMMIT
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
# The MyISAM update is replicated when executed, so a duplicate key error happens even before the COMMIT
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (1);
@ -147,6 +188,10 @@ EXECUTE rep;
SELECT * FROM t1 ORDER BY id;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 11 FROM t1;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1;
@ -173,6 +218,10 @@ CALL proc();
SELECT * FROM t1 ORDER BY id;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 11 FROM t1;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY id;
DROP PROCEDURE proc;
@ -196,6 +245,13 @@ SELECT * FROM t1 ORDER BY id;
SELECT * FROM t2 ORDER BY id;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
SELECT COUNT(*) FROM t1;
--let $wait_condition = SELECT COUNT(*) = 10 FROM t1;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY id;
SELECT * FROM t2 ORDER BY id;
DROP TRIGGER tr1;
@ -206,8 +262,14 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM;
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1;
INSERT INTO t1 (a,b) VALUES (10,20);
SELECT * from t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT * from t1;
--connection node_1
DROP TABLE t1;

View File

@ -0,0 +1,20 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4

View File

@ -0,0 +1,165 @@
#
# Test a case where a joiner encounters an error during IST
# Instead of voting it should assume error and bail out.
#
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# Wait for node #4 to leave cluster
--let $members = 3
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--echo Server 4 left the cluster
# Create some writesets for IST
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause error during IST
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--connection node_1
# prepare to stop SST donor thread when it receives a request from starting node #4
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
--echo Restarting server 4
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
--echo Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
--echo Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
#
# After this point node #4 shall proceed to IST and bail out
#
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
SELECT count(*) AS expect1_1 FROM t2;
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
SELECT count(*) AS expect2_1 FROM t2;
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
SELECT count(*) AS expect3_1 FROM t2;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
SELECT count(*) AS expect4_1 FROM t2;
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");
--source ../include/auto_increment_offset_restore.inc

View File

@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@ -0,0 +1,73 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be applied.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause node #4 to initiate a vote and leave the cluster
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
DROP TABLE t2;
--source galera_vote_joined_end.inc
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@ -0,0 +1,79 @@
# This file purpose is to set up node 4 to require SST which is artificaially
# prolonged and as a result accumulate sufficient relication queue.
# The contents of the qeuee are controlled in the sourcing test files.
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
# 130 events move the commit cut, it is essential in voting
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# enforce SST
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat
# Wait for node #4 to leave cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
# prepare to stop SST donor thread when node is in donor state
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
--connection node_4
--echo Restarting server 4...
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
# Wait for node #1 to become a donor
--connection node_1
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
--echo Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
--echo Wait for the state snapshot to be copied to server 4
--source include/galera_wait_ready.inc
--echo SST script unlocked server 1
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 20 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#

View File

@ -0,0 +1,33 @@
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
#DROP TABLE IF EXISTS t2;
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno [0-9]+");
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
#CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno seqno [0-9]+");
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
DROP TABLE t1;
DROP PROCEDURE p1;
#CALL mtr.add_suppression("inconsistent with group");
--source ../include/auto_increment_offset_restore.inc

View File

@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@ -0,0 +1,100 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be skipped. I.e. JOINED node should continue operation.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
#
# Create a writeset that node 4 won't be able to apply by making node 3
# inconsisitent
#
--connection node_3
--let $node_3_server_id= `SELECT @@server_id`
--let $node_3_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_3_server_id.expect
--let $node_3_pid_file= `SELECT @@pid_file`
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause nodes #1 and #2 to initiate a vote and kick node #3
# out of the cluster, node #4 should recover the vote when fails to apply
# the event and continue
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
# make sure nodes 1,2 progress far enough for commit cut update
--connection node_1
CALL p1(130);
--let $members = 3
--echo Waiting for server 3 to leave the cluster
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_4
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--enable_reconnect
--let $wait_timeout = 60
--source include/wsrep_wait_membership.inc
--connection node_3
--echo Server 3 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_3_expect_file_name
--let KILL_NODE_PIDFILE = $node_3_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 3.
--source include/wait_until_disconnected.inc
--echo Restarting server 3...
--exec echo "restart:$start_mysqld_params" > $node_3_expect_file_name
--echo Waiting for server 3 to rejoin the cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_3
--echo sleeping for $MTR_SST_JOINER_DELAY
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--echo Waiting ready
--enable_reconnect
--source include/galera_wait_ready.inc
--echo Server 3 restarted.
--source galera_vote_joined_end.inc
--connection node_1
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_2
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_3
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@ -77,6 +77,8 @@ select @@gtid_binlog_state;
--echo cluster 2 node 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@ -85,11 +87,16 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@ -99,10 +106,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@ -112,10 +123,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 2
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@ -125,37 +140,55 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 3
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo # check other nodes are consistent
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
drop table t1;
stop slave;
@ -250,6 +283,8 @@ select @@gtid_binlog_state;
--sleep 2
--echo cluster 2 node 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@ -258,11 +293,16 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@ -272,10 +312,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@ -285,10 +329,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 2
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@ -298,10 +346,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 3
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@ -311,24 +363,36 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo # check other nodes are consistent
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
drop table t1;
stop slave;

View File

@ -86,6 +86,8 @@ delete from t where a =13;
DROP INDEX idx1 ON t;
DROP INDEX idx2 ON t;
DROP TABLE t;
# restart
set default_storage_engine=innodb;
/* Test large BLOB data */
CREATE TABLE `t` (
`a` BLOB,

Some files were not shown because too many files have changed in this diff Show More