10.0-base merge

This commit is contained in:
Sergei Golubchik 2013-01-31 09:48:19 +01:00
commit ab83952f29
531 changed files with 47557 additions and 6579 deletions

View file

@ -27,6 +27,11 @@ then
configure="$configure --print"
fi
if test "$AM_EXTRA_MAKEFLAGS" = "VERBOSE=1" -o "$verbose_make" = "1"
then
configure="$configure --verbose"
fi
commands="\
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
@ -45,7 +50,7 @@ if [ -z "$just_configure" -a -z "$just_clean" ]
then
commands="$commands
$make $AM_MAKEFLAGS $AM_EXTRA_MAKEFLAGS $EXTRA_MAKEFLAGS"
$make $AM_MAKEFLAGS $AM_EXTRA_MAKEFLAGS"
if [ "x$strip" = "xyes" ]
then

View file

@ -30,6 +30,11 @@ Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
--extra-configs=xxx Add this to configure options
--extra-flags=xxx Add this C and CXX flags
--extra-cflags=xxx Add this to C flags
--extra-cxxflags=xxx Add this to CXX flags
--verbose Print out full compile lines
--with-debug=full Build with full debug(no optimizations, keep call stack).
--warning-mode=[old|pedantic|maintainer]
Influences the debug flags. Old is default.
@ -64,6 +69,8 @@ parse_options()
just_configure=1;;
-n | --just-print | --print)
just_print=1;;
--verbose)
verbose_make=1;;
-h | --help)
usage
exit 0;;
@ -89,6 +96,7 @@ just_configure=
warning_mode=
maintainer_mode=
full_debug=
verbose_make=
parse_options "$@"

View file

@ -20,6 +20,7 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
CMAKE_POLICY(VERSION 2.8)
endif()
MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
@ -324,6 +325,7 @@ IF(NOT WITHOUT_SERVER)
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
ADD_SUBDIRECTORY(internal)
ENDIF()
ADD_SUBDIRECTORY(packaging/rpm-uln)
ENDIF()
IF(UNIX)

View file

@ -4,5 +4,5 @@
#
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=0
MYSQL_VERSION_PATCH=1
MYSQL_VERSION_EXTRA=

View file

@ -49,7 +49,7 @@ int completion_hash_init(HashTable *ht, uint nSize)
ht->initialized = 0;
return FAILURE;
}
init_alloc_root(&ht->mem_root, 8192, 0);
init_alloc_root(&ht->mem_root, 8192, 0, MYF(0));
ht->pHashFunction = hashpjw;
ht->nTableSize = nSize;
ht->initialized = 1;

View file

@ -1157,7 +1157,7 @@ int main(int argc,char *argv[])
}
glob_buffer.realloc(512);
completion_hash_init(&ht, 128);
init_alloc_root(&hash_mem_root, 16384, 0);
init_alloc_root(&hash_mem_root, 16384, 0, MYF(0));
bzero((char*) &mysql, sizeof(mysql));
if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent))

View file

@ -22,7 +22,7 @@
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
#define VER "1.2"
#define VER "1.3"
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@ -148,6 +148,8 @@ static struct my_option my_long_options[]=
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"All commands including mysqlcheck are binlogged. Enabled by default;"
"use --skip-write-binlog when commands should not be sent to replication slaves.",
@ -298,6 +300,11 @@ get_one_option(int optid, const struct my_option *opt,
}
add_option= 0;
break;
case 'V':
printf("%s Ver %s Distrib %s, for %s (%s)\n",
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
die(0);
break;
case OPT_SILENT:
opt_verbose= 0;
add_option= 0;

View file

@ -278,8 +278,8 @@ public:
int init()
{
return init_dynamic_array(&file_names, sizeof(File_name_record),
100, 100);
return my_init_dynamic_array(&file_names, sizeof(File_name_record),
100, 100, MYF(0));
}
void init_by_dir_name(const char *dir)
@ -2393,7 +2393,7 @@ int main(int argc, char** argv)
my_init_time(); // for time functions
init_alloc_root(&s_mem_root, 16384, 0);
init_alloc_root(&s_mem_root, 16384, 0, MYF(0));
if (load_defaults("my", load_groups, &argc, &argv))
exit(1);

View file

@ -998,8 +998,10 @@ int main(int argc, char **argv)
}
if (opt_auto_repair &&
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64)))
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0)) ||
my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,
64, MYF(0))))
goto end;
if (opt_alldbs)

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab.
Copyright (c) 2010, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1182,13 +1182,13 @@ check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset)
found= 0;
while ((row= mysql_fetch_row(res)))
{
if (0 == strcmp(row[0], "binlog_snapshot_file"))
if (0 == strcmp(row[0], "Binlog_snapshot_file"))
{
if (binlog_pos_file)
strmake(binlog_pos_file, row[1], FN_REFLEN-1);
found++;
}
else if (0 == strcmp(row[0], "binlog_snapshot_position"))
else if (0 == strcmp(row[0], "Binlog_snapshot_position"))
{
if (binlog_pos_offset)
strmake(binlog_pos_offset, row[1], LONGLONG_LEN);
@ -4587,7 +4587,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
if (init_dumping(db, init_dumping_tables))
DBUG_RETURN(1);
init_alloc_root(&root, 8192, 0);
init_alloc_root(&root, 8192, 0, MYF(0));
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
die(EX_EOM, "alloc_root failure.");

View file

@ -1660,12 +1660,12 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
{
int fd;
size_t len;
char buff[512];
char buff[16384];
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
return 1;
while((len= my_read(fd, (uchar*)&buff,
sizeof(buff), MYF(0))) > 0)
sizeof(buff)-1, MYF(0))) > 0)
{
char *p= buff, *start= buff;
while (p < buff+len)
@ -1676,7 +1676,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
/* Add fake newline instead of cr and output the line */
*p= '\n';
p++; /* Step past the "fake" newline */
dynstr_append_mem(ds, start, p-start);
*p= 0;
replace_dynstr_append_mem(ds, start, p-start);
p++; /* Step past the "fake" newline */
start= p;
}
@ -1684,7 +1685,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
p++;
}
/* Output any chars that migh be left */
dynstr_append_mem(ds, start, p-start);
*p= 0;
replace_dynstr_append_mem(ds, start, p-start);
}
my_close(fd, MYF(0));
return 0;
@ -4397,7 +4399,10 @@ void do_change_user(struct st_command *command)
cur_con->name, ds_user.str, ds_passwd.str, ds_db.str));
if (mysql_change_user(mysql, ds_user.str, ds_passwd.str, ds_db.str))
die("change user failed: %s", mysql_error(mysql));
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
else
handle_no_error(command);
dynstr_free(&ds_user);
dynstr_free(&ds_passwd);
@ -5174,7 +5179,7 @@ typedef struct
static st_error global_error_names[] =
{
{ "<No error>", -1U, "" },
{ "<No error>", ~0U, "" },
#include <mysqld_ername.h>
{ 0, 0, 0 }
};
@ -7288,7 +7293,7 @@ void init_win_path_patterns()
DBUG_ENTER("init_win_path_patterns");
my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16);
my_init_dynamic_array(&patterns, sizeof(const char*), 16, 16, MYF(0));
/* Loop through all paths in the array */
for (i= 0; i < num_paths; i++)
@ -8901,7 +8906,7 @@ int main(int argc, char **argv)
cur_block->ok= TRUE; /* Outer block should always be executed */
cur_block->cmd= cmd_none;
my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024);
my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024, MYF(0));
if (my_hash_init2(&var_hash, 64, charset_info,
128, 0, 0, get_var_key, var_free, MYF(0)))
@ -8931,7 +8936,7 @@ int main(int argc, char **argv)
#endif
init_dynamic_string(&ds_res, "", 2048, 2048);
init_alloc_root(&require_file_root, 1024, 1024);
init_alloc_root(&require_file_root, 1024, 1024, MYF(0));
parse_args(argc, argv);
@ -9877,7 +9882,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
/* my_malloc() will die on fail with MY_FAE */
res=(struct st_replace_regex*)my_malloc(
sizeof(*res)+expr_len ,MYF(MY_FAE+MY_WME));
my_init_dynamic_array(&res->regex_arr,sizeof(struct st_regex),128,128);
my_init_dynamic_array(&res->regex_arr,sizeof(struct st_regex), 128, 128, MYF(0));
buf= (char*)res + sizeof(*res);
expr_end= expr + expr_len;
@ -10932,7 +10937,7 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
if (!*start)
DBUG_VOID_RETURN; /* No input */
my_init_dynamic_array(&lines, sizeof(const char*), 32, 32);
my_init_dynamic_array(&lines, sizeof(const char*), 32, 32, MYF(0));
if (keep_header)
{

View file

@ -46,6 +46,8 @@ SET(FEATURE_SET_large 5)
SET(FEATURE_SET_xlarge 6)
SET(FEATURE_SET_community 7)
#SET(WITH_CASSANDRA_STORAGE_ENGINE ON)
IF(FEATURE_SET)
STRING(TOLOWER ${FEATURE_SET} feature_set)
SET(num ${FEATURE_SET_${feature_set}})

View file

@ -222,6 +222,21 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DENABLE_GCOV=ON";
next;
}
if ($option =~ /verbose/)
{
$cmakeargs = $cmakeargs." -DCMAKE_VERBOSE_MAKEFILE=1";
next;
}
if ($option =~ /with-client-ldflags/)
{
print("configure.pl : ignoring $option\n");
next;
}
if ($option =~ /with-mysqld-ldflags=/)
{
print("configure.pl : ignoring $option\n");
next;
}
$option = uc($option);
$option =~ s/-/_/g;

View file

@ -64,10 +64,31 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}
SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common")
SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d" "%config(noreplace) /etc/my.cnf.d/*")
SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf")
SET(CPACK_RPM_shared_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*")
SET(CPACK_RPM_client_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*")
SET(ignored
"%ignore /etc"
"%ignore /etc/init.d"
"%ignore /etc/logrotate.d"
"%ignore /usr"
"%ignore /usr/bin"
"%ignore /usr/include"
"%ignore /usr/lib"
"%ignore /usr/lib64"
"%ignore /usr/sbin"
"%ignore /usr/share"
"%ignore /usr/share/aclocal"
"%ignore /usr/share/doc"
"%ignore /usr/share/man"
"%ignore /usr/share/man/man1*"
"%ignore /usr/share/man/man8*"
)
SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf")
SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
SET(CPACK_RPM_compat_USER_FILELIST ${ignored})
SET(CPACK_RPM_devel_USER_FILELIST ${ignored})
SET(CPACK_RPM_test_USER_FILELIST ${ignored})
SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")
@ -88,8 +109,8 @@ SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)
SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh)
SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared")
SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18)")
SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared mysql-libs")
SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18) mysql-libs")
SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
@ -97,7 +118,7 @@ SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test"
SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test")
# workaround for lots of perl dependencies added by rpmbuild
SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_misc.pl)")
SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_cases) perl(mtr_io.pl) perl(mtr_match) perl(mtr_misc.pl) perl(mtr_report) perl(mtr_results) perl(mtr_unique)")
# If we want to build build MariaDB-shared-compat,
# extract compat libraries from MariaDB-shared-5.3 rpm

View file

@ -31,7 +31,7 @@ ENDIF()
# Create bootstrapper SQL script
FILE(WRITE bootstrap.sql "use mysql;\n" )
FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql)
FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql mysql_performance_tables.sql)
FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
FOREACH(STR ${CONTENTS})
IF(NOT STR MATCHES "@current_hostname")
@ -68,10 +68,13 @@ EXECUTE_PROCESS(
COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND}
)
EXECUTE_PROCESS (
COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD}
COMMAND "@CMAKE_COMMAND@" -E
echo input file bootstrap.sql, current directory ${CWD}
)
EXECUTE_PROCESS (
COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT
COMMAND ${BOOTSTRAP_COMMAND}
INPUT_FILE bootstrap.sql
OUTPUT_VARIABLE OUT
ERROR_VARIABLE ERR
RESULT_VARIABLE RESULT
)
@ -80,3 +83,6 @@ IF(NOT RESULT EQUAL 0)
MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
ENDIF()
EXECUTE_PROCESS (
COMMAND "@CMAKE_COMMAND@" -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -82,9 +82,11 @@ MACRO(CREATE_INFO_BIN)
FILE(WRITE ${INFO_BIN} "===== Information about the build process: =====\n")
IF (WIN32)
EXECUTE_PROCESS(COMMAND cmd /c date /T OUTPUT_VARIABLE TMP_DATE)
EXECUTE_PROCESS(COMMAND cmd /c date /T
OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S"
OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSE()
SET(TMP_DATE "(no date command known for this platform)")
ENDIF()

View file

@ -1,4 +1,4 @@
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -100,7 +100,10 @@ ENDIF()
# just use if(INSTALL_PLUGINTESTDIR).
# The plugin must set its own install path for tests
#
FILE(GLOB plugin_tests ${CMAKE_SOURCE_DIR}/plugin/*/tests)
FILE(GLOB plugin_tests
${CMAKE_SOURCE_DIR}/plugin/*/tests
${CMAKE_SOURCE_DIR}/internal/plugin/*/tests
)
#
# STANDALONE layout

View file

@ -56,7 +56,7 @@ IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
ENDIF()
SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
MESSAGE("-- MariaDB ${VERSION}")
MESSAGE(STATUS "MariaDB ${VERSION}")
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
# Use NDBVERSION irregardless of whether this is Cluster or not, if not

View file

@ -130,7 +130,7 @@ IF(NOT VERSION)
SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
ENDIF()
MESSAGE("-- Packaging as: ${package_name}")
MESSAGE(STATUS "Packaging as: ${package_name}")
# Sometimes package suffix is added (something like "-icc-glibc23")
IF(PACKAGE_SUFFIX)

View file

@ -39,6 +39,7 @@ MACRO(PLUGIN_APPEND_COLLECTIONS plugin)
GET_FILENAME_COMPONENT(fname ${cfile} NAME)
FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}")
FILE(APPEND ${fcopied} "${fname}\n")
MESSAGE(STATUS "Appended ${cfile}")
ENDFOREACH()
ENDIF()
ENDMACRO()

View file

@ -61,4 +61,5 @@ usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql

View file

@ -84,7 +84,7 @@ build-stamp: configure
@echo "RULES.$@"
dh_testdir
cd $(builddir) && $(MAKE) $(MAKE_J)
cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS)
ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
# Don't know why the following is necessary...

View file

@ -63,4 +63,5 @@ usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql

View file

@ -84,7 +84,7 @@ build-stamp: configure
@echo "RULES.$@"
dh_testdir
cd $(builddir) && $(MAKE) $(MAKE_J)
cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS)
ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
# Don't know why the following is necessary...

View file

@ -7,18 +7,17 @@
@DPATCH@
--- old/scripts/mysqld_safe.sh 2006-07-29 13:12:34.000000000 +0200
+++ old/scripts/mysqld_safe.sh 2006-07-29 13:14:08.000000000 +0200
@@ -16,8 +16,6 @@
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
--- a/scripts/mysqld_safe.sh 2013-01-11 16:02:41 +0000
+++ b/scripts/mysqld_safe.sh 2013-01-11 16:03:14 +0000
@@ -30,7 +30,6 @@
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
-trap '' 1 2 3 15 # we shouldn't let anyone kill us
-
umask 007
defaults=
@@ -122,7 +122,7 @@
# MySQL-specific environment variable. First off, it's not really a umask,
# it's the desired mode. Second, it follows umask(2), not umask(3) in that
@@ -156,7 +155,7 @@
# sed buffers output (only GNU sed supports a -u (unbuffered) option)
# which means that messages may not get sent to syslog until the
# mysqld process quits.
@ -27,7 +26,7 @@
;;
*)
echo "Internal program error (non-fatal):" \
@@ -352,6 +350,13 @@
@@ -758,6 +757,13 @@
fi
#
@ -41,3 +40,4 @@
# Uncomment the following lines if you want all tables to be automatically
# checked and repaired during startup. You should add sensible key_buffer
# and sort_buffer values to my.cnf to improve check performance or require

View file

@ -894,7 +894,7 @@ static struct errors *generate_empty_message(uint d_code)
if (!(new_error= (struct errors *) my_malloc(sizeof(*new_error),
MYF(MY_WME))))
return(0);
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1))
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 1, MYF(0)))
return(0); /* OOM: Fatal error */
new_error->er_name= NULL;
@ -928,7 +928,7 @@ static struct errors *parse_error_string(char *str, int er_count)
MYF(MY_WME))))
DBUG_RETURN(0);
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0))
if (my_init_dynamic_array(&new_error->msg, sizeof(struct message), 0, 0, MYF(0)))
DBUG_RETURN(0); /* OOM: Fatal error */
/* getting the error name */

View file

@ -265,7 +265,7 @@ static int insert_pointer_name(reg1 POINTER_ARRAY *pa,char * name)
if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
MYF(MY_WME))))
{
my_free(pa->typelib.type_names);
my_free((char*) pa->typelib.type_names);
DBUG_RETURN (-1);
}
pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
@ -327,7 +327,7 @@ static void free_pointer_array(reg1 POINTER_ARRAY *pa)
if (pa->typelib.count)
{
pa->typelib.count=0;
my_free(pa->typelib.type_names);
my_free((char*) pa->typelib.type_names);
pa->typelib.type_names=0;
my_free(pa->str);
}

View file

@ -223,7 +223,7 @@ static void init_sym_table()
{
char buf[512];
if (my_init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE,
INC_SYM_TABLE))
INC_SYM_TABLE, MYF(0)))
die("Failed in my_init_dynamic_array() -- looks like out of memory problem");
while (fgets(buf, sizeof(buf), fp_sym))

View file

@ -39,6 +39,7 @@ extern "C" {
/* flags for hash_init */
#define HASH_UNIQUE 1 /* hash_insert fails on duplicate key */
#define HASH_THREAD_SPECIFIC 2 /* Mark allocated memory THREAD_SPECIFIC */
typedef uint my_hash_value_type;
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);

View file

@ -153,6 +153,7 @@ typedef struct st_heap_share
THR_LOCK lock;
mysql_mutex_t intern_lock; /* Locking for use with _locking */
my_bool delete_on_close;
my_bool internal; /* Internal temporary table */
LIST open_list;
uint auto_key;
uint auto_key_type; /* real type of the auto key segment */

View file

@ -34,10 +34,10 @@
#include <mysql_time.h>
/*
Max length for data in a dynamic colums. This comes from how the
how the offset are stored.
Limits of implementation
*/
#define MAX_DYNAMIC_COLUMN_LENGTH 0X1FFFFFFFL
#define MAX_TOTAL_NAME_LENGTH 65535
#define MAX_NAME_LENGTH (MAX_TOTAL_NAME_LENGTH/4)
/* NO and OK is the same used just to show semantics */
#define ER_DYNCOL_NO ER_DYNCOL_OK
@ -50,7 +50,8 @@ enum enum_dyncol_func_result
ER_DYNCOL_LIMIT= -2, /* Some limit reached */
ER_DYNCOL_RESOURCE= -3, /* Out of resourses */
ER_DYNCOL_DATA= -4, /* Incorrect input data */
ER_DYNCOL_UNKNOWN_CHARSET= -5 /* Unknown character set */
ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */
ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */
};
typedef DYNAMIC_STRING DYNAMIC_COLUMN;
@ -65,7 +66,8 @@ enum enum_dynamic_column_type
DYN_COL_DECIMAL,
DYN_COL_DATETIME,
DYN_COL_DATE,
DYN_COL_TIME
DYN_COL_TIME,
DYN_COL_DYNCOL
};
typedef enum enum_dynamic_column_type DYNAMIC_COLUMN_TYPE;
@ -79,7 +81,7 @@ struct st_dynamic_column_value
unsigned long long ulong_value;
double double_value;
struct {
LEX_STRING value;
MYSQL_LEX_STRING value;
CHARSET_INFO *charset;
} string;
struct {
@ -92,6 +94,7 @@ struct st_dynamic_column_value
typedef struct st_dynamic_column_value DYNAMIC_COLUMN_VALUE;
#ifdef MADYNCOL_DEPRECATED
enum enum_dyncol_func_result
dynamic_column_create(DYNAMIC_COLUMN *str,
uint column_nr, DYNAMIC_COLUMN_VALUE *value);
@ -101,7 +104,6 @@ dynamic_column_create_many(DYNAMIC_COLUMN *str,
uint column_count,
uint *column_numbers,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
dynamic_column_update(DYNAMIC_COLUMN *org, uint column_nr,
DYNAMIC_COLUMN_VALUE *value);
@ -112,36 +114,102 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
dynamic_column_delete(DYNAMIC_COLUMN *org, uint column_nr);
dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr);
enum enum_dyncol_func_result
dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr);
dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint);
enum enum_dyncol_func_result
dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr,
DYNAMIC_COLUMN_VALUE *store_it_here);
#endif
/* new functions */
enum enum_dyncol_func_result
mariadb_dyncol_create_many(DYNAMIC_COLUMN *str,
uint column_count,
uint *column_numbers,
DYNAMIC_COLUMN_VALUE *values,
my_bool new_string);
enum enum_dyncol_func_result
mariadb_dyncol_create_many_named(DYNAMIC_COLUMN *str,
uint column_count,
MYSQL_LEX_STRING *column_keys,
DYNAMIC_COLUMN_VALUE *values,
my_bool new_string);
enum enum_dyncol_func_result
mariadb_dyncol_update_many(DYNAMIC_COLUMN *str,
uint add_column_count,
uint *column_keys,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
mariadb_dyncol_update_many_named(DYNAMIC_COLUMN *str,
uint add_column_count,
MYSQL_LEX_STRING *column_keys,
DYNAMIC_COLUMN_VALUE *values);
enum enum_dyncol_func_result
mariadb_dyncol_exists(DYNAMIC_COLUMN *org, uint column_nr);
enum enum_dyncol_func_result
mariadb_dyncol_exists_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name);
/* List of not NULL columns */
enum enum_dyncol_func_result
dynamic_column_list(DYNAMIC_COLUMN *org, DYNAMIC_ARRAY *array_of_uint);
mariadb_dyncol_list(DYNAMIC_COLUMN *str, uint *count, uint **nums);
enum enum_dyncol_func_result
mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count,
MYSQL_LEX_STRING **names);
/*
if the column do not exists it is NULL
*/
enum enum_dyncol_func_result
dynamic_column_get(DYNAMIC_COLUMN *org, uint column_nr,
mariadb_dyncol_get(DYNAMIC_COLUMN *org, uint column_nr,
DYNAMIC_COLUMN_VALUE *store_it_here);
enum enum_dyncol_func_result
mariadb_dyncol_get_named(DYNAMIC_COLUMN *str, MYSQL_LEX_STRING *name,
DYNAMIC_COLUMN_VALUE *store_it_here);
my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str);
enum enum_dyncol_func_result
mariadb_dyncol_check(DYNAMIC_COLUMN *str);
enum enum_dyncol_func_result
mariadb_dyncol_json(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json);
#define dynamic_column_initialize(A) memset((A), 0, sizeof(*(A)))
#define dynamic_column_column_free(V) dynstr_free(V)
/***************************************************************************
Internal functions, don't use if you don't know what you are doing...
***************************************************************************/
/* conversion of values to 3 base types */
enum enum_dyncol_func_result
mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
CHARSET_INFO *cs, my_bool quote);
enum enum_dyncol_func_result
mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val);
enum enum_dyncol_func_result
mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val);
#define dynamic_column_reassociate(V,P,L, A) dynstr_reassociate((V),(P),(L),(A))
#define dynamic_column_value_init(V) (V)->type= DYN_COL_NULL
enum enum_dyncol_func_result
mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
uint *count,
MYSQL_LEX_STRING **names, DYNAMIC_COLUMN_VALUE **vals);
int mariadb_dyncol_column_cmp_named(const MYSQL_LEX_STRING *s1,
const MYSQL_LEX_STRING *s2);
enum enum_dyncol_func_result
mariadb_dyncol_column_count(DYNAMIC_COLUMN *str, uint *column_count);
#define mariadb_dyncol_value_init(V) (V)->type= DYN_COL_NULL
/*
Prepare value for using as decimal
*/
void dynamic_column_prepare_decimal(DYNAMIC_COLUMN_VALUE *value);
void mariadb_dyncol_prepare_decimal(DYNAMIC_COLUMN_VALUE *value);
#endif

View file

@ -45,8 +45,9 @@ extern "C" {
#define MY_S_ISREG(m) (((m) & MY_S_IFMT) == MY_S_IFREG)
#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
#define MY_DONT_SORT 512 /* my_lib; Don't sort files */
#define MY_WANT_STAT 1024 /* my_lib; stat files */
/* Ensure these dosn't clash with anything in my_sys.h */
#define MY_DONT_SORT 8192 /* my_lib; Don't sort files */
#define MY_WANT_STAT 16384 /* my_lib; stat files */
/* typedefs for my_dir & my_stat */

View file

@ -994,7 +994,7 @@ typedef struct st_mysql_lex_string LEX_STRING;
#define SOCKET_EMFILE EMFILE
#endif
typedef int myf; /* Type of MyFlags in my_funcs */
typedef ulong myf; /* Type of MyFlags in my_funcs */
typedef char my_bool; /* Small bool */
/* Macros for converting *constants* to the right type */

View file

@ -350,9 +350,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#ifndef set_timespec_time_nsec
#define set_timespec_time_nsec(ABSTIME,NSEC) do { \
ulonglong now= (NSEC); \
(ABSTIME).MY_tv_sec= (now / 1000000000ULL); \
(ABSTIME).MY_tv_nsec= (now % 1000000000ULL); \
ulonglong _now_= (NSEC); \
(ABSTIME).MY_tv_sec= (_now_ / 1000000000ULL); \
(ABSTIME).MY_tv_nsec= (_now_ % 1000000000ULL); \
} while(0)
#endif /* !set_timespec_time_nsec */

View file

@ -86,6 +86,10 @@ typedef struct my_aio_result {
#define MY_SYNC 4096 /* my_copy(): sync dst file */
#define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */
#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */
#define MY_THREAD_SPECIFIC 0x10000 /* my_malloc(): thread specific */
#define MY_THREAD_MOVE 0x20000 /* realloc(); Memory can move */
/* Tree that should delete things automaticly */
#define MY_TREE_WITH_DELETE 0x40000
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
#define MY_GIVE_INFO 2 /* Give time info about process*/
@ -148,6 +152,18 @@ typedef struct my_aio_result {
/* Extra length needed for filename if one calls my_create_backup_name */
#define MY_BACKUP_NAME_EXTRA_LENGTH 17
/* If we have our own safemalloc (for debugging) */
#if defined(SAFEMALLOC)
void sf_report_leaked_memory(my_thread_id id);
extern my_thread_id (*sf_malloc_dbug_id)(void);
#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X)
#else
#define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0)
#endif
typedef void (*MALLOC_SIZE_CB) (long long size, my_bool is_thread_specific);
extern void set_malloc_size_cb(MALLOC_SIZE_CB func);
/* defines when allocating data */
extern void *my_malloc(size_t Size,myf MyFlags);
extern void *my_multi_malloc(myf MyFlags, ...);
@ -183,7 +199,7 @@ extern void my_large_free(uchar *ptr);
#define my_alloca(SZ) alloca((size_t) (SZ))
#define my_afree(PTR) ((void)0)
#else
#define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE))
#define my_alloca(SZ) my_malloc(SZ,MYF(MY_FAE|MY_THREAD_SPECIFIC))
#define my_afree(PTR) my_free(PTR)
#endif /* HAVE_ALLOCA */
@ -323,6 +339,7 @@ typedef struct st_dynamic_array
uint elements,max_element;
uint alloc_increment;
uint size_of_element;
myf malloc_flags;
} DYNAMIC_ARRAY;
typedef struct st_my_tmpdir
@ -773,16 +790,10 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
extern void close_cached_file(IO_CACHE *cache);
File create_temp_file(char *to, const char *dir, const char *pfx,
int mode, myf MyFlags);
#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
#define my_init_dynamic_array(A,B,C,D,E) my_init_dynamic_array2(A,B,NULL,C,D,E)
extern my_bool my_init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
void *init_buffer, uint init_alloc,
uint alloc_increment);
/* init_dynamic_array() function is deprecated */
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
uint init_alloc, uint alloc_increment);
uint alloc_increment, myf my_flags);
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void* element);
extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
extern void *pop_dynamic(DYNAMIC_ARRAY*);
@ -807,12 +818,23 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
size_t length);
extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
...);
extern my_bool dynstr_append_quoted(DYNAMIC_STRING *str,
const char *append, size_t len,
char quote);
extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
extern void dynstr_free(DYNAMIC_STRING *str);
extern uint32 copy_and_convert_extended(char *to, uint32 to_length,
CHARSET_INFO *to_cs,
const char *from, uint32 from_length,
CHARSET_INFO *from_cs, uint *errors);
extern void dynstr_reassociate(DYNAMIC_STRING *str, char **res, size_t *length,
size_t *alloc_length);
extern uint32 copy_and_convert_extended(char *to, uint32 to_length,
CHARSET_INFO *to_cs,
const char *from, uint32 from_length,
CHARSET_INFO *from_cs, uint *errors);
#ifdef HAVE_MLOCK
extern void *my_malloc_lock(size_t length,myf flags);
extern void my_free_lock(void *ptr);
@ -824,7 +846,7 @@ extern void my_free_lock(void *ptr);
#define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
extern void init_alloc_root(MEM_ROOT *mem_root, size_t block_size,
size_t pre_alloc_size);
size_t pre_alloc_size, myf my_flags);
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);

View file

@ -68,13 +68,15 @@ typedef struct st_tree {
MEM_ROOT mem_root;
my_bool with_delete;
tree_element_free free;
myf my_flags;
uint flag;
} TREE;
/* Functions on whole tree */
void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit,
int size, qsort_cmp2 compare, my_bool with_delete,
tree_element_free free_element, void *custom_arg);
int size, qsort_cmp2 compare,
tree_element_free free_element, void *custom_arg,
myf my_flags);
void delete_tree(TREE*);
void reset_tree(TREE*);

View file

@ -164,6 +164,7 @@ typedef struct st_handler_check_param
mysql_mutex_t print_msg_mutex;
my_bool need_print_msg_lock;
myf malloc_flags;
} HA_CHECK;

View file

@ -28,7 +28,7 @@ typedef struct st_net {
unsigned char reading_or_writing;
char save_char;
char net_skip_rest_factor;
my_bool unused1;
my_bool thread_specific_malloc;
my_bool compress;
my_bool unused3;
unsigned char *unused;
@ -80,7 +80,7 @@ enum enum_mysql_set_option
MYSQL_OPTION_MULTI_STATEMENTS_ON,
MYSQL_OPTION_MULTI_STATEMENTS_OFF
};
my_bool my_net_init(NET *net, Vio* vio);
my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool clear_buffer);

View file

@ -72,7 +72,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
/* MariaDB plugin interface version */
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0103
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0104
/*
The allowable types of plugins
@ -625,23 +625,6 @@ void thd_inc_row_count(MYSQL_THD thd);
*/
int mysql_tmpfile(const char *prefix);
/**
Check the killed state of a connection
@details
In MySQL support for the KILL statement is cooperative. The KILL
statement only sets a "killed" flag. This function returns the value
of that flag. A thread should check it often, especially inside
time-consuming loops, and gracefully abort the operation if it is
non-zero.
@param thd user thread connection handle
@retval 0 the connection is active
@retval 1 the connection has been killed
*/
int thd_killed(const MYSQL_THD thd);
/**
Return the thread id of a user thread

View file

@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,

View file

@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,

View file

@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
#include <mysql/service_kill_statement.h>
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50,
THD_ABORT_ASAP=100,
};
extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const void*);
} *thd_kill_statement_service;
enum thd_kill_levels thd_kill_level(const void*);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@ -179,7 +189,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,

View file

@ -0,0 +1,71 @@
/* Copyright (c) 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef MYSQL_SERVICE_KILL_STATEMENT_INCLUDED
#define MYSQL_SERVICE_KILL_STATEMENT_INCLUDED
/**
@file
This service provides functions that allow plugins to support
the KILL statement.
In MySQL support for the KILL statement is cooperative. The KILL
statement only sets a "killed" flag. This function returns the value
of that flag. A thread should check it often, especially inside
time-consuming loops, and gracefully abort the operation if it is
non-zero.
thd_is_killed(thd)
@return 0 - no KILL statement was issued, continue normally
@return 1 - there was a KILL statement, abort the execution.
thd_kill_level(thd)
@return thd_kill_levels_enum values
*/
#ifdef __cplusplus
extern "C" {
#endif
enum thd_kill_levels {
THD_IS_NOT_KILLED=0,
THD_ABORT_SOFTLY=50, /**< abort when possible, don't leave tables corrupted */
THD_ABORT_ASAP=100, /**< abort asap */
};
extern struct kill_statement_service_st {
enum thd_kill_levels (*thd_kill_level_func)(const MYSQL_THD);
} *thd_kill_statement_service;
/* backward compatibility helper */
#define thd_killed(THD) (thd_kill_level(THD) == THD_ABORT_ASAP)
#ifdef MYSQL_DYNAMIC_PLUGIN
#define thd_kill_level(THD) \
thd_kill_statement_service->thd_kill_level_func(THD)
#else
enum thd_kill_levels thd_kill_level(const MYSQL_THD);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -24,6 +24,7 @@ extern "C" {
#include <mysql/service_thread_scheduler.h>
#include <mysql/service_progress_report.h>
#include <mysql/service_debug_sync.h>
#include <mysql/service_kill_statement.h>
#ifdef __cplusplus
}

View file

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2011, Monty Program Ab
Copyright (c) 2010, 2013, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -128,39 +128,39 @@ enum enum_server_command
#define HAS_EXPLICIT_VALUE (1 << 26) /* An INSERT/UPDATE operation supplied
an explicit default value */
#define REFRESH_GRANT 1 /* Refresh grant tables */
#define REFRESH_LOG 2 /* Start on new log file */
#define REFRESH_TABLES 4 /* close all tables */
#define REFRESH_HOSTS 8 /* Flush host cache */
#define REFRESH_STATUS 16 /* Flush status variables */
#define REFRESH_THREADS 32 /* Flush thread cache */
#define REFRESH_SLAVE 64 /* Reset master info and restart slave
thread */
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
and truncate the index */
#define REFRESH_GRANT (1UL << 0) /* Refresh grant tables */
#define REFRESH_LOG (1UL << 1) /* Start on new log file */
#define REFRESH_TABLES (1UL << 2) /* close all tables */
#define REFRESH_HOSTS (1UL << 3) /* Flush host cache */
#define REFRESH_STATUS (1UL << 4) /* Flush status variables */
#define REFRESH_THREADS (1UL << 5) /* Flush thread cache */
#define REFRESH_SLAVE (1UL << 6) /* Reset master info and restart slave
thread */
#define REFRESH_MASTER (1UL << 7) /* Remove all bin logs in the index
and truncate the index */
/* The following can't be set with mysql_refresh() */
#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */
#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */
#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */
#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */
#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */
#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */
#define REFRESH_ERROR_LOG (1UL << 8) /* Rotate only the erorr log */
#define REFRESH_ENGINE_LOG (1UL << 9) /* Flush all storage engine logs */
#define REFRESH_BINARY_LOG (1UL << 10) /* Flush the binary log */
#define REFRESH_RELAY_LOG (1UL << 11) /* Flush the relay log */
#define REFRESH_GENERAL_LOG (1UL << 12) /* Flush the general log */
#define REFRESH_SLOW_LOG (1UL << 13) /* Flush the slow query log */
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
#define REFRESH_FAST 32768 /* Intern flag */
#define REFRESH_READ_LOCK (1UL << 14) /* Lock tables for read */
#define REFRESH_CHECKPOINT (1UL << 15) /* With REFRESH_READ_LOCK: block checkpoints too */
/* RESET (remove all queries) from query cache */
#define REFRESH_QUERY_CACHE 65536
#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
#define REFRESH_DES_KEY_FILE 0x40000L
#define REFRESH_USER_RESOURCES 0x80000L
#define REFRESH_CHECKPOINT 0x100000L /* Don't do checkpoints */
#define REFRESH_QUERY_CACHE (1UL << 16) /* clear the query cache */
#define REFRESH_QUERY_CACHE_FREE (1UL << 17) /* pack query cache */
#define REFRESH_DES_KEY_FILE (1UL << 18)
#define REFRESH_USER_RESOURCES (1UL << 19)
#define REFRESH_TABLE_STATS (1L << 20) /* Refresh table stats hash table */
#define REFRESH_INDEX_STATS (1L << 21) /* Refresh index stats hash table */
#define REFRESH_USER_STATS (1L << 22) /* Refresh user stats hash table */
#define REFRESH_CLIENT_STATS (1L << 23) /* Refresh client stats hash table */
#define REFRESH_TABLE_STATS (1UL << 20) /* Refresh table stats hash table */
#define REFRESH_INDEX_STATS (1UL << 21) /* Refresh index stats hash table */
#define REFRESH_USER_STATS (1UL << 22) /* Refresh user stats hash table */
#define REFRESH_CLIENT_STATS (1UL << 23) /* Refresh client stats hash table */
#define REFRESH_FAST (1UL << 31) /* Intern flag */
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
@ -340,7 +340,7 @@ typedef struct st_net {
unsigned char reading_or_writing;
char save_char;
char net_skip_rest_factor;
my_bool unused1; /* Please remove with the next incompatible ABI change */
my_bool thread_specific_malloc;
my_bool compress;
my_bool unused3; /* Please remove with the next incompatible ABI change. */
/*
@ -475,10 +475,10 @@ enum enum_mysql_set_option
extern "C" {
#endif
my_bool my_net_init(NET *net, Vio* vio);
my_bool my_net_init(NET *net, Vio* vio, unsigned int my_flags);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net, my_bool clear_buffer);
void net_clear(NET *net, my_bool clear_buffer);
my_bool net_realloc(NET *net, size_t length);
my_bool net_flush(NET *net);
my_bool my_net_write(NET *net,const unsigned char *packet, size_t len);

View file

@ -19,9 +19,11 @@
#define SERVICE_VERSION void *
#endif
#define VERSION_my_snprintf 0x0100
#define VERSION_thd_alloc 0x0100
#define VERSION_thd_wait 0x0100
#define VERSION_my_thread_scheduler 0x0100
#define VERSION_progress_report 0x0100
#define VERSION_debug_sync 0x1000
#define VERSION_my_snprintf 0x0100
#define VERSION_thd_alloc 0x0100
#define VERSION_thd_wait 0x0100
#define VERSION_my_thread_scheduler 0x0100
#define VERSION_progress_report 0x0100
#define VERSION_debug_sync 0x1000
#define VERSION_kill_statement 0x1000

View file

@ -23,7 +23,7 @@ INCLUDE_DIRECTORIES(
${ZLIB_INCLUDE_DIR})
ADD_DEFINITIONS(${SSL_DEFINES})
SET(CLIENT_API_FUNCTIONS
SET(CLIENT_API_FUNCTIONS_5_1
get_tty_password
handle_options
load_defaults
@ -58,6 +58,7 @@ mysql_field_count
mysql_field_seek
mysql_field_tell
mysql_free_result
mysql_get_parameters
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
@ -129,12 +130,173 @@ mysql_server_init
mysql_server_end
mysql_set_character_set
mysql_get_character_set_info
mysql_stmt_next_result
CACHE INTERNAL "Functions exported by client API"
)
SET(CLIENT_API_FUNCTIONS_5_5
mysql_stmt_next_result
# Client plugins
mysql_client_find_plugin
mysql_client_register_plugin
mysql_load_plugin
mysql_load_plugin_v
mysql_plugin_options
# Async API
mysql_autocommit_cont
mysql_autocommit_start
mysql_change_user_cont
mysql_change_user_start
mysql_close_cont
mysql_close_slow_part_cont
mysql_close_slow_part_start
mysql_close_start
mysql_commit_cont
mysql_commit_start
mysql_fetch_row_cont
mysql_fetch_row_start
mysql_free_result_cont
mysql_free_result_start
mysql_kill_cont
mysql_kill_start
mysql_list_dbs_cont
mysql_list_dbs_start
mysql_list_fields_cont
mysql_list_fields_start
mysql_list_processes_cont
mysql_list_processes_start
mysql_list_tables_cont
mysql_list_tables_start
mysql_next_result_cont
mysql_next_result_start
mysql_ping_cont
mysql_ping_start
mysql_query_cont
mysql_query_start
mysql_read_query_result_cont
mysql_read_query_result_start
mysql_real_connect_cont
mysql_real_connect_start
mysql_real_query_cont
mysql_real_query_start
mysql_refresh_cont
mysql_refresh_start
mysql_rollback_cont
mysql_rollback_start
mysql_select_db_cont
mysql_select_db_start
mysql_send_query_cont
mysql_send_query_start
mysql_set_character_set_cont
mysql_set_character_set_start
mysql_set_server_option_cont
mysql_set_server_option_start
mysql_shutdown_cont
mysql_shutdown_start
mysql_stat_cont
mysql_stat_start
mysql_stmt_close_cont
mysql_stmt_close_start
mysql_stmt_execute_cont
mysql_stmt_execute_start
mysql_stmt_fetch_cont
mysql_stmt_fetch_start
mysql_stmt_free_result_cont
mysql_stmt_free_result_start
mysql_stmt_next_result_cont
mysql_stmt_next_result_start
mysql_stmt_prepare_cont
mysql_stmt_prepare_start
mysql_stmt_reset_cont
mysql_stmt_reset_start
mysql_stmt_send_long_data_cont
mysql_stmt_send_long_data_start
mysql_stmt_store_result_cont
mysql_stmt_store_result_start
mysql_store_result_cont
mysql_store_result_start
#dynamic columns api
dynamic_column_create
dynamic_column_create_many
dynamic_column_update
dynamic_column_update_many
dynamic_column_exists
dynamic_column_list
dynamic_column_get
dynamic_column_prepare_decimal
)
SET(CLIENT_API_FUNCTIONS
${CLIENT_API_FUNCTIONS_5_1}
${CLIENT_API_FUNCTIONS_5_5}
CACHE INTERNAL
"Client functions"
)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# When building RPM, or DEB package on Debian, use ELF symbol versioning
# for compatibility with distribution packages, so client shared library can
# painlessly replace the one supplied by the distribution.
# Also list of exported symbols in distributions may differ from what is considered
# official API. Define CLIENT_API_EXTRA for the set of symbols, that required to
# be exported on different platforms.
IF(RPM)
# Fedora & Co declared following functions as part of API
# These functions are alias of another function (given mysql_ prefix=. The
# renaming is handled in rpm_support.cc below
SET(CLIENT_API_EXTRA
mysql_default_charset_info
mysql_get_charset
mysql_get_charset_by_csname
mysql_net_realloc
mysql_client_errors
)
# Add special script to fix symbols renames by Fedora
SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc)
SET(VERSION_SCRIPT_TEMPLATE
${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in)
ELSEIF(DEB)
# libmyodbc on Ubuntu is using functions below
# If we don't export them, linker would just remove
# them (they are not used inside libmysqlclient)
SET(CLIENT_API_EXTRA
strfill
init_dynamic_string
)
# MySQL supplied with Ubuntu does not have versioning, bug Debian does.
IF(DEB MATCHES "debian")
SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql.ver.in)
ENDIF()
ENDIF()
IF(VERSION_SCRIPT_TEMPLATE)
# Generate version script.
# Create semicolon separated lists of functions to export from
# Since RPM packages use separate versioning for 5.1 API
# and 5.5 API (libmysqlclient_16 vs libmysqlclient_18),
# we need 2 lists.
SET (CLIENT_API_5_1_LIST)
FOREACH (f ${CLIENT_API_FUNCTIONS_5_1})
SET(CLIENT_API_5_1_LIST "${CLIENT_API_5_1_LIST}\n${f};")
ENDFOREACH()
SET (CLIENT_API_5_5_LIST)
FOREACH (f ${CLIENT_API_FUNCTIONS_5_5})
SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\n${f};")
ENDFOREACH()
CONFIGURE_FILE(
${VERSION_SCRIPT_TEMPLATE}
${CMAKE_CURRENT_BINARY_DIR}/libmysql.version
@ONLY@
)
SET(VERSION_SCRIPT_LINK_FLAGS
"-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libmysql.version")
ENDIF()
ENDIF()
SET(CLIENT_SOURCES
get_password.c
libmysql.c
@ -146,6 +308,7 @@ SET(CLIENT_SOURCES
../sql/net_serv.cc
../sql-common/pack.c
../sql/password.c
${CLIENT_SOURCES_EXTRA}
)
ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES})
DTRACE_INSTRUMENT(clientlib)
@ -193,13 +356,13 @@ IF(NOT DISABLE_SHARED)
OUTPUT_NAME mysqlclient
VERSION "${OS_SHARED_LIB_VERSION}"
SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
IF(LINK_FLAG_NO_UNDEFINED)
IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS)
GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS)
IF(NOT libmysql_link_flag)
SET(libmysql_link_flags)
ENDIF()
SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS
"${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED}")
"${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}")
ENDIF()
# clean direct output needs to be set several targets have the same name
#(mysqlclient in this case)

View file

@ -1520,8 +1520,8 @@ mysql_stmt_init(MYSQL *mysql)
DBUG_RETURN(NULL);
}
init_alloc_root(&stmt->mem_root, 2048, 2048);
init_alloc_root(&stmt->result.alloc, 4096, 4096);
init_alloc_root(&stmt->mem_root, 2048, 2048, MYF(MY_THREAD_SPECIFIC));
init_alloc_root(&stmt->result.alloc, 4096, 4096, MYF(MY_THREAD_SPECIFIC));
stmt->result.alloc.min_malloc= sizeof(MYSQL_ROWS);
mysql->stmts= list_add(mysql->stmts, &stmt->list);
stmt->list.data= stmt;
@ -1532,7 +1532,8 @@ mysql_stmt_init(MYSQL *mysql)
strmov(stmt->sqlstate, not_error_sqlstate);
/* The rest of statement members was bzeroed inside malloc */
init_alloc_root(&stmt->extension->fields_mem_root, 2048, 0);
init_alloc_root(&stmt->extension->fields_mem_root, 2048, 0,
MYF(MY_THREAD_SPECIFIC));
DBUG_RETURN(stmt);
}

View file

@ -0,0 +1,48 @@
# This version script is heavily inspired by Fedora's and Mageia's version scripts for
# MySQL client shared library. It is used in MariaDB for building RPMs.
libmysqlclient_16 {
global:
@CLIENT_API_5_1_LIST@
# some stuff from Mageia, I have no idea why it is there
# But too afraid to throw anything away
_fini;
_init;
my_init;
my_progname;
myodbc_remove_escape;
# These are documented in Paul DuBois' MySQL book, so we treat them as part
# of the de-facto API.
free_defaults;
handle_options;
load_defaults;
my_print_help;
# pure-ftpd requires this
my_make_scrambled_password;
# hydra requires this
scramble;
# DBD::mysql requires this
is_prefix;
local:
*;
};
libmysqlclient_18 {
global:
@CLIENT_API_5_5_LIST@
#
# Ideally the following symbols wouldn't be exported, but various applications
# require them. We limit the namespace damage by prefixing mysql_
# (see mysql-dubious-exports.patch), which means the symbols are not present
# in libmysqlclient_16.
#
# mysql-connector-odbc requires these
mysql_default_charset_info;
mysql_get_charset;
mysql_get_charset_by_csname;
mysql_net_realloc;
# PHP's mysqli.so requires this (via the ER() macro)
mysql_client_errors;
};

41
libmysql/rpm_support.cc Normal file
View file

@ -0,0 +1,41 @@
/*
Provide aliases for several symbols, to support drop-in replacement for
MariaDB on Fedora and several derives distributions.
These distributions redefine several symbols (in a way that is no compatible
with either MySQL or MariaDB) and export it from the client library ( as seen
e.g from this patch)
http://lists.fedoraproject.org/pipermail/scm-commits/2010-December/537257.html
MariaDB handles compatibility distribution by providing the same symbols from
the client library if it is built with -DRPM
*/
#include <errmsg.h>
#include <my_sys.h>
#include <mysql.h>
extern "C" {
CHARSET_INFO *mysql_default_charset_info = default_charset_info;
CHARSET_INFO *mysql_get_charset(uint cs_number, myf flags)
{
return get_charset(cs_number, flags);
}
CHARSET_INFO *mysql_get_charset_by_csname(const char *cs_name,
uint cs_flags, myf my_flags)
{
return get_charset_by_csname(cs_name, cs_flags, my_flags);
}
my_bool mysql_net_realloc(NET *net, size_t length)
{
return net_realloc(net,length);
}
const char **mysql_client_errors = client_errors;
} /*extern "C" */

View file

@ -150,8 +150,21 @@ IF(UNIX)
${CMAKE_STATIC_LIBRARY_PREFIX}mysqld-debug)
ENDIF()
# List of exported functions in embedded (client api except client plugin or
# async (*_start/*_cont functions)
SET(EMBEDDED_API)
FOREACH(f ${CLIENT_API_FUNCTIONS})
IF(f MATCHES "plugin|_start$|_cont$")
# Ignore functions, embedded does not export them
ELSE()
SET(EMBEDDED_API ${EMBEDDED_API} ${f})
ENDIF()
ENDFOREACH()
IF(NOT DISABLE_SHARED)
MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${CLIENT_API_FUNCTIONS}
MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API}
COMPONENT Server)
IF(UNIX)
# Name the shared library, handle versioning (provides same api as client

View file

@ -415,7 +415,7 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
if (!data)
goto err;
init_alloc_root(&data->alloc, 8192,0);
init_alloc_root(&data->alloc, 8192,0,MYF(0));
f_alloc= &data->alloc;
data->fields= src->load_int();

View file

@ -520,7 +520,8 @@ int init_embedded_server(int argc, char **argv, char **groups)
if (!groups)
groups= (char**) fake_groups;
my_progname= (char *)"mysql_embedded";
if (!my_progname)
my_progname= (char *)"mysql_embedded";
/*
Perform basic logger initialization logger. Should be called after
@ -634,7 +635,7 @@ void init_embedded_mysql(MYSQL *mysql, int client_flag)
mysql->server_version= server_version;
mysql->client_flag= client_flag;
//mysql->server_capabilities= client_flag;
init_alloc_root(&mysql->field_alloc, 8192, 0);
init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(0));
}
/**
@ -906,8 +907,9 @@ int Protocol::begin_dataset()
if (!data)
return 1;
alloc= &data->alloc;
init_alloc_root(alloc,8192,0); /* Assume rowlength < 8192 */
alloc->min_malloc=sizeof(MYSQL_ROWS);
/* Assume rowlength < 8192 */
init_alloc_root(alloc, 8192, 0, MYF(0));
alloc->min_malloc= sizeof(MYSQL_ROWS);
return 0;
}

View file

@ -21,7 +21,8 @@ SET(MYSQLSERVICES_SOURCES
thd_wait_service.c
my_thread_scheduler_service.c
progress_report_service.c
debug_sync_service.c)
debug_sync_service.c
kill_statement_service.c)
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)

View file

@ -0,0 +1,18 @@
/* Copyright (c) 2013, Monty Program Ab.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <service_versions.h>
SERVICE_VERSION thd_kill_statement_service= (void*)VERSION_kill_statement;

View file

@ -0,0 +1,10 @@
#
# suite.pm will make sure that all tests including this file
# will be skipped unless innodb or xtradb is enabled
#
# The test below is redundant
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'cassandra' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
{
--skip Test requires Cassandra.
}

View file

@ -0,0 +1 @@
--plugin-load=$HA_CASSANDRA_SO --loose-cassandra=on

View file

@ -58,9 +58,7 @@
--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
--let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
# Make the script executable and execute it.
--chmod 0755 $perlChecker
--exec $perlChecker
--exec perl $perlChecker
# Source the resulting temporary file and look for a variable being set.
--source $resultFile

View file

@ -41,3 +41,4 @@ ha_blackhole storage/blackhole BLACKHOLE_PLUGIN
ha_federated storage/federated FEDERATED_PLUGIN
mypluglib plugin/fulltext SIMPLE_PARSER
libdaemon_example plugin/daemon_example DAEMONEXAMPLE
adt_null plugin/audit_null AUDIT_NULL

View file

@ -8,6 +8,7 @@
# --let $rpl_server_number= N
# [--let $rpl_server_parameters= --flag1 --flag2 ...]
# [--let $rpl_debug= 1]
# [--let $rpl_server_error= 0]
# --source include/rpl_start_server.inc
#
# Parameters:
@ -21,6 +22,9 @@
# If set, extra parameters given by this variable are passed to
# mysqld.
#
# $rpl_server_error
# If set, failure of the server startup is expected.
#
# $rpl_debug
# See include/rpl_init.inc
#
@ -47,8 +51,9 @@ if ($rpl_server_parameters)
# Write file to make mysql-test-run.pl start up the server again
--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--source include/rpl_reconnect.inc
--let $include_filename= rpl_start_server.inc $_rpl_start_server_args
--source include/end_include_file.inc
if (!$rpl_server_error)
{
--source include/rpl_reconnect.inc
--let $include_filename= rpl_start_server.inc $_rpl_start_server_args
--source include/end_include_file.inc
}

View file

@ -3229,6 +3229,8 @@ sub install_db ($$) {
# for a production system
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
mtr_appendfile_to_file("$path_sql_dir/mysql_performance_tables.sql",
$bootstrap_sql_file);
# Add the mysql system tables initial data
# for a production system

View file

@ -3525,6 +3525,11 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
# Add the performance tables
# for a production system
mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql",
$bootstrap_sql_file);
# Add the mysql system tables initial data
# for a production system
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
@ -3593,9 +3598,10 @@ sub mysql_install_db {
verbose => $opt_verbose,
) != 0)
{
my $data= mtr_grab_file($path_bootstrap_log);
mtr_error("Error executing mysqld --bootstrap\n" .
"Could not install system database from $bootstrap_sql_file\n" .
"see $path_bootstrap_log for errors");
"The $path_bootstrap_log file contains:\n$data\n");
}
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,593 @@
drop table if exists t0, t1;
create table t1 (a int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
ERROR 42000: This table type requires a primary key
create table t1 (a int primary key, b int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace foo does not exist]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='127.0.0.2' keyspace='foo' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: connect() failed: Connection refused [1]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
thrift_host='localhost' keyspace='no_such_keyspace';
ERROR HY000: Unable to connect to foreign data source: keyspace and column_family table options must be specified
# Now, create a table for real and insert data
create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra
thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1';
# Just in case there were left-overs from previous:
delete from t1;
select * from t1;
pk data1 data2
insert into t1 values ('rowkey10', 'data1-value', 123456);
insert into t1 values ('rowkey11', 'data1-value2', 34543);
insert into t1 values ('rowkey12', 'data1-value3', 454);
select * from t1;
pk data1 data2
rowkey12 data1-value3 454
rowkey10 data1-value 123456
rowkey11 data1-value2 34543
explain
select * from t1 where pk='rowkey11';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 38 const 1
select * from t1 where pk='rowkey11';
pk data1 data2
rowkey11 data1-value2 34543
delete from t1 where pk='rowkey11';
select * from t1;
pk data1 data2
rowkey12 data1-value3 454
rowkey10 data1-value 123456
delete from t1;
select * from t1;
pk data1 data2
#
# A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ,
# also check ::rnd_pos()
#
insert into t1 values ('rowkey10', 'data1-value', 123456);
insert into t1 values ('rowkey11', 'data1-value2', 34543);
insert into t1 values ('rowkey12', 'data1-value3', 454);
select * from t1 order by data2;
pk data1 data2
rowkey12 data1-value3 454
rowkey11 data1-value2 34543
rowkey10 data1-value 123456
delete from t1;
drop table t1;
#
# MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
#
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
#
# Batched INSERT
#
show variables like 'cassandra_insert_batch_size';
Variable_name Value
cassandra_insert_batch_size 100
show status like 'cassandra_row_insert%';
Variable_name Value
Cassandra_row_insert_batches 7
Cassandra_row_inserts 8
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
delete from t1;
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
show status like 'cassandra_row_insert%';
Variable_name Value
Cassandra_row_insert_batches 8
Cassandra_row_inserts 10
# FLUSH STATUS doesn't work for our variables, just like with InnoDB.
flush status;
show status like 'cassandra_row_insert%';
Variable_name Value
Cassandra_row_insert_batches 0
Cassandra_row_inserts 0
#
# Batched Key Access
#
# Control variable (we are not yet able to make use of MRR's buffer)
show variables like 'cassandra_multi%';
Variable_name Value
cassandra_multiget_batch_size 100
# MRR-related status variables:
show status like 'cassandra_multi%';
Variable_name Value
Cassandra_multiget_keys_scanned 0
Cassandra_multiget_reads 0
Cassandra_multiget_rows_read 0
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
delete from t1;
INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
set @tmp_jcl=@@join_cache_level;
set join_cache_level=8;
explain select * from t1 A, t1 B where B.rowkey=A.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A ALL NULL NULL NULL NULL 1000 Using where
1 SIMPLE B eq_ref PRIMARY PRIMARY 8 test.A.a 1 Using join buffer (flat, BKAH join); multiget_slice
select * from t1 A, t1 B where B.rowkey=A.a;
rowkey a rowkey a
0 0 0 0
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
6 6 6 6
7 7 7 7
8 8 8 8
9 9 9 9
show status like 'cassandra_multi%';
Variable_name Value
Cassandra_multiget_keys_scanned 10
Cassandra_multiget_reads 1
Cassandra_multiget_rows_read 10
insert into t1 values(1, 8);
insert into t1 values(3, 8);
insert into t1 values(5, 8);
insert into t1 values(7, 8);
select * from t1 A, t1 B where B.rowkey=A.a;
rowkey a rowkey a
0 0 0 0
2 2 2 2
4 4 4 4
6 6 6 6
1 8 8 8
7 8 8 8
8 8 8 8
5 8 8 8
3 8 8 8
9 9 9 9
show status like 'cassandra_multi%';
Variable_name Value
Cassandra_multiget_keys_scanned 16
Cassandra_multiget_reads 2
Cassandra_multiget_rows_read 16
delete from t1;
drop table t1;
#
# MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
#
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
INSERT INTO t1 VALUES (0,0),(1,1),(2,2);
truncate table t1;
select * from t1;
rowkey a
drop table t1;
#
# MDEV-494, part #1: phantom row for big full-scan selects
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
insert into t1 select A.a + 10 * B.a + 100*C.a, 12345 from t0 A, t0 B, t0 C;
select count(*) from t1;
count(*)
1000
select count(*) from t1 where a=12345;
count(*)
1000
delete from t1;
drop table t1;
drop table t0;
# 32-bit INT type support
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, intcol INT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3';
insert into t1 values (10,10);
insert into t1 values (12,12);
delete from t1;
drop table t1;
#
# Try accessing column family w/o explicitly defined columns
#
CREATE TABLE t1 (my_primary_key varchar(10) PRIMARY KEY) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10';
ERROR HY000: Internal error: 'target column family has no key_alias defined, PRIMARY KEY column must be named 'rowkey''
CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10';
DROP TABLE t1;
#
# Timestamp datatype support
#
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
delete from t2;
insert into t2 values (1, '2012-08-29 01:23:45');
select * from t2;
rowkey datecol
1 2012-08-29 01:23:45
delete from t2;
# MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system
INSERT INTO t2 VALUES (10,'2012-12-12 12:12:12');
SELECT * FROM t2;
rowkey datecol
10 2012-12-12 12:12:12
delete from t2;
#
# (no MDEV#) Check that insert counters work correctly
#
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
set cassandra_insert_batch_size=10;
insert into t2 select A.a+10*B.a, now() from t0 A, t0 B;
inserts insert_batches
100 10
set cassandra_insert_batch_size=1;
insert into t2 select A.a+10*B.a+100, now() from t0 A, t0 B;
inserts insert_batches
100 100
delete from t2;
drop table t2;
drop table t0;
#
# UUID datatype support
#
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
delete from t2;
insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09');
insert into t2 values(2,'not-an-uuid');
ERROR 22003: Out of range value for column 'uuidcol' at row 1
insert into t2 values(3,'9b5658dc-f32f-11e1=94cd-f46d046e9f09');
ERROR 22003: Out of range value for column 'uuidcol' at row 1
insert into t2 values(4,'9b5658dc-fzzf-11e1-94cd-f46d046e9f09');
ERROR 22003: Out of range value for column 'uuidcol' at row 1
insert into t2 values
(5,'9b5658dc-f11f-11e1-94cd-f46d046e9f09'),
(6,'9b5658dc-f11f011e1-94cd-f46d046e9f09');
ERROR 22003: Out of range value for column 'uuidcol' at row 2
select * from t2;
rowkey uuidcol
1 9b5658dc-f32f-11e1-94cd-f46d046e9f09
5 9b5658dc-f11f-11e1-94cd-f46d046e9f09
delete from t2;
drop table t2;
CREATE TABLE t2 (rowkey char(36) PRIMARY KEY, col1 int) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf6';
delete from t2;
insert into t2 values('9b5658dc-f32f-11e1-94cd-f46d046e9f09', 1234);
insert into t2 values('not-an-uuid', 563);
ERROR 22003: Out of range value for column 'rowkey' at row 1
select * from t2;
rowkey col1
9b5658dc-f32f-11e1-94cd-f46d046e9f09 1234
delete from t2;
drop table t2;
#
# boolean datatype support
#
CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7';
insert into t2 values (0, 0);
insert into t2 values (1, 1);
select * from t2;
rowkey boolcol
0 0
1 1
delete from t2;
drop table t2;
#
# Counter datatype support (read-only)
#
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8';
select * from t2;
rowkey countercol
cnt1 1
cnt2 100
drop table t2;
#
# Check that @@cassandra_default_thrift_host works
#
show variables like 'cassandra_default_thrift_host';
Variable_name Value
cassandra_default_thrift_host
set @tmp=@@cassandra_default_thrift_host;
set cassandra_default_thrift_host='localhost';
ERROR HY000: Variable 'cassandra_default_thrift_host' is a GLOBAL variable and should be set with SET GLOBAL
set global cassandra_default_thrift_host='localhost';
# Try creating a table without specifying thrift_host:
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA
keyspace='mariadbtest2' column_family = 'cf8';
select * from t2;
rowkey countercol
cnt1 1
cnt2 100
drop table t2;
set global cassandra_default_thrift_host=@tmp;
#
# Consistency settings
#
show variables like 'cassandra_%consistency';
Variable_name Value
cassandra_read_consistency ONE
cassandra_write_consistency ONE
set @tmp=@@cassandra_write_consistency;
# Unfortunately, there is no easy way to check if setting have the effect..
set cassandra_write_consistency='ONE';
set cassandra_write_consistency='QUORUM';
set cassandra_write_consistency='LOCAL_QUORUM';
set cassandra_write_consistency='EACH_QUORUM';
set cassandra_write_consistency='ALL';
set cassandra_write_consistency='ANY';
set cassandra_write_consistency='TWO';
set cassandra_write_consistency='THREE';
set cassandra_write_consistency=@tmp;
#
# varint datatype support
#
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(32)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9';
select rowkey, hex(varint_col) from t2;
rowkey hex(varint_col)
val-01 01
val-0x123456 123456
val-0x12345678 12345678
drop table t2;
# now, let's check what happens when MariaDB's column is not wide enough:
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9';
select rowkey, hex(varint_col) from t2;
ERROR HY000: Internal error: 'Unable to convert value for field `varint_col` from Cassandra's data format. Source data is 4 bytes, 0x12345678'
drop table t2;
#
# Decimal datatype support
#
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11';
select rowkey, hex(decimal_col) from t2;
rowkey hex(decimal_col)
val_1.5 000000010F
val_0.5 0000000105
val_1234 0000000004D2
drop table t2;
#
# Mapping TIMESTAMP -> int64
#
set @save_tz= @@time_zone;
set time_zone='UTC';
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
insert into t2 values (1, '2012-08-29 01:23:45');
INSERT INTO t2 VALUES (10,'2012-08-29 01:23:46');
drop table t2;
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
select * from t2;
rowkey datecol
1 1346203425000
10 1346203426000
delete from t2;
drop table t2;
set time_zone=@save_tz;
#
# Check whether changing parameters with ALTER TABLE works.
#
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11';
drop table t2;
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11';
alter table t2 column_family='cf12';
Writes made during ALTER TABLE
0
drop table t2;
#
# UPDATE command support
#
create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra
thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1';
insert into t1 values ('rowkey10', 'data1-value', 123456);
insert into t1 values ('rowkey11', 'data1-value2', 34543);
insert into t1 values ('rowkey12', 'data1-value3', 454);
select * from t1;
pk data1 data2
rowkey12 data1-value3 454
rowkey10 data1-value 123456
rowkey11 data1-value2 34543
update t1 set data1='updated-1' where pk='rowkey11';
select * from t1;
pk data1 data2
rowkey12 data1-value3 454
rowkey10 data1-value 123456
rowkey11 updated-1 34543
update t1 set pk='new-rowkey12' where pk='rowkey12';
select * from t1;
pk data1 data2
rowkey10 data1-value 123456
new-rowkey12 data1-value3 454
rowkey11 updated-1 34543
delete from t1;
drop table t1;
#
# Dynamic columns support
#
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
drop table t2;
#error: dynamic column is not a blob
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36) DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
ERROR 42000: Incorrect column specifier for column 'uuidcol'
#error: double dynamic column
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1, textcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
ERROR 42000: Incorrect column specifier for column 'textcol'
#
# Dynamic column read
#
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
delete from t2;
insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09');
insert into t2 values(2,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a');
drop table t2;
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
select rowkey, column_list(dyn), column_get(dyn, 'uuidcol' as char) from t2;
rowkey column_list(dyn) column_get(dyn, 'uuidcol' as char)
1 `uuidcol` 9b5658dc-f32f-11e1-94cd-f46d046e9f09
2 `uuidcol` 9b5658dc-f32f-11e1-94cd-f46d046e9f0a
drop table t2;
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
delete from t2;
drop table t2;
#
# Dynamic column insert
#
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
insert into t2 values (1, column_create("dyn1", 1, "dyn2", "two"));
select rowkey, column_json(dyn) from t2;
rowkey column_json(dyn)
1 {"dyn1":"1","dyn2":"two"}
delete from t2;
drop table t2;
# bigint
CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'a', 254324));
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'a', 2543));
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"a":254324,"dyn1":"1","dyn2":"two"}
2 {"a":2543,"dyn1":"1","dyn2":"two"}
delete from t1;
drop table t1;
# int
CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3';
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'intcol', 254324));
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543));
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"dyn1":"1","dyn2":"two","intcol":254324}
2 {"dyn1":"1","dyn2":"two","intcol":2543}
delete from t1;
drop table t1;
# timestamp
CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'datecol', 254324));
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'datecol', 2543));
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"dyn1":"1","dyn2":"two","datecol":254324}
2 {"dyn1":"1","dyn2":"two","datecol":2543}
delete from t1;
drop table t1;
# boolean
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7';
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 254324));
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 0));
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"dyn1":"1","dyn2":"two","boolcol":1}
2 {"dyn1":"1","dyn2":"two","boolcol":0}
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"dyn1":"1","dyn2":"two","boolcol":1}
2 {"dyn1":"1","dyn2":"two","boolcol":0}
update t1 set dyn=column_add(dyn, "dyn2", null, "dyn3", "3");
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"dyn1":"1","dyn3":"3","boolcol":1}
2 {"dyn1":"1","dyn3":"3","boolcol":0}
update t1 set dyn=column_add(dyn, "dyn1", null) where rowkey= 1;
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"dyn3":"3","boolcol":1}
2 {"dyn1":"1","dyn3":"3","boolcol":0}
update t1 set dyn=column_add(dyn, "dyn3", null, "a", "ddd");
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"a":"ddd","boolcol":1}
2 {"a":"ddd","dyn1":"1","boolcol":0}
update t1 set dyn=column_add(dyn, "12345678901234", "ddd");
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"a":"ddd","boolcol":1,"12345678901234":"ddd"}
2 {"a":"ddd","dyn1":"1","boolcol":0,"12345678901234":"ddd"}
update t1 set dyn=column_add(dyn, "12345678901234", null);
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"a":"ddd","boolcol":1}
2 {"a":"ddd","dyn1":"1","boolcol":0}
update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2;
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"a":"ddd","boolcol":1}
2 {"a":"ddd","dyn1":"1"}
update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2;
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
1 {"a":"ddd","boolcol":1}
3 {"a":"ddd","boolcol":0}
delete from t1;
drop table t1;
CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1';
select * from t1;
ERROR HY000: Internal error: 'Unable to convert value for field `dyn` from Cassandra's data format. Name length exceed limit of 16383: 'very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_v'
drop table t1;
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
DELETE FROM t1;
insert into t1 values (1, column_create("dyn", 1));
select rowkey, column_list(dyn) from t1;
rowkey column_list(dyn)
1 `dyn`
delete from t1;
DROP TABLE t1;
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a');
ERROR HY000: Encountered illegal format of dynamic column string
delete from t1;
DROP TABLE t1;
#
# MDEV-565: Server crashes in ha_cassandra::write_row on
# inserting NULL into a dynamic column
#
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
insert into t1 values (1, NULL);
delete from t1;
DROP TABLE t1;
#
# strange side effect of Cassandra - remiving all columns of primary
# key removes all row.
#
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
INSERT INTO t1 VALUES(2,column_create("ab","ab"));
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
2 {"ab":"ab"}
UPDATE t1 set dyn=NULL;
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
INSERT INTO t1 VALUES(2,column_create("ab","ab"));
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
2 {"ab":"ab"}
UPDATE t1 set dyn="";
select rowkey, column_json(dyn) from t1;
rowkey column_json(dyn)
delete from t1;
DROP TABLE t1;
#
# MDEV-4005 #Server crashes on creating a Cassandra table
# with a mix of static and dynamic columns
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (
pk int primary key,
col_int int,
dyncol blob DYNAMIC_COLUMN_STORAGE=yes
) ENGINE=cassandra keyspace='bug' thrift_host = '127.0.0.1' column_family='cf1';
drop table t1;

View file

@ -0,0 +1,5 @@
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 08S01: Unknown command
ERROR 08S01: Unknown command

View file

@ -3,3 +3,5 @@ Name Location Comment
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
Sheeri Kritzer Boston, Mass. USA EFF contribution for UC2006 Auction
Mark Shuttleworth London, UK. EFF contribution for UC2006 Auction
Warnings:
Warning 1681 'SHOW CONTRIBUTORS' is deprecated and will be removed in a future release.

View file

@ -1762,7 +1762,9 @@ t1 CREATE TABLE `t1` (
`TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000',
`STAGE` tinyint(2) NOT NULL DEFAULT '0',
`MAX_STAGE` tinyint(2) NOT NULL DEFAULT '0',
`PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000'
`PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000',
`MEMORY_USED` int(7) NOT NULL DEFAULT '0',
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
drop table t1;
create temporary table t1 like information_schema.processlist;
@ -1780,7 +1782,9 @@ t1 CREATE TEMPORARY TABLE `t1` (
`TIME_MS` decimal(22,3) NOT NULL DEFAULT '0.000',
`STAGE` tinyint(2) NOT NULL DEFAULT '0',
`MAX_STAGE` tinyint(2) NOT NULL DEFAULT '0',
`PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000'
`PROGRESS` decimal(7,3) NOT NULL DEFAULT '0.000',
`MEMORY_USED` int(7) NOT NULL DEFAULT '0',
`EXAMINED_ROWS` int(7) NOT NULL DEFAULT '0'
) DEFAULT CHARSET=utf8
drop table t1;
create table t1 like information_schema.character_sets;

View file

@ -0,0 +1,3 @@
drop table if exists t1;
Starting test
# All done

View file

@ -191,6 +191,32 @@ t1 CREATE TABLE `t1` (
`r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# Bug #51876 : crash/memory underrun when loading data with ucs2
# and reverse() function
#
# Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
# Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 0 and 1 (10 reversed)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
create table t2(f1 Char(30));
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
select lpad(f1, 12, "-o-/") from t2;

View file

@ -1140,6 +1140,14 @@ id l
a 512
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
UNION ALL
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
id l
a 512
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
#
# End of 5.5 tests
#

View file

@ -5055,6 +5055,14 @@ id l
a 1024
Warnings:
Warning 1260 Row 2 was cut by GROUP_CONCAT()
SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
UNION ALL
SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
id l
a 1024
Warnings:
Warning 1260 Row 2 was cut by GROUP_CONCAT()
#
# End of 5.5 tests
#

View file

@ -4,5 +4,5 @@ insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
select * from t1;
d
NULL
NULL
0000-00-00 00:00:00
drop table t1;

View file

@ -2115,6 +2115,55 @@ a
4
drop table t1,t2;
#
# MDEV-3873: Wrong result (extra rows) with NOT IN and
# a subquery from a MERGE view
#
CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(7),(0);
CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t3 VALUES (4),(6),(3);
CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t4 VALUES (4),(5),(3);
CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM;
INSERT INTO tv VALUES (1),(3);
CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv;
CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
SELECT * FROM t1, t2
WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b;
a b
SELECT * FROM t1, t2
WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b;
a b
SELECT * FROM t1, t2
WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b;
a b
drop view v_temptable, v_merge;
drop table t1,t2,t3,t4,tv;
#
# MDEV-3912: Wrong result (extra rows) with FROM subquery inside
# ALL subquery, LEFT JOIN, derived_merge.
# (duplicate of MDEV-3873 (above))
#
SET @save3912_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4),(8);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (7),(0);
CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t3 VALUES (0,4),(8,6);
SELECT * FROM t1
WHERE a >= ALL (
SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b )
WHERE b >= a
);
a
8
set optimizer_switch=@save3912_optimizer_switch;
drop table t1, t2, t3;
#
# end of 5.3 tests
#
set optimizer_switch=@exit_optimizer_switch;

View file

@ -847,6 +847,38 @@ time(f1)
00:00:00.000200
00:00:00.000300
drop table t1;
create table t1(i int, g int);
insert into t1 values (null, 1), (0, 2);
select distinct i from t1 group by g;
i
NULL
0
drop table t1;
create table t1(i int, g blob);
insert into t1 values (null, 1), (0, 2);
select distinct i from t1 group by g;
i
NULL
0
drop table t1;
create table t1 (a int) engine=myisam;
insert into t1 values (0),(7);
create table t2 (b int) engine=myisam;
insert into t2 values (7),(0),(3);
create algorithm=temptable view v as
select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
select * from v;
field1
NULL
0
7
select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
field1
NULL
0
7
drop view v;
drop table t1, t2;
#
# Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
#

View file

@ -1088,7 +1088,7 @@ column_list(column_add(column_create(1, 1), 1, null))
select column_list(column_add(column_create(1, 1), 1, ""));
column_list(column_add(column_create(1, 1), 1, ""))
1
`1`
select hex(column_add("", 1, 1));
hex(column_add("", 1, 1))
00010001000002
@ -1133,10 +1133,10 @@ column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4)
# column list
select column_list(column_create(1, 1212 as integer, 2, 1212 as integer));
column_list(column_create(1, 1212 as integer, 2, 1212 as integer))
1,2
`1`,`2`
select column_list(column_create(1, 1212 as integer));
column_list(column_create(1, 1212 as integer))
1
`1`
select column_list(column_create(1, NULL as integer));
column_list(column_create(1, NULL as integer))
@ -1218,35 +1218,35 @@ sum(column_get(str, 1 as int))
11
select id, column_list(str) from t1 where id= 5;
id column_list(str)
5 1,2,3,10
5 `1`,`2`,`3`,`10`
update t1 set str=column_delete(str, 3, 4, 2) where id= 5;
select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1;
id length(str) column_list(str) column_get(str, 1 as int) column_get(str, 2 as char) column_get(str, 3 as int)
1 12 1,2 1 a NULL
2 12 1,2 2 a NULL
3 12 2,3 NULL c 100
4 16 1,2,3 5 c 100
5 15 1,10 6 NULL NULL
6 21 2,3,10 NULL c 100
1 12 `1`,`2` 1 a NULL
2 12 `1`,`2` 2 a NULL
3 12 `2`,`3` NULL c 100
4 16 `1`,`2`,`3` 5 c 100
5 15 `1`,`10` 6 NULL NULL
6 21 `2`,`3`,`10` NULL c 100
update t1 set str=column_add(str, 4, 45 as char, 2, 'c') where id= 5;
select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1 where id = 5;
id length(str) column_list(str) column_get(str, 1 as int) column_get(str, 2 as char) column_get(str, 3 as int)
5 26 1,2,4,10 6 c NULL
5 26 `1`,`2`,`4`,`10` 6 c NULL
select id, length(str), column_list(str), column_exists(str, 4) from t1;
id length(str) column_list(str) column_exists(str, 4)
1 12 1,2 0
2 12 1,2 0
3 12 2,3 0
4 16 1,2,3 0
5 26 1,2,4,10 1
6 21 2,3,10 0
1 12 `1`,`2` 0
2 12 `1`,`2` 0
3 12 `2`,`3` 0
4 16 `1`,`2`,`3` 0
5 26 `1`,`2`,`4`,`10` 1
6 21 `2`,`3`,`10` 0
select sum(column_get(str, 1 as int)), column_list(str) from t1 group by 2;
sum(column_get(str, 1 as int)) column_list(str)
3 1,2
5 1,2,3
6 1,2,4,10
NULL 2,3
NULL 2,3,10
3 `1`,`2`
5 `1`,`2`,`3`
6 `1`,`2`,`4`,`10`
NULL `2`,`3`
NULL `2`,`3`,`10`
select id, hex(str) from t1;
id hex(str)
1 00020001000002000B020861
@ -1282,11 +1282,11 @@ id
5
select id, column_list(str), length(str) from t1 where id=5;
id column_list(str) length(str)
5 1,2,4,5,10 100048
5 `1`,`2`,`4`,`5`,`10` 100048
update t1 set str=column_delete(str, 5) where id=5;
select id, column_list(str), length(str) from t1 where id=5;
id column_list(str) length(str)
5 1,2,4,10 34
5 `1`,`2`,`4`,`10` 34
drop table t1;
#
# LP#778905: Assertion `value->year <= 9999' failed in
@ -1306,7 +1306,7 @@ INSERT INTO t1 SET f1 = COLUMN_CREATE( 2 , 'cde' );
SELECT HEX(COLUMN_ADD(f1, 1, 'abc')), COLUMN_LIST(f1) FROM t1;
HEX(COLUMN_ADD(f1, 1, 'abc')) COLUMN_LIST(f1)
NULL NULL
0002000100030200230861626308636465 2
0002000100030200230861626308636465 `2`
SELECT COLUMN_ADD(f1, 1, 'abc'), COLUMN_LIST(f1) FROM t1;
DROP TABLE t1;
#
@ -1335,3 +1335,305 @@ hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))
select hex(COLUMN_CREATE(0, 0.0 as decimal));
hex(COLUMN_CREATE(0, 0.0 as decimal))
000100000004
#
# test of symbolic names
#
# creation test (names)
set names utf8;
select hex(column_create("адын", 1212));
hex(column_create("адын", 1212))
040100080000000000D0B0D0B4D18BD0BD7809
select hex(column_create("1212", 1212));
hex(column_create("1212", 1212))
040100040000000000313231327809
select hex(column_create(1212, 2, "www", 3));
hex(column_create(1212, 2, "www", 3))
04020007000000000003001000777777313231320604
select hex(column_create("1212", 2, "www", 3));
hex(column_create("1212", 2, "www", 3))
04020007000000000003001000777777313231320604
select hex(column_create("1212", 2, 3, 3));
hex(column_create("1212", 2, 3, 3))
0402000500000000000100100033313231320604
select hex(column_create("1212", 2, "адын", 1, 3, 3));
hex(column_create("1212", 2, "адын", 1, 3, 3))
0403000D000000000001001000050020003331323132D0B0D0B4D18BD0BD060402
set names default;
# fetching column test (names)
set names utf8;
select column_get(column_create("адын", 1212), "адын" as int);
column_get(column_create("адын", 1212), "адын" as int)
1212
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int)
1
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int)
2
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int)
3
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int)
3
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int)
NULL
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int)
NULL
set names default;
# column existance test (names)
set names utf8;
select column_exists(column_create("адын", 1212), "адын");
column_exists(column_create("адын", 1212), "адын")
1
select column_exists(column_create("адын", 1212), "aады");
column_exists(column_create("адын", 1212), "aады")
0
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын");
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын")
1
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212);
column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212)
1
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3")
1
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3)
1
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4)
0
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4")
0
set names default;
# column changing test (names)
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
hex(column_add(column_create(1, "AAA"), "b", "BBB"))
0402000200000003000100430031620841414108424242
select hex(column_add(column_create("1", "AAA"), "b", "BBB"));
hex(column_add(column_create("1", "AAA"), "b", "BBB"))
0402000200000003000100430031620841414108424242
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char);
column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char)
AAA
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char);
column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char)
BBB
select hex(column_add(column_create("a", "AAA"), 1, "BBB"));
hex(column_add(column_create("a", "AAA"), 1, "BBB"))
0402000200000003000100430031610842424208414141
select hex(column_add(column_create("a", "AAA"), "1", "BBB"));
hex(column_add(column_create("a", "AAA"), "1", "BBB"))
0402000200000003000100430031610842424208414141
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer));
hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer))
04020002000000000001002000616278097809
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer));
hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer))
040100010000000000617809
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer));
hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer))
0400000000
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer));
hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer))
040100010000000000617809
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer));
hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer))
040200020000000000010010006162167809
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer);
column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer)
11
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer);
column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer)
1212
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer));
hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer))
040200020000000000010020006162780916
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer));
hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer))
040200020000000000010020006162780916
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer));
hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer))
040200020000000000010010006162167809
select hex(column_add(column_create("a", 1), "a", null));
hex(column_add(column_create("a", 1), "a", null))
0400000000
select column_list(column_add(column_create("a", 1), "a", null));
column_list(column_add(column_create("a", 1), "a", null))
select column_list(column_add(column_create("a", 1), "a", ""));
column_list(column_add(column_create("a", 1), "a", ""))
`a`
select hex(column_add("", "a", 1));
hex(column_add("", "a", 1))
0401000100000000006102
# column delete (names)
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"));
hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"))
040100010000000000627809
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"))
0402000200000000000100100061630206
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer));
hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer))
0403000300000000000100100002002000616263020406
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"))
0402000200000000000100100061620204
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"))
0403000300000000000100100002002000616263020406
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"))
0401000100000000006306
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"))
0401000100000000006102
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"))
0400000000
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"));
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"))
0400000000
select hex(column_delete(column_create("a", 1), "a"));
hex(column_delete(column_create("a", 1), "a"))
0400000000
select hex(column_delete("", "a"));
hex(column_delete("", "a"))
#
# MDEV-458 DNAMES: Server crashes on using an unquoted string
# as a dynamic column name
#
select COLUMN_CREATE(color, "black");
ERROR 42S22: Unknown column 'color' in 'field list'
#
# MDEV-489 Assertion `offset < 0x1f' failed in
# type_and_offset_store on COLUMN_ADD
#
CREATE TABLE t1 (f1 tinyblob);
INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
select column_check(f1) from t1;
column_check(f1)
1
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' );
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
select column_check(f1) from t1;
column_check(f1)
0
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
select column_check(f1) from t1;
column_check(f1)
0
drop table t1;
#
# MDEV-490/MDEV-491 null as arguments
#
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR );
COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR )
NULL
SELECT COLUMN_GET( NULL, 'col' as char );
COLUMN_GET( NULL, 'col' as char )
NULL
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL);
COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL)
NULL
SELECT COLUMN_EXISTS( NULL, 'col');
COLUMN_EXISTS( NULL, 'col')
NULL
SELECT COLUMN_CREATE( NULL, 'val' );
COLUMN_CREATE( NULL, 'val' )
NULL
SELECT COLUMN_ADD( NULL, 'val', 'col');
COLUMN_ADD( NULL, 'val', 'col')
NULL
#
# MDEV-488: Assertion `column_name->length < 255' failed on a
# column name with length 255 (precisely)
#
SELECT hex(COLUMN_CREATE(REPEAT('a',255),1));
hex(COLUMN_CREATE(REPEAT('a',255),1))
040100FF000000000061616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616102
SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
ERROR 22007: Illegal value used as argument of dynamic column function
#
# JSON conversion
#
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001"
{"int":-1212,"date":"2011-04-05","time":"00:45:49.000001","uint":12334,"double":"1.2e50","string":"gdgd\\dhdjh\"dhdhd","decimal":23.344,"datetime":"2011-04-05 00:45:49.000001"}
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date))
{"1":-1212,"2":12334,"3":23.344,"4":"1.2e50","5":"gdgd\\dhdjh\"dhdhd","6":"00:45:49.000001","7":"2011-04-05 00:45:49.000001","8":"2011-04-05"}
#
# CHECK test
#
SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
COLUMN_CHECK(COLUMN_CREATE(1,'a'))
1
SELECT COLUMN_CHECK('abracadabra');
COLUMN_CHECK('abracadabra')
0
SELECT COLUMN_CHECK('');
COLUMN_CHECK('')
1
SELECT COLUMN_CHECK(NULL);
COLUMN_CHECK(NULL)
NULL
#
# escaping check
#
select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever"));
column_json(column_create("string", "'\"/\\`.,whatever")) hex(column_create("string", "'\"/\\`.,whatever"))
{"string":"'\"/\\`.,whatever"} 040100060000000300737472696E670827222F5C602E2C7768617465766572
#
# embedding test
#
select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
column_json(column_create("val", "val", "emb", column_create("val2", "val2")))
{"emb":{"val2":"val2"},"val":"val"}
select column_json(column_create(1, "val", 2, column_create(3, "val2")));
column_json(column_create(1, "val", 2, column_create(3, "val2")))
{"1":"val","2":{"3":"val2"}}
#
# Time encoding
#
select hex(column_create("t", "800:46:06.23434" AS time)) as hex,
column_json(column_create("t", "800:46:06.23434" AS time)) as json;
hex json
04010001000000070074649363B82003 {"t":"800:46:06.234340"}
select hex(column_create(1, "800:46:06.23434" AS time)) as hex,
column_json(column_create(1, "800:46:06.23434" AS time)) as json;
hex json
000100010007649363B82003 {"1":"800:46:06.234340"}
select hex(column_create("t", "800:46:06" AS time)) as hex,
column_json(column_create("t", "800:46:06" AS time)) as json;
hex json
04010001000000070074860B32 {"t":"800:46:06"}
select hex(column_create(1, "800:46:06" AS time)) as hex,
column_json(column_create(1, "800:46:06" AS time)) as json;
hex json
000100010007000060B82003 {"1":"800:46:06"}
select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex,
column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json;
hex json
0401000100000005007495B90F649363B80A00 {"t":"2012-12-21 10:46:06.234340"}
select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex,
column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json;
hex json
00010001000595B90F649363B80A00 {"1":"2012-12-21 10:46:06.234340"}
select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex,
column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json;
hex json
0401000100000005007495B90F86AB00 {"t":"2012-12-21 10:46:06"}
select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex,
column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json;
hex json
00010001000595B90F000060B80A00 {"1":"2012-12-21 10:46:06"}

View file

@ -0,0 +1,21 @@
optimize table mysql.user;
Table Op Msg_type Msg_text
mysql.user optimize status OK
insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
Warnings:
Warning 1364 Field 'ssl_cipher' doesn't have a default value
Warning 1364 Field 'x509_issuer' doesn't have a default value
Warning 1364 Field 'x509_subject' doesn't have a default value
Warning 1364 Field 'authentication_string' doesn't have a default value
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
ERROR HY000: Plugin 'bar' is not loaded
connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
ERROR HY000: Plugin 'bar' is not loaded
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
delete from mysql.user where plugin = 'bar';
flush privileges;

View file

@ -1086,3 +1086,8 @@ ERROR HY000: Row 3 was cut by GROUP_CONCAT()
SET group_concat_max_len = DEFAULT;
SET @@sql_mode = @old_sql_mode;
DROP TABLE t1, t2;
create table t1 (a char(1) character set utf8);
insert into t1 values ('a'),('b');
select 1 from t1 where a in (select group_concat(a) from t1);
1
drop table t1;

View file

@ -305,6 +305,39 @@ SELECT 1 from t1 HAVING NAME_CONST('', a);
ERROR HY000: Incorrect arguments to NAME_CONST
DROP TABLE t1;
#
# Test or correct maybe_null of last_value
#
CREATE TABLE t1 (a char(2) not null );
INSERT INTO t1 VALUES (4),(7),(1);
set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='materialization=off';
CREATE TABLE tv (e char(2) not null ) engine=mysql;
Warnings:
Warning 1286 Unknown storage engine 'mysql'
Warning 1266 Using storage engine MyISAM for table 'tv'
INSERT INTO tv VALUES (1);
CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
explain extended
select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><last_value(NULL,`test`.`tv`.`e`)>(<in_optimizer>(last_value(NULL,`test`.`tv`.`e`),<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1'))))))))
explain extended
select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><`test`.`tv`.`e`>(<in_optimizer>(`test`.`tv`.`e`,<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(`test`.`tv`.`e`) = last_value(NULL,'1'))))))))
set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm;
drop table t1,tv;
#
# End of 5.5 tests
#
#

View file

@ -1423,7 +1423,7 @@ MAKEDATE(11111111,1)
NULL
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
NULL
0
#
# Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
#

14
mysql-test/r/gis2.result Normal file
View file

@ -0,0 +1,14 @@
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
point_data POINT NOT NULL,
PRIMARY KEY (id),
KEY idx_point_data(point_data)
) ENGINE=MyISAM;
INSERT t1 (point_data) VALUES
(GeomFromText('Point(37.0248492 23.8512726)')),
(GeomFromText('Point(38.0248492 23.8512726)'));
SELECT id FROM t1
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;

View file

@ -0,0 +1,20 @@
grant file on *.* to user1@localhost with grant option;
grant select on `a%`.* to user1@localhost with grant option;
grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
drop user user1@localhost;
call mtr.add_suppression("Incorrect database name");
alter table mysql.host modify Db varchar(200);
alter table mysql.db modify Db varchar(200);
insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
Warnings:
Warning 1265 Data truncated for column 'Db' at row 1
insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200));
Warnings:
Warning 1265 Data truncated for column 'Db' at row 1
flush privileges;
delete from mysql.host where db like '=>%';
delete from mysql.db where db like '=>%';
alter table mysql.host modify Db char(64);
alter table mysql.db modify Db char(64);
flush privileges;

View file

@ -2130,6 +2130,47 @@ the value below *must* be 1
show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 1
#
# Bug #1002146: Unneeded filesort if usage of join buffer is not allowed
# (bug mdev-645)
#
CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a));
INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4);
CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a));
INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200);
set join_cache_level=0;
EXPLAIN
SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
GROUP BY t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
GROUP BY t2.a;
a
3
4
100
200
set join_cache_level=default;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='outer_join_with_cache=off';
EXPLAIN
SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
GROUP BY t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index
1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using where; Using index
SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
GROUP BY t2.a;
a
0
3
4
100
200
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
# End of 5.3 tests
#
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
@ -2161,6 +2202,51 @@ f1 MIN(f2) MAX(f2)
DROP TABLE t1;
#End of test#49771
#
# Test of bug in GROUP_CONCAT with ROLLUP
#
CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM;
INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v');
CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM;
INSERT INTO t2 VALUES ('v',6),('c',4),('v',3);
SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
FROM t1 JOIN t2 ON c = b GROUP BY b;
b GROUP_CONCAT( a, b ORDER BY a, b )
c 1c
v 2v,2v
SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP;
b GROUP_CONCAT( a, b ORDER BY a, b )
c 1c
v 2v,2v
NULL 1c,2v,2v
DROP TABLE t1,t2;
#
# Test of MDEV-4002
#
CREATE TABLE t1 (
pk INT NOT NULL PRIMARY KEY,
d1 DOUBLE,
d2 DOUBLE,
i INT NOT NULL DEFAULT '0',
KEY (i)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
PREPARE stmt FROM "
SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
";
EXECUTE stmt;
i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
1 11.1
2 22.2
NULL 11.1,22.2
EXECUTE stmt;
i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
1 11.1
2 22.2
NULL 11.1,22.2
DROP TABLE t1;
#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery
# with full GROUP BY and no aggr

View file

@ -0,0 +1,30 @@
#
# MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
# on GROUP BY with indexes on InnoDB table
#
CREATE TABLE t1 (
pk INT PRIMARY KEY,
a VARCHAR(1) NOT NULL,
KEY (pk)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,'a'),(2,'b');
EXPLAIN
SELECT COUNT(*), pk field1, pk AS field2
FROM t1 WHERE a = 'r' OR pk = 183
GROUP BY field1, field2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where
SELECT COUNT(*), pk field1, pk AS field2
FROM t1 WHERE a = 'r' OR pk = 183
GROUP BY field1, field2;
COUNT(*) field1 field2
EXPLAIN
SELECT COUNT(*), pk field1 FROM t1
WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where
SELECT COUNT(*), pk field1 FROM t1
WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
COUNT(*) field1
drop table t1;
End of 5.5 tests

View file

@ -2933,6 +2933,13 @@ ORDER BY min_a;
min_a
NULL
DROP TABLE t1;
create table t1 (a int, b varchar(1), key(b,a)) engine=myisam;
insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i');
select min(a), b from t1 where a=7 or b='z' group by b;
min(a) b
7 g
flush tables;
drop table t1;
#
# LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
#

View file

@ -5,7 +5,7 @@ plugin_version 1.0
plugin_status ACTIVE
plugin_type DAEMON
plugin_library handlersocket.so
plugin_library_version 1.3
plugin_library_version 1.4
plugin_author higuchi dot akira at dena dot jp
plugin_description Direct access into InnoDB
plugin_license BSD

View file

@ -0,0 +1,8 @@
select variable_name from information_schema.session_status where variable_name =
(select variable_name from information_schema.session_status where variable_name = 'uptime');
variable_name
UPTIME
select variable_name from information_schema.session_variables where variable_name =
(select variable_name from information_schema.session_variables where variable_name = 'basedir');
variable_name
BASEDIR

View file

@ -504,35 +504,6 @@ CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
DROP TABLE t1;
#
# Bug #51876 : crash/memory underrun when loading data with ucs2
# and reverse() function
#
# Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
Warnings:
Warning 1366 Incorrect integer value: '?' for column 'a' at row 1
Warning 1366 Incorrect integer value: '?' for column 'a' at row 2
# should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
a
0
0
DROP TABLE t1;
# Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 0 and 1 (10 reversed)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
#
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
#
CREATE TABLE t1(f1 INT);

View file

@ -509,5 +509,9 @@ SHOW TABLES IN connected_db;
Tables_in_connected_db
table_in_connected_db
DROP DATABASE connected_db;
create database `aa``bb````cc`;
DATABASE()
aa`bb``cc
drop database `aa``bb````cc`;
End of tests

View file

@ -935,9 +935,9 @@ a int(11) YES NULL
b varchar(255) YES NULL
c datetime YES NULL
drop table t1;
mysqltest: At line 1: change user failed: Unknown database 'inexistent'
mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
mysqltest: At line 1: query 'change_user root,,inexistent' failed: 1049: Unknown database 'inexistent'
mysqltest: At line 1: query 'change_user inexistent,,test' failed: 1045: Access denied for user 'inexistent'@'localhost' (using password: NO)
mysqltest: At line 1: query 'change_user root,inexistent,test' failed: 1045: Access denied for user 'root'@'localhost' (using password: YES)
REPLACED_FILE1.txt
file1.txt
file2.txt

View file

@ -15,7 +15,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
PLUGIN_LIBRARY_VERSION 1.3
PLUGIN_LIBRARY_VERSION 1.4
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@ -28,7 +28,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE DAEMON
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
PLUGIN_LIBRARY_VERSION 1.3
PLUGIN_LIBRARY_VERSION 1.4
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Unusable Daemon
PLUGIN_LICENSE GPL
@ -57,7 +57,7 @@ PLUGIN_STATUS DELETED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
PLUGIN_LIBRARY_VERSION 1.3
PLUGIN_LIBRARY_VERSION 1.4
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@ -69,6 +69,8 @@ UNINSTALL PLUGIN EXAMPLE;
ERROR 42000: PLUGIN EXAMPLE does not exist
UNINSTALL PLUGIN non_exist;
ERROR 42000: PLUGIN non_exist does not exist
UNINSTALL SONAME 'non_exist';
ERROR 42000: SONAME non_exist.so does not exist
#
# Bug#32034: check_func_enum() does not check correct values but set it
# to impossible int val

View file

@ -121,17 +121,20 @@ ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : not the same user
GRANT PROXY ON grant_plug TO grant_plug_dest;
ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : same user, but on a different host
This is a valid grant
GRANT PROXY ON grant_plug_dest TO grant_plug;
ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should work : same user
GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2;
REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2;
REVOKE PROXY ON grant_plug_dest FROM grant_plug;
this should work : same user
GRANT PROXY ON grant_plug_dest TO grant_plug_dest2;
REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2;
this should fail : not the same user
GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION;
ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : not the same user
REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug;
ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : can't create users
GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost;
GRANT PROXY ON grant_plug_dest TO grant_plug@localhost;
ERROR 42000: You are not allowed to create a user with GRANT
in default connection
# test what root can grant
@ -149,12 +152,12 @@ GRANT PROXY ON future_user TO grant_plug;
in default connection
SHOW GRANTS FOR grant_plug;
Grants for grant_plug@%
GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest'
GRANT PROXY ON 'future_user'@'%' TO 'grant_plug'@'%'
REVOKE PROXY ON future_user FROM grant_plug;
SHOW GRANTS FOR grant_plug;
Grants for grant_plug@%
GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest'
## testing drop user
CREATE USER test_drop@localhost;
GRANT PROXY ON future_user TO test_drop@localhost;

View file

@ -1552,3 +1552,14 @@ RELEASE_LOCK('t')
óóóó
1
SET NAMES latin1;
#
# WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS
#
SHOW AUTHORS;
SHOW WARNINGS;
Level Code Message
Warning 1681 'SHOW AUTHORS' is deprecated and will be removed in a future release.
SHOW CONTRIBUTORS;
SHOW WARNINGS;
Level Code Message
Warning 1681 'SHOW CONTRIBUTORS' is deprecated and will be removed in a future release.

View file

@ -1,5 +1,6 @@
drop table if exists t0, t1, t2, t3, t4;
drop view if exists v1;
SET @old_debug= @@session.debug;
set debug_sync='RESET';
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@ -12,12 +13,13 @@ show explain for 2000000000;
ERROR HY000: Unknown thread id: 2000000000
show explain for (select max(a) from t0);
ERROR HY000: You may only use constant expressions in this statement
SET @old_debug= @@session.debug;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
show explain for $thr1;
ERROR HY000: Target is not running an EXPLAINable command
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select count(*) from t1 where a < 100000;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -46,9 +48,10 @@ Note 1003 explain select max(c) from t1 where a < 10
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
set optimizer_switch= @show_expl_tmp;
set debug_dbug=@old_debug;
# UNION, first branch
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -61,9 +64,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
set debug_dbug=@old_debug;
# UNION, second branch
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a from t0 A union select a+1 from t0 B;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -76,9 +80,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10
2 UNION B ALL NULL NULL NULL NULL 10
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
set debug_dbug=@old_debug;
# Uncorrelated subquery, select
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 B) from t0 A where a<1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -88,9 +93,10 @@ Warnings:
Note 1003 select a, (select max(a) from t0 B) from t0 A where a<1
a (select max(a) from t0 B)
0 9
set debug_dbug=@old_debug;
# Uncorrelated subquery, explain
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
explain select a, (select max(a) from t0 B) from t0 A where a<1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -101,9 +107,10 @@ Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY A ALL NULL NULL NULL NULL 10 Using where
2 SUBQUERY B ALL NULL NULL NULL NULL 10
set debug_dbug=@old_debug;
# correlated subquery, select
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -113,9 +120,10 @@ Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
# correlated subquery, explain
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -125,9 +133,10 @@ Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
# correlated subquery, select, while inside the subquery
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -137,9 +146,10 @@ Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
# correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -149,52 +159,57 @@ Warnings:
Note 1003 select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
# correlated subquery, explain, while inside the subquery
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
a (select max(a) from t0 b where b.a+a.a<10)
0 9
set debug_dbug=@old_debug;
# Try to do SHOW EXPLAIN for a query that runs a SET command:
# I've found experimentally that select_id==2 here...
#
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @foo= (select max(a) from t0 where sin(a) >0);
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
set debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for an UPDATE
#
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
drop table t2;
set debug_dbug=@old_debug;
#
# Attempt SHOW EXPLAIN for a DELETE
#
create table t2 as select a as a, a as dummy from t0 limit 2;
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
drop table t2;
set debug_dbug=@old_debug;
#
# Multiple SHOW EXPLAIN calls for one select
#
create table t2 as select a as a, a as dummy from t0 limit 3;
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -219,13 +234,14 @@ a SUBQ
1 0
2 0
drop table t2;
set debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
#
explain select * from t0 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using filesort
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select * from t0 order by a;
show explain for $thr2;
@ -244,13 +260,14 @@ a
7
8
9
set debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary"
#
explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
show explain for $thr2;
@ -269,13 +286,14 @@ a
7
8
9
set debug_dbug=@old_debug;
#
# SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
#
explain select distinct a from t0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using temporary
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
set @show_explain_probe_select_id=1;
select distinct a from t0;
show explain for $thr2;
@ -294,7 +312,7 @@ a
7
8
9
set debug_dbug='';
set debug_dbug=@old_debug;
#
# MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
#
@ -304,7 +322,7 @@ explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join)
set debug_dbug='d,show_explain_in_find_all_keys';
set debug_dbug='+d,show_explain_in_find_all_keys';
SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
# FIXED by "conservative assumptions about when QEP is available" fix:
# NOTE: current code will not show "Using join buffer":
@ -314,7 +332,7 @@ a
1
2
4
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t2;
#
# MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with
@ -329,7 +347,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -342,7 +360,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` join `test`.`t2` group by `test`.`t2`.`a`
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t2;
#
# MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
@ -359,7 +377,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 6
2 DERIVED t3 system NULL NULL NULL NULL 1
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM v1, t2;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
@ -370,14 +388,14 @@ a b
8 7
8 8
8 9
set debug_dbug='';
set debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t2, t3;
#
# MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
#
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
select sleep(1);
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -386,29 +404,29 @@ Warnings:
Note 1003 select sleep(1)
sleep(1)
0
set debug_dbug='';
set debug_dbug=@old_debug;
#
# Same as above, but try another reason for JOIN to be degenerate
#
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0 where 1>10;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
a
set debug_dbug='';
set debug_dbug=@old_debug;
#
# Same as above, but try another reason for JOIN to be degenerate (2)
#
create table t3(a int primary key);
insert into t3 select a from t0;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
select * from t0,t3 where t3.a=112233;
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
a a
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t3;
#
# MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
@ -427,7 +445,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using where
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
set @show_explain_probe_select_id=2;
set debug_dbug='d,show_explain_probe_do_select';
set debug_dbug='+d,show_explain_probe_do_select';
SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
@ -447,7 +465,7 @@ pk a
6 7
7 7
9 7
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t2;
#
# MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE
@ -479,7 +497,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 87 Using join buffer (flat, BNL join)
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_do_select';
set debug_dbug='+d,show_explain_probe_do_select';
SELECT count(*) FROM t2, t3
WHERE a1 < ALL (
SELECT a1 FROM t2
@ -498,7 +516,7 @@ WHERE a1 IN ( SELECT a1 FROM t2, t4 )
)
count(*)
1740
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t2, t3, t4;
#
# MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function
@ -508,12 +526,12 @@ INSERT INTO t2 VALUES
(1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43),
(11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_end';
set debug_dbug='+d,show_explain_probe_join_exec_end';
SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
show explain for $thr2;
ERROR HY000: Target is not running an EXPLAINable command
pk a1
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t2;
DROP TABLE t1;
#
@ -522,7 +540,7 @@ DROP TABLE t1;
CREATE TABLE t1(a INT, KEY(a));
INSERT INTO t1 VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT 'test' FROM t1 WHERE a=1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -532,7 +550,7 @@ Note 1003 SELECT 'test' FROM t1 WHERE a=1
test
test
test
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution
@ -550,7 +568,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A ALL NULL NULL NULL NULL 100 Using where
1 SIMPLE B ALL key1 NULL NULL NULL 100 Range checked for each record (index map: 0x1)
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_test_if_quick_select';
set debug_dbug='+d,show_explain_probe_test_if_quick_select';
select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -578,7 +596,7 @@ Warnings:
Note 1003 select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100
count(*)
212
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t1;
#
# MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while
@ -587,7 +605,7 @@ drop table t1;
CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SHOW INDEX FROM t1;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -598,7 +616,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 a 1 a A NULL NULL NULL YES BTREE
t1 1 b 1 b A NULL NULL NULL YES BTREE
t1 1 c 1 c A NULL NULL NULL YES BTREE
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view
@ -611,7 +629,7 @@ EXPLAIN SELECT a + 1 FROM v1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 ALL NULL NULL NULL NULL 2
set debug_dbug='d,show_explain_probe_join_tab_preread';
set debug_dbug='+d,show_explain_probe_join_tab_preread';
set @show_explain_probe_select_id=1;
SELECT a + 1 FROM v1;
show explain for $thr2;
@ -623,7 +641,7 @@ Note 1003 SELECT a + 1 FROM v1
a + 1
2
3
set debug_dbug='';
set debug_dbug=@old_debug;
DROP VIEW v1;
DROP TABLE t1;
#
@ -639,7 +657,7 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
set debug_dbug='d,show_explain_probe_union_read';
set debug_dbug='+d,show_explain_probe_union_read';
SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -658,7 +676,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1003 SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 )
a
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t1;
#
# MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN
@ -681,7 +699,7 @@ id select_type table type possible_keys key key_len ref rows Extra
3 SUBQUERY t1 ALL NULL NULL NULL NULL 20
3 SUBQUERY t2 ALL NULL NULL NULL NULL 20 Using where
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
show explain for $thr2;
@ -694,7 +712,7 @@ Warnings:
Note 1003 SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b )
a b
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t1, t2;
#
# Test that SHOW EXPLAIN will print 'Distinct'.
@ -716,7 +734,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 7 Using index; Distinct
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select distinct t1.a from t1,t3 where t1.a=t3.a;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -727,7 +745,7 @@ Note 1003 select distinct t1.a from t1,t3 where t1.a=t3.a
a
1
2
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t1,t3,t4;
#
# ---------- SHOW EXPLAIN and permissions -----------------
@ -738,7 +756,7 @@ grant super on *.* to test2@localhost;
# First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
#
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
show explain for $thr2;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
@ -751,12 +769,12 @@ a
0
1
2
set debug_dbug='';
set debug_dbug=@old_debug;
#
# Check that user test2 can do SHOW EXPLAIN on its own queries
#
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
show explain for $thr_con2;
id select_type table type possible_keys key key_len ref rows Extra
@ -771,8 +789,9 @@ a
# Now, grant test2 a PROCESSLIST permission, and see that he's able to observe us
#
grant process on *.* to test2@localhost;
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where a < 3;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -783,7 +802,7 @@ a
0
1
2
set debug_dbug='';
set debug_dbug=@old_debug;
revoke all privileges on test.* from test2@localhost;
drop user test2@localhost;
#
@ -848,7 +867,7 @@ ORDER BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
@ -867,8 +886,9 @@ a+SLEEP(0.01)
0
0
0
set debug_dbug=@old_debug;
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_do_select';
set debug_dbug='+d,show_explain_probe_do_select';
SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b;
@ -887,7 +907,7 @@ a+SLEEP(0.01)
0
0
0
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t1;
#
# MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains
@ -901,7 +921,7 @@ EXPLAIN SELECT a FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4112 Using temporary; Using filesort
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a FROM t1 GROUP BY a;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -925,7 +945,7 @@ a
14
15
16
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t1;
#
# MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output
@ -939,7 +959,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 index_subquery PRIMARY,c c 5 func 1 Using index; Using where
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -949,7 +969,7 @@ Warnings:
Note 1003 SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's'
SUM(a + SLEEP(0.1))
7862
set debug_dbug='';
set debug_dbug=@old_debug;
drop table t1, t2;
#
# MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice
@ -987,7 +1007,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 6 NULL 107 Using where; Using index
1 SIMPLE t3 ref PRIMARY PRIMARY 5 test.t1.b 1 Using index
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_do_select';
set debug_dbug='+d,show_explain_probe_do_select';
SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
@ -997,7 +1017,7 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note 1003 SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2
field1 field2
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
#
# MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output
@ -1018,7 +1038,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 20
3 SUBQUERY t3 ALL NULL NULL NULL NULL 20 Using where
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
show explain for $thr2;
@ -1031,7 +1051,7 @@ Note 1003 SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10
max(a+b+c)
279
set debug_dbug='';
set debug_dbug=@old_debug;
DROP TABLE t1,t2,t3;
#
# MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
@ -1057,7 +1077,7 @@ select hex('
hex('ãû')
E3FB
set @show_explain_probe_select_id=1;
set debug_dbug='d,show_explain_probe_join_exec_start';
set debug_dbug='+d,show_explain_probe_join_exec_start';
select * from t0 where length('ãû') = a;
set names utf8;
show explain for $thr2;
@ -1068,7 +1088,7 @@ Note 1003 select * from t0 where length('гы') = a
set names default;
a
2
set debug_dbug='';
set debug_dbug=@old_debug;
set names default;
#
# MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value

View file

@ -6530,16 +6530,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 0 Using where; Using index
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM v1 WHERE c1=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using index
EXPLAIN SELECT * FROM v1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 0 Using where; Using index
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 0 Using where; Using index
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
@ -7852,6 +7852,38 @@ c1 c2 count(c3)
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DROP PROCEDURE p1;
MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now());
CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM;
INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8);
INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
FLUSH TABLES;
FLUSH STATUS;
SHOW STATUS LIKE '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 0
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
UPDATE t1 SET a = '+' WHERE daynum=tdn();
SHOW STATUS LIKE '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
Handler_read_next 4097
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
drop function tdn;
drop table t1;
#
# lp:1002157 : testing stored function
# bug#62125 result for null incorrectly yields 1292 warning.

View file

@ -259,7 +259,6 @@ SELECT `my.db`.f1(2);
# Switching to default connection.
DROP DATABASE `my.db`;
USE test;
set @@global.concurrent_insert= @old_concurrent_insert;
#
# Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
#
@ -280,3 +279,7 @@ Event sql_mode time_zone Create Event character_set_client collation_connection
teste_bug11763507 SYSTEM # latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT teste_bug11763507;
#END OF BUG#11763507 test.
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
set @@global.concurrent_insert= @old_concurrent_insert;

View file

@ -219,4 +219,24 @@ set debug_sync='RESET';
set global use_stat_tables=@save_global_use_stat_tables;
DROP DATABASE dbt3_s001;
use test;
set @save_global_use_stat_tables=@@global.use_stat_tables;
set global use_stat_tables='preferably';
set debug_sync='RESET';
create table t1 (a int, b int, key(a));
insert t1 values (1,1),(2,2);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
select * from t1;
a b
1 1
2 2
SET DEBUG_SYNC= "now SIGNAL go";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1 1 test a 1 a A 2 NULL NULL YES BTREE
set debug_sync='RESET';
drop table t1;
set global use_stat_tables=@save_global_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;

View file

@ -228,6 +228,26 @@ set debug_sync='RESET';
set global use_stat_tables=@save_global_use_stat_tables;
DROP DATABASE dbt3_s001;
use test;
set @save_global_use_stat_tables=@@global.use_stat_tables;
set global use_stat_tables='preferably';
set debug_sync='RESET';
create table t1 (a int, b int, key(a));
insert t1 values (1,1),(2,2);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
select * from information_schema.statistics where table_schema='test';
select * from t1;
a b
1 1
2 2
SET DEBUG_SYNC= "now SIGNAL go";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
def test t1 1 test a 1 a A 2 NULL NULL YES BTREE
set debug_sync='RESET';
drop table t1;
set global use_stat_tables=@save_global_use_stat_tables;
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;

View file

@ -2248,6 +2248,53 @@ NULL NULL
drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
#
# MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery
#
CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM;
INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38');
CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8, '06:17:39');
CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM;
INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02');
EXPLAIN
SELECT * FROM t1 WHERE a1 IN (
SELECT a2 FROM t2 WHERE a2 IN (
SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
)
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
SELECT * FROM t1 WHERE a1 IN (
SELECT a2 FROM t2 WHERE a2 IN (
SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
)
);
a1 b1
drop table t1, t2, t3;
#
# MDEV-4056:Server crashes in Item_func_trig_cond::val_int
# with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists
#
set @optimizer_switch_MDEV4056 = @@optimizer_switch;
SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('x'),('d');
CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v');
SELECT * FROM t1 LEFT JOIN (
SELECT * FROM t2 WHERE ( pk, pk ) NOT IN (
SELECT MIN(b), SUM(pk) FROM t1
)
) AS alias1 ON (a = c)
WHERE b IS NULL OR a < 'u';
a pk b c
x NULL NULL NULL
d NULL NULL NULL
drop table t1,t2;
set @@optimizer_switch = @optimizer_switch_MDEV4056;
#
# MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;

View file

@ -432,4 +432,22 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr
1
1
drop table t1;
#
# MDEV-3988 crash in create_tmp_table
#
drop table if exists `t1`,`t2`;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
create table `t1`(`a` char(1) character set utf8)engine=innodb;
create table `t2`(`b` char(1) character set utf8)engine=memory;
select distinct (select 1 from `t2` where `a`) `d2` from `t1`;
d2
select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`;
d2 a
select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`;
a d2
select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
d2
drop table t1,t2;
set optimizer_switch=@subselect_innodb_tmp;

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