10.0-base merge

This commit is contained in:
Sergei Golubchik 2013-04-15 15:09:22 +02:00
commit a9035be5b7
976 changed files with 38123 additions and 26781 deletions

View File

@ -1145,3 +1145,4 @@ sql/db.opt
typescript
storage/perfschema/gen_pfs_lex_token
storage/perfschema/pfs_lex_token.h
mysql-test/collections/default.release.done

View File

@ -132,14 +132,10 @@ IF (NOT CPACK_GENERATOR)
ENDIF(WIN32)
ENDIF(NOT CPACK_GENERATOR)
IF(DEB)
SET(INSTALL_LAYOUT "DEB")
ENDIF(DEB)
INCLUDE(mysql_version)
INCLUDE(cpack_rpm)
INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout)
INCLUDE(cpack_rpm)
# Add macros
INCLUDE(character_sets)

File diff suppressed because it is too large Load Diff

View File

@ -2312,17 +2312,19 @@ static bool add_line(String &buffer,char *line,char *in_string,
{
uint length=(uint) (out-line);
if (!truncated &&
(length < 9 ||
my_strnncoll (charset_info,
(uchar *)line, 9, (const uchar *) "delimiter", 9)))
if (!truncated && (length < 9 ||
my_strnncoll (charset_info, (uchar *)line, 9,
(const uchar *) "delimiter", 9) ||
(*in_string || *ml_comment)))
{
/*
Don't add a new line in case there's a DELIMITER command to be
added to the glob buffer (e.g. on processing a line like
"<command>;DELIMITER <non-eof>") : similar to how a new line is
not added in the case when the DELIMITER is the first command
entered with an empty glob buffer.
entered with an empty glob buffer. However, if the delimiter is
part of a string or a comment, the new line should be added. (e.g.
SELECT '\ndelimiter\n';\n)
*/
*out++='\n';
length++;
@ -4727,7 +4729,13 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
if (info_type == INFO_ERROR)
{
if (!opt_nobeep)
{
#ifdef _WIN32
MessageBeep(MB_ICONWARNING);
#else
putchar('\a'); /* This should make a bell */
#endif
}
vidattr(A_STANDOUT);
if (error)
{

View File

@ -818,6 +818,88 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file,
}
static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
{
/*
These events must be printed in base64 format, if printed.
base64 format requires a FD event to be safe, so if no FD
event has been printed, we give an error. Except if user
passed --short-form, because --short-form disables printing
row events.
*/
if (!print_event_info->printed_fd_event && !short_form &&
opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
{
const char* type_str= ev->get_type_str();
if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
error("--base64-output=never specified, but binlog contains a "
"%s event which must be printed in base64.",
type_str);
else
error("malformed binlog: it does not contain any "
"Format_description_log_event. I now found a %s event, which "
"is not safe to process without a "
"Format_description_log_event.",
type_str);
return 1;
}
ev->print(result_file, print_event_info);
return print_event_info->head_cache.error == -1;
}
static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ulong table_id, bool is_stmt_end)
{
Table_map_log_event *ignored_map=
print_event_info->m_table_map_ignored.get_table(table_id);
bool skip_event= (ignored_map != NULL);
/*
end of statement check:
i) destroy/free ignored maps
ii) if skip event, flush cache now
*/
if (is_stmt_end)
{
/*
Now is safe to clear ignored map (clear_tables will also
delete original table map events stored in the map).
*/
if (print_event_info->m_table_map_ignored.count() > 0)
print_event_info->m_table_map_ignored.clear_tables();
/*
If there is a kept Annotate event and all corresponding
rbr-events were filtered away, the Annotate event was not
freed and it is just the time to do it.
*/
free_annotate_event();
/*
One needs to take into account an event that gets
filtered but was last event in the statement. If this is
the case, previous rows events that were written into
IO_CACHEs still need to be copied from cache to
result_file (as it would happen in ev->print(...) if
event was not skipped).
*/
if (skip_event)
{
if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
return 1;
}
}
/* skip the event check */
if (skip_event)
return 0;
return print_base64(print_event_info, ev);
}
/**
Print the given event, and either delete it or delegate the deletion
to someone else.
@ -1130,86 +1212,29 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
error("Could not rewrite database name");
goto err;
}
if (print_base64(print_event_info, ev))
goto err;
break;
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
{
Rows_log_event *e= (Rows_log_event*) ev;
if (print_row_event(print_event_info, ev, e->get_table_id(),
e->get_flags(Rows_log_event::STMT_END_F)))
goto err;
break;
}
case PRE_GA_WRITE_ROWS_EVENT:
case PRE_GA_DELETE_ROWS_EVENT:
case PRE_GA_UPDATE_ROWS_EVENT:
{
if (ev_type != TABLE_MAP_EVENT)
{
Rows_log_event *e= (Rows_log_event*) ev;
Table_map_log_event *ignored_map=
print_event_info->m_table_map_ignored.get_table(e->get_table_id());
bool skip_event= (ignored_map != NULL);
/*
end of statement check:
i) destroy/free ignored maps
ii) if skip event, flush cache now
*/
if (e->get_flags(Rows_log_event::STMT_END_F))
{
/*
Now is safe to clear ignored map (clear_tables will also
delete original table map events stored in the map).
*/
if (print_event_info->m_table_map_ignored.count() > 0)
print_event_info->m_table_map_ignored.clear_tables();
/*
If there is a kept Annotate event and all corresponding
rbr-events were filtered away, the Annotate event was not
freed and it is just the time to do it.
*/
free_annotate_event();
/*
One needs to take into account an event that gets
filtered but was last event in the statement. If this is
the case, previous rows events that were written into
IO_CACHEs still need to be copied from cache to
result_file (as it would happen in ev->print(...) if
event was not skipped).
*/
if (skip_event)
{
if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
goto err;
}
}
/* skip the event check */
if (skip_event)
goto end;
}
/*
These events must be printed in base64 format, if printed.
base64 format requires a FD event to be safe, so if no FD
event has been printed, we give an error. Except if user
passed --short-form, because --short-form disables printing
row events.
*/
if (!print_event_info->printed_fd_event && !short_form &&
opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
{
const char* type_str= ev->get_type_str();
if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
error("--base64-output=never specified, but binlog contains a "
"%s event which must be printed in base64.",
type_str);
else
error("malformed binlog: it does not contain any "
"Format_description_log_event. I now found a %s event, which "
"is not safe to process without a "
"Format_description_log_event.",
type_str);
Old_rows_log_event *e= (Old_rows_log_event*) ev;
if (print_row_event(print_event_info, ev, e->get_table_id(),
e->get_flags(Old_rows_log_event::STMT_END_F)))
goto err;
}
/* FALL THROUGH */
break;
}
default:
print_skip_replication_statement(print_event_info, ev);
@ -2444,6 +2469,8 @@ int main(int argc, char** argv)
else
load_processor.init_by_cur_dir();
fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;\n");
fprintf(result_file,
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
@ -2494,6 +2521,8 @@ int main(int argc, char** argv)
"/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;\n");
if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file != stdout)

View File

@ -2300,7 +2300,6 @@ static uint dump_routines_for_db(char *db)
const char *routine_type[]= {"FUNCTION", "PROCEDURE"};
char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
char *routine_name;
char *query_str;
int i;
FILE *sql_file= md_result_file;
MYSQL_RES *routine_res, *routine_list_res;
@ -2394,17 +2393,6 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n",
routine_type[i], routine_name);
query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50020"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" FUNCTION"));
if (!query_str)
query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50020"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" PROCEDURE"));
if (mysql_num_fields(routine_res) >= 6)
{
if (switch_db_collation(sql_file, db_name_buff, ";",
@ -2442,9 +2430,9 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file,
"DELIMITER ;;\n"
"/*!50003 %s */;;\n"
"%s ;;\n"
"DELIMITER ;\n",
(const char *) (query_str != NULL ? query_str : row[2]));
(const char *) row[2]);
restore_sql_mode(sql_file, ";");
@ -2459,7 +2447,6 @@ static uint dump_routines_for_db(char *db)
}
}
my_free(query_str);
}
} /* end of routine printing */
mysql_free_result(routine_res);

View File

@ -3633,7 +3633,6 @@ void do_remove_files_wildcard(struct st_command *command)
fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME);
DBUG_PRINT("info", ("listing directory: %s", dirname));
/* Note that my_dir sorts the list if not given any flags */
if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT | MY_WME))))
{
error= 1;
@ -3648,7 +3647,7 @@ void do_remove_files_wildcard(struct st_command *command)
/* Set default wild chars for wild_compare, is changed in embedded mode */
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++)
for (i= 0; i < (uint) dir_info->number_of_files; i++)
{
file= dir_info->dir_entry + i;
/* Remove only regular files, i.e. no directories etc. */
@ -3911,17 +3910,12 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
DBUG_ENTER("get_list_files");
DBUG_PRINT("info", ("listing directory: %s", ds_dirname->str));
/* Note that my_dir sorts the list if not given any flags */
if (!(dir_info= my_dir(ds_dirname->str, MYF(0))))
if (!(dir_info= my_dir(ds_dirname->str, MYF(MY_WANT_SORT))))
DBUG_RETURN(1);
set_wild_chars(1);
for (i= 0; i < (uint) dir_info->number_off_files; i++)
for (i= 0; i < (uint) dir_info->number_of_files; i++)
{
file= dir_info->dir_entry + i;
if (file->name[0] == '.' &&
(file->name[1] == '\0' ||
(file->name[1] == '.' && file->name[2] == '\0')))
continue; /* . or .. */
if (ds_wild && ds_wild->length &&
wild_compare(file->name, ds_wild->str, 0))
continue;

View File

@ -2,7 +2,7 @@ IF(RPM)
SET(CPACK_GENERATOR "RPM")
SET(CPACK_RPM_PACKAGE_DEBUG 1)
SET(INSTALL_LAYOUT "RPM")
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
SET(CPACK_RPM_COMPONENT_INSTALL ON)
@ -49,9 +49,13 @@ MariaDB bug reports should be submitted through https://mariadb.atlassian.net/
SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define mysql_vendor ${CPACK_PACKAGE_VENDOR}
%define mysqlversion ${MYSQL_NO_DASH_VERSION}
%define mysqldatadir /var/lib/mysql
%define mysqlbasedir ${CMAKE_INSTALL_PREFIX}
%define mysqldatadir ${INSTALL_MYSQLDATADIR}
%define mysqld_user mysql
%define mysqld_group mysql
%define _bindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}
%define _sbindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR}
%define _sysconfdir ${INSTALL_SYSCONFDIR}
")
# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
@ -68,18 +72,18 @@ 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*"
"%ignore ${CMAKE_INSTALL_PREFIX}"
"%ignore ${CMAKE_INSTALL_PREFIX}/bin"
"%ignore ${CMAKE_INSTALL_PREFIX}/include"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib"
"%ignore ${CMAKE_INSTALL_PREFIX}/lib64"
"%ignore ${CMAKE_INSTALL_PREFIX}/sbin"
"%ignore ${CMAKE_INSTALL_PREFIX}/share"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/aclocal"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/doc"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*"
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*"
)
SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
@ -103,7 +107,7 @@ SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-de
SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel")
SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MySQL-server MySQL-OurDelta-server")
SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server")
SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql(x86-32) mysql(x86-64) mysql-server")
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)

View File

@ -67,7 +67,13 @@
# http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths
IF(NOT INSTALL_LAYOUT)
SET(INSTALL_LAYOUT "STANDALONE")
IF(DEB)
SET(INSTALL_LAYOUT "DEB")
ELSEIF(RPM)
SET(INSTALL_LAYOUT "RPM")
ELSE()
SET(INSTALL_LAYOUT "STANDALONE")
ENDIF()
ENDIF()
SET(INSTALL_LAYOUT "${INSTALL_LAYOUT}"
@ -187,7 +193,7 @@ SET(INSTALL_SHAREDIR_DEB "share")
SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql")
SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
SET(INSTALL_SQLBENCHDIR_DEB ".")
SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql")
#
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests})

View File

@ -18,7 +18,7 @@ INCLUDE(CheckCCompilerFlag)
# Setup GCC (GNU C compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wno-invalid-offsetof -DFORCE_INIT_OF_VARS")
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -DFORCE_INIT_OF_VARS")
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
HAVE_NO_MISSING_FIELD_INITIALIZERS)
@ -44,7 +44,7 @@ ENDMACRO()
# Setup G++ (GNU C++ compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS)
SET(MY_MAINTAINER_CXX_WARNINGS
"${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter -Woverloaded-virtual"
"${MY_MAINTAINER_WARNINGS} -Wno-invalid-offsetof -Wno-unused-parameter -Woverloaded-virtual"
CACHE INTERNAL "C++ warning options used in maintainer builds.")
ENDMACRO()

View File

@ -267,6 +267,7 @@ SET(HAVE_SYNCH_H CACHE INTERNAL "")
SET(HAVE_SYSENT_H CACHE INTERNAL "")
SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "")
SET(HAVE_SYS_DIR_H CACHE INTERNAL "")
SET(HAVE_SYS_EVENT_H CACHE INTERNAL "")
SET(HAVE_SYS_ERRLIST CACHE INTERNAL "")
SET(HAVE_SYS_FILE_H CACHE INTERNAL "")
SET(HAVE_SYS_FPU_H CACHE INTERNAL "")

View File

@ -171,12 +171,12 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(ARG_MANDATORY)
SET (mysql_mandatory_plugins
"${mysql_mandatory_plugins} builtin_maria_${target}_plugin,"
PARENT_SCOPE)
"${mysql_mandatory_plugins} builtin_maria_${target}_plugin,")
SET (mysql_mandatory_plugins ${mysql_mandatory_plugins} PARENT_SCOPE)
ELSE()
SET (mysql_optional_plugins
"${mysql_optional_plugins} builtin_maria_${target}_plugin,"
PARENT_SCOPE)
"${mysql_optional_plugins} builtin_maria_${target}_plugin,")
SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE)
ENDIF()
ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS)

View File

@ -44,6 +44,7 @@
#cmakedefine HAVE_IA64INTRIN_H 1
#cmakedefine HAVE_IEEEFP_H 1
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_KQUEUE 1
#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_LINUX_UNISTD_H 1
#cmakedefine HAVE_LOCALE_H 1

View File

@ -153,6 +153,7 @@ IF(UNIX)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} wrap)
CHECK_C_SOURCE_COMPILES(
"
#include <sys/types.h>
#include <tcpd.h>
int allow_severity = 0;
int deny_severity = 0;
@ -210,6 +211,7 @@ CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
CHECK_INCLUDE_FILES (sys/ndir.h HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H)
CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H)
@ -223,13 +225,13 @@ CHECK_INCLUDE_FILES (sys/cdefs.h HAVE_SYS_CDEFS_H)
CHECK_INCLUDE_FILES (sys/file.h HAVE_SYS_FILE_H)
CHECK_INCLUDE_FILES (sys/fpu.h HAVE_SYS_FPU_H)
CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILES (sys/ipc.h HAVE_SYS_IPC_H)
CHECK_INCLUDE_FILES (sys/malloc.h HAVE_SYS_MALLOC_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/ipc.h" HAVE_SYS_IPC_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/malloc.h" HAVE_SYS_MALLOC_H)
CHECK_INCLUDE_FILES (sys/mman.h HAVE_SYS_MMAN_H)
CHECK_INCLUDE_FILES (sys/prctl.h HAVE_SYS_PRCTL_H)
CHECK_INCLUDE_FILES (sys/resource.h HAVE_SYS_RESOURCE_H)
CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H)
CHECK_INCLUDE_FILES (sys/shm.h HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
@ -459,6 +461,10 @@ CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN)
CHECK_FUNCTION_EXISTS (chown HAVE_CHOWN)
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
IF(HAVE_SYS_EVENT_H)
CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE)
ENDIF()
#--------------------------------------------------------------------
# Support for WL#2373 (Use cycle counter for timing)
#--------------------------------------------------------------------

View File

@ -26,8 +26,13 @@
#include <my_sys.h>
#include <m_string.h>
#include <my_getopt.h>
#include <mysql_version.h>
#define load_default_groups mysqld_groups
#include <mysqld_default_groups.h>
#undef load_default_groups
my_bool opt_mysqld;
const char *config_file="my"; /* Default config file */
uint verbose= 0, opt_defaults_file_used= 0;
const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace";
@ -78,6 +83,8 @@ static struct my_option my_long_options[] =
(void *)&my_defaults_extra_file,
(void *)&my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"mysqld", 0, "Read the same set of groups that the mysqld binary does.",
&opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.",
@ -98,11 +105,12 @@ static void usage(my_bool version)
return;
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
puts("Prints all arguments that is give to some program using the default files");
printf("Usage: %s [OPTIONS] groups\n", my_progname);
printf("Usage: %s [OPTIONS] [groups]\n", my_progname);
my_print_help(my_long_options);
my_print_default_files(config_file);
my_print_variables(my_long_options);
printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname);
exit(0);
}
@ -115,17 +123,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_defaults_file_used= 1;
break;
case 'n':
exit(0);
exit(0);
case 'I':
case '?':
usage(0);
exit(0);
usage(0);
case 'v':
verbose++;
break;
case 'V':
usage(1);
exit(0);
usage(1);
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
break;
@ -141,11 +147,6 @@ static int get_options(int *argc,char ***argv)
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
if (*argc < 1)
{
usage(0);
return 1;
}
return 0;
}
@ -153,9 +154,10 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv)
{
int count, error, args_used;
char **load_default_groups, *tmp_arguments[6];
char **load_default_groups= 0, *tmp_arguments[6];
char **argument, **arguments, **org_argv;
char *defaults, *extra_defaults, *group_suffix;
int nargs, i= 0;
MY_INIT(argv[0]);
org_argv= argv;
@ -169,13 +171,25 @@ int main(int argc, char **argv)
arguments[count]= 0;
/* Check out the args */
if (!(load_default_groups=(char**) my_malloc((argc+1)*sizeof(char*),
MYF(MY_WME))))
exit(1);
if (get_options(&argc,&argv))
exit(1);
memcpy((char*) load_default_groups, (char*) argv, (argc + 1) * sizeof(*argv));
nargs= argc + 1;
if (opt_mysqld)
nargs+= array_elements(mysqld_groups);
if (nargs < 2)
usage(0);
load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME));
if (!load_default_groups)
exit(1);
if (opt_mysqld)
{
for (; mysqld_groups[i]; i++)
load_default_groups[i]= (char*) mysqld_groups[i];
}
memcpy(load_default_groups + i, argv, (argc + 1) * sizeof(*argv));
if ((error= load_defaults(config_file, (const char **) load_default_groups,
&count, &arguments)))
{
@ -198,6 +212,6 @@ int main(int argc, char **argv)
puts(*argument);
my_free(load_default_groups);
free_defaults(arguments);
my_end(0);
exit(0);
}

View File

@ -767,8 +767,14 @@ int DoProcessReply(SSL& ssl)
while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) {
// each message in record, can be more than 1 if not encrypted
if (ssl.getSecurity().get_parms().pending_ == false) // cipher on
if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on
// sanity check for malicious/corrupted/illegal input
if (buffer.get_remaining() < hdr.length_) {
ssl.SetError(bad_input);
return 0;
}
decrypt_message(ssl, buffer, hdr.length_);
}
mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_));
if (!msg.get()) {

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
Copyright (c) 2011, 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
@ -60,11 +61,8 @@ typedef struct st_hash {
/* A search iterator state */
typedef uint HASH_SEARCH_STATE;
#define my_hash_init(A,B,C,D,E,F,G,H) \
_my_hash_init(A,0,B,C,D,E,F,G,H)
#define my_hash_init2(A,B,C,D,E,F,G,H,I) \
_my_hash_init(A,B,C,D,E,F,G,H,I)
my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
#define my_hash_init(A,B,C,D,E,F,G,H) my_hash_init2(A,0,B,C,D,E,F,G,H)
my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
ulong default_array_elements, size_t key_offset,
size_t key_length, my_hash_get_key get_key,
void (*free_element)(void*),
@ -98,7 +96,7 @@ my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument);
#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
#define my_hash_inited(H) ((H)->blength != 0)
#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
(!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H))
(!my_hash_inited(A) && my_hash_init(A,B,C,D,E,F,G,H))
#ifdef __cplusplus
}

View File

@ -1,4 +1,5 @@
/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
Copyright (c) 2009, 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
@ -60,31 +61,31 @@ extern "C" {
sets all high keys.
*/
#define MARIA_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
#define MARIA_KEYMAP_HIGH_MASK (ULL(1) << (MARIA_KEYMAP_BITS - 1))
#define MARIA_KEYMAP_HIGH_MASK (1ULL << (MARIA_KEYMAP_BITS - 1))
#define maria_get_mask_all_keys_active(_keys_) \
(((_keys_) < MARIA_KEYMAP_BITS) ? \
((ULL(1) << (_keys_)) - ULL(1)) : \
(~ ULL(0)))
((1ULL << (_keys_)) - 1ULL) : \
(~ 0ULL))
#if MARIA_MAX_KEY > MARIA_KEYMAP_BITS
#define maria_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MARIA_KEYMAP_BITS) ? \
test((_keymap_) & (ULL(1) << (_keyno_))) : \
test((_keymap_) & (1ULL << (_keyno_))) : \
test((_keymap_) & MARIA_KEYMAP_HIGH_MASK))
#define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
(ULL(1) << (_keyno_)) : \
(1ULL << (_keyno_)) : \
MARIA_KEYMAP_HIGH_MASK)
#define maria_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
(~ (ULL(1) << (_keyno_))) : \
(~ (ULL(0))) /*ignore*/ )
(~ (1ULL << (_keyno_))) : \
(~ (0ULL)) /*ignore*/ )
#else
#define maria_is_key_active(_keymap_,_keyno_) \
test((_keymap_) & (ULL(1) << (_keyno_)))
test((_keymap_) & (1ULL << (_keyno_)))
#define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (ULL(1) << (_keyno_))
(_keymap_)|= (1ULL << (_keyno_))
#define maria_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (~ (ULL(1) << (_keyno_)))
(_keymap_)&= (~ (1ULL << (_keyno_)))
#endif
#define maria_is_any_key_active(_keymap_) \
test((_keymap_))

View File

@ -313,12 +313,12 @@ enum ha_base_keytype {
#define HA_OPTION_CHECKSUM 32
#define HA_OPTION_DELAY_KEY_WRITE 64
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
#define HA_OPTION_CREATE_FROM_ENGINE 256
/* unused 256 */
#define HA_OPTION_RELIES_ON_SQL_LAYER 512
#define HA_OPTION_NULL_FIELDS 1024
#define HA_OPTION_PAGE_CHECKSUM 2048
/* .frm has extra create options in linked-list format */
#define HA_OPTION_TEXT_CREATE_OPTIONS (1L << 14)
#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1L << 14) /* 5.2 to 5.5, unused since 10.0 */
#define HA_OPTION_TEMP_COMPRESS_RECORD (1L << 15) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA (1L << 16) /* Set by isamchk */
#define HA_OPTION_NO_CHECKSUM (1L << 17)
@ -405,7 +405,7 @@ enum ha_base_keytype {
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */
#define HA_ERR_OUT_OF_MEM 128 /* Out of memory */
#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */

View File

@ -46,8 +46,9 @@ extern "C" {
#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
/* 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_SORT 8192 /* my_lib; sort files */
#define MY_WANT_STAT 16384 /* my_lib; stat files */
#define MY_DONT_SORT 0
/* typedefs for my_dir & my_stat */
@ -94,7 +95,7 @@ typedef struct st_my_dir /* Struct returned from my_dir */
we don't want to change code that uses my_dir.
*/
struct fileinfo *dir_entry;
uint number_off_files;
uint number_of_files;
} MY_DIR;
extern MY_DIR *my_dir(const char *path,myf MyFlags);

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
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
@ -89,6 +90,12 @@
#define IF_WIN(A,B) B
#endif
#ifdef EMBEDDED_LIBRARY
#define IF_EMBEDDED(A,B) A
#else
#define IF_EMBEDDED(A,B) B
#endif
#if defined (_WIN32)
/*
off_t is 32 bit long. We do not use C runtime functions
@ -379,7 +386,8 @@ C_MODE_END
#define compile_time_assert(X) \
do \
{ \
typedef char compile_time_assert[(X) ? 1 : -1]; \
typedef char compile_time_assert[(X) ? 1 : -1] \
__attribute__((unused)); \
} while(0)
#endif
@ -464,7 +472,7 @@ typedef unsigned int uint;
typedef unsigned short ushort;
#endif
#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
#define swap_variables(t, a, b) do { t dummy; dummy= a; a= b; b= dummy; } while(0)
#define test(a) ((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
@ -997,25 +1005,8 @@ typedef struct st_mysql_lex_string LEX_STRING;
typedef ulong myf; /* Type of MyFlags in my_funcs */
typedef char my_bool; /* Small bool */
/* Macros for converting *constants* to the right type */
#define MYF(v) (myf) (v)
#ifndef LL
#ifdef HAVE_LONG_LONG
#define LL(A) A ## LL
#else
#define LL(A) A ## L
#endif
#endif
#ifndef ULL
#ifdef HAVE_LONG_LONG
#define ULL(A) A ## ULL
#else
#define ULL(A) A ## UL
#endif
#endif
/*
Defines to make it possible to prioritize register assignments. No
longer that important with modern compilers.

View File

@ -713,7 +713,6 @@ extern size_t cleanup_dirname(char * to,const char *from);
extern size_t system_filename(char * to,const char *from);
extern size_t unpack_filename(char * to,const char *from);
extern char * intern_filename(char * to,const char *from);
extern char * directory_file_name(char * dst, const char *src);
extern int pack_filename(char * to, const char *name, size_t max_length);
extern char * my_path(char * to,const char *progname,
const char *own_pathname_part);
@ -884,7 +883,7 @@ extern void *my_az_allocator(void *dummy, unsigned int items, unsigned int size)
extern void my_az_free(void *dummy, void *address);
extern int my_compress_buffer(uchar *dest, size_t *destLen,
const uchar *source, size_t sourceLen);
extern int packfrm(uchar *, size_t, uchar **, size_t *);
extern int packfrm(const uchar *, size_t, uchar **, size_t *);
extern int unpackfrm(uchar **, size_t *, const uchar *);
extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 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
@ -57,35 +58,35 @@ extern "C" {
sets all high keys.
*/
#define MI_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
#define MI_KEYMAP_HIGH_MASK (ULL(1) << (MI_KEYMAP_BITS - 1))
#define MI_KEYMAP_HIGH_MASK (1ULL << (MI_KEYMAP_BITS - 1))
#define mi_get_mask_all_keys_active(_keys_) \
(((_keys_) < MI_KEYMAP_BITS) ? \
((ULL(1) << (_keys_)) - ULL(1)) : \
(~ ULL(0)))
((1ULL << (_keys_)) - 1ULL) : \
(~ 0ULL))
#if MI_MAX_KEY > MI_KEYMAP_BITS
#define mi_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MI_KEYMAP_BITS) ? \
test((_keymap_) & (ULL(1) << (_keyno_))) : \
test((_keymap_) & (1ULL << (_keyno_))) : \
test((_keymap_) & MI_KEYMAP_HIGH_MASK))
#define mi_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
(ULL(1) << (_keyno_)) : \
(1ULL << (_keyno_)) : \
MI_KEYMAP_HIGH_MASK)
#define mi_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \
(~ (ULL(1) << (_keyno_))) : \
(~ (ULL(0))) /*ignore*/ )
(~ (1ULL << (_keyno_))) : \
(~ (0ULL)) /*ignore*/ )
#else
#define mi_is_key_active(_keymap_,_keyno_) \
test((_keymap_) & (ULL(1) << (_keyno_)))
test((_keymap_) & (1ULL << (_keyno_)))
#define mi_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (ULL(1) << (_keyno_))
(_keymap_)|= (1ULL << (_keyno_))
#define mi_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (~ (ULL(1) << (_keyno_)))
(_keymap_)&= (~ (1ULL << (_keyno_)))
#endif

View File

@ -140,9 +140,9 @@ typedef struct st_handler_check_param
/* Following is used to check if rows are visible */
ulonglong max_trid, max_found_trid;
ulonglong not_visible_rows_found;
ulonglong sort_buffer_length;
ulonglong use_buffers; /* Used as param to getopt() */
size_t read_buffer_length, write_buffer_length;
size_t sort_buffer_length, sort_key_blocks;
size_t read_buffer_length, write_buffer_length, sort_key_blocks;
time_t backup_time; /* To sign backup files */
ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];

View File

@ -52,14 +52,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
extern struct my_thread_scheduler_service {
int (*set)(struct scheduler_functions *scheduler);
int (*reset)();
} *my_thread_scheduler_service;
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
int my_thread_scheduler_reset();
#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);

View File

@ -27,7 +27,7 @@
#include <mysql/plugin.h>
#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0200
#include <mysql/plugin_auth_common.h>
@ -78,7 +78,7 @@ typedef struct st_mysql_server_auth_info
Not used by the server.
Available through the @@EXTERNAL_USER variable.
*/
char external_user[512];
char external_user[MYSQL_USERNAME_LENGTH+1];
/**
This only affects the "Authentication failed. Password used: %s"

View File

@ -52,14 +52,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
extern struct my_thread_scheduler_service {
int (*set)(struct scheduler_functions *scheduler);
int (*reset)();
} *my_thread_scheduler_service;
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
int my_thread_scheduler_reset();
#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
@ -267,8 +259,8 @@ typedef struct st_mysql_server_auth_info
unsigned int user_name_length;
const char *auth_string;
unsigned long auth_string_length;
char authenticated_as[48 +1];
char external_user[512];
char authenticated_as[512 +1];
char external_user[512 +1];
int password_used;
const char *host_or_ip;
unsigned int host_or_ip_length;

View File

@ -28,7 +28,7 @@
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/** the max allowed length for a user name */
#define MYSQL_USERNAME_LENGTH 48
#define MYSQL_USERNAME_LENGTH 512
/**
return values of the plugin authenticate_user() method.

View File

@ -52,14 +52,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
extern struct my_thread_scheduler_service {
int (*set)(struct scheduler_functions *scheduler);
int (*reset)();
} *my_thread_scheduler_service;
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
int my_thread_scheduler_reset();
#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);

View File

@ -49,6 +49,7 @@
string will be quoted according to MySQL identifier quoting rules.
Both <width> and <precision> can be specified as numbers or '*'.
If an asterisk is used, an argument of type int is consumed.
<length modifier> can be 'l', 'll', or 'z'.

View File

@ -1,65 +0,0 @@
/*
Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED
#define SERVICE_THREAD_SCHEDULER_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
struct scheduler_functions;
extern struct my_thread_scheduler_service {
int (*set)(struct scheduler_functions *scheduler);
int (*reset)();
} *my_thread_scheduler_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define my_thread_scheduler_set(F) my_thread_scheduler_service->set((F))
#define my_thread_scheduler_reset() my_thread_scheduler_service->reset()
#else
/**
Set the thread scheduler to use for the server.
@param scheduler Pointer to scheduler callbacks to use.
@retval 0 Scheduler installed correctly.
@retval 1 Invalid value (NULL) used for scheduler.
*/
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
/**
Restore the previous thread scheduler.
@note If no thread scheduler was installed previously with
thd_set_thread_scheduler, this function will report an error.
@retval 0 Scheduler installed correctly.
@retval 1 No scheduler installed.
*/
int my_thread_scheduler_reset();
#endif
#ifdef __cplusplus
}
#endif
#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */

View File

@ -1,5 +1,6 @@
#ifndef MYSQL_SERVICES_INCLUDED
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
Copyright (c) 2012, 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
@ -21,7 +22,6 @@ extern "C" {
#include <mysql/service_my_snprintf.h>
#include <mysql/service_thd_alloc.h>
#include <mysql/service_thd_wait.h>
#include <mysql/service_thread_scheduler.h>
#include <mysql/service_progress_report.h>
#include <mysql/service_debug_sync.h>
#include <mysql/service_kill_statement.h>

View File

@ -34,6 +34,31 @@
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1)
#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH)
/*
MDEV-4088
MySQL (and MariaDB 5.x before the fix) was using the first character of the
server version string (as sent in the first handshake protocol packet) to
decide on the replication event formats. And for 10.x the first character
is "1", which the slave thought comes from some ancient 1.x version
(ignoring the fact that the first ever MySQL version was 3.x).
To support replication to these old clients, we fake the version in the
first handshake protocol packet to start from "5.5.5-" (for example,
it might be "5.5.5-10.0.1-MariaDB-debug-log".
On the client side we remove this fake version prefix to restore the
correct server version. The version "5.5.5" did not support
pluggable authentication, so any version starting from "5.5.5-" and
claiming to support pluggable auth, must be using this fake prefix.
*/
#ifdef EMBEDDED_LIBRARY
#define RPL_VERSION_HACK ""
#else
/* this version must be the one that *does not* support pluggable auth */
#define RPL_VERSION_HACK "5.5.5-"
#endif
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define LIST_PROCESS_HOST_LEN 64
@ -41,7 +66,7 @@
/*
Maximum length of comments
*/
#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */
#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 5.5: 60 characters */
#define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024

View File

@ -0,0 +1,8 @@
const char *load_default_groups[]= {
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
"mysql_cluster",
#endif
"mysqld", "server", MYSQL_BASE_VERSION,
"mariadb", MARIADB_BASE_VERSION,
"client-server",
0, 0};

View File

@ -6,121 +6,124 @@
#define _PROBES_MYSQL_D
#ifdef __cplusplus
#define MYSQL_PROBES_FALSE false
extern "C" {
#else
#define MYSQL_PROBES_FALSE 0
#endif
#define MYSQL_CONNECTION_START(arg0, arg1, arg2)
#define MYSQL_CONNECTION_START_ENABLED() (0)
#define MYSQL_CONNECTION_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_CONNECTION_DONE(arg0, arg1)
#define MYSQL_CONNECTION_DONE_ENABLED() (0)
#define MYSQL_CONNECTION_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3)
#define MYSQL_COMMAND_START_ENABLED() (0)
#define MYSQL_COMMAND_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_COMMAND_DONE(arg0)
#define MYSQL_COMMAND_DONE_ENABLED() (0)
#define MYSQL_COMMAND_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4)
#define MYSQL_QUERY_START_ENABLED() (0)
#define MYSQL_QUERY_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_DONE(arg0)
#define MYSQL_QUERY_DONE_ENABLED() (0)
#define MYSQL_QUERY_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_PARSE_START(arg0)
#define MYSQL_QUERY_PARSE_START_ENABLED() (0)
#define MYSQL_QUERY_PARSE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_PARSE_DONE(arg0)
#define MYSQL_QUERY_PARSE_DONE_ENABLED() (0)
#define MYSQL_QUERY_PARSE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_CACHE_HIT(arg0, arg1)
#define MYSQL_QUERY_CACHE_HIT_ENABLED() (0)
#define MYSQL_QUERY_CACHE_HIT_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_CACHE_MISS(arg0)
#define MYSQL_QUERY_CACHE_MISS_ENABLED() (0)
#define MYSQL_QUERY_CACHE_MISS_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5)
#define MYSQL_QUERY_EXEC_START_ENABLED() (0)
#define MYSQL_QUERY_EXEC_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_EXEC_DONE(arg0)
#define MYSQL_QUERY_EXEC_DONE_ENABLED() (0)
#define MYSQL_QUERY_EXEC_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_ROW_START(arg0, arg1)
#define MYSQL_INSERT_ROW_START_ENABLED() (0)
#define MYSQL_INSERT_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_ROW_DONE(arg0)
#define MYSQL_INSERT_ROW_DONE_ENABLED() (0)
#define MYSQL_INSERT_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_ROW_START(arg0, arg1)
#define MYSQL_UPDATE_ROW_START_ENABLED() (0)
#define MYSQL_UPDATE_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_ROW_DONE(arg0)
#define MYSQL_UPDATE_ROW_DONE_ENABLED() (0)
#define MYSQL_UPDATE_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_ROW_START(arg0, arg1)
#define MYSQL_DELETE_ROW_START_ENABLED() (0)
#define MYSQL_DELETE_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_ROW_DONE(arg0)
#define MYSQL_DELETE_ROW_DONE_ENABLED() (0)
#define MYSQL_DELETE_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_READ_ROW_START(arg0, arg1, arg2)
#define MYSQL_READ_ROW_START_ENABLED() (0)
#define MYSQL_READ_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_READ_ROW_DONE(arg0)
#define MYSQL_READ_ROW_DONE_ENABLED() (0)
#define MYSQL_READ_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INDEX_READ_ROW_START(arg0, arg1)
#define MYSQL_INDEX_READ_ROW_START_ENABLED() (0)
#define MYSQL_INDEX_READ_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INDEX_READ_ROW_DONE(arg0)
#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (0)
#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1)
#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (0)
#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1)
#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (0)
#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1)
#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (0)
#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_RDLOCK_DONE(arg0)
#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (0)
#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_WRLOCK_DONE(arg0)
#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (0)
#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_UNLOCK_DONE(arg0)
#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (0)
#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_FILESORT_START(arg0, arg1)
#define MYSQL_FILESORT_START_ENABLED() (0)
#define MYSQL_FILESORT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_FILESORT_DONE(arg0, arg1)
#define MYSQL_FILESORT_DONE_ENABLED() (0)
#define MYSQL_FILESORT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_SELECT_START(arg0)
#define MYSQL_SELECT_START_ENABLED() (0)
#define MYSQL_SELECT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_SELECT_DONE(arg0, arg1)
#define MYSQL_SELECT_DONE_ENABLED() (0)
#define MYSQL_SELECT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_START(arg0)
#define MYSQL_INSERT_START_ENABLED() (0)
#define MYSQL_INSERT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_DONE(arg0, arg1)
#define MYSQL_INSERT_DONE_ENABLED() (0)
#define MYSQL_INSERT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_SELECT_START(arg0)
#define MYSQL_INSERT_SELECT_START_ENABLED() (0)
#define MYSQL_INSERT_SELECT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_SELECT_DONE(arg0, arg1)
#define MYSQL_INSERT_SELECT_DONE_ENABLED() (0)
#define MYSQL_INSERT_SELECT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_START(arg0)
#define MYSQL_UPDATE_START_ENABLED() (0)
#define MYSQL_UPDATE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_DONE(arg0, arg1, arg2)
#define MYSQL_UPDATE_DONE_ENABLED() (0)
#define MYSQL_UPDATE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_UPDATE_START(arg0)
#define MYSQL_MULTI_UPDATE_START_ENABLED() (0)
#define MYSQL_MULTI_UPDATE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2)
#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (0)
#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_START(arg0)
#define MYSQL_DELETE_START_ENABLED() (0)
#define MYSQL_DELETE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_DONE(arg0, arg1)
#define MYSQL_DELETE_DONE_ENABLED() (0)
#define MYSQL_DELETE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_DELETE_START(arg0)
#define MYSQL_MULTI_DELETE_START_ENABLED() (0)
#define MYSQL_MULTI_DELETE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_DELETE_DONE(arg0, arg1)
#define MYSQL_MULTI_DELETE_DONE_ENABLED() (0)
#define MYSQL_MULTI_DELETE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_READ_START()
#define MYSQL_NET_READ_START_ENABLED() (0)
#define MYSQL_NET_READ_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_READ_DONE(arg0, arg1)
#define MYSQL_NET_READ_DONE_ENABLED() (0)
#define MYSQL_NET_READ_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_WRITE_START(arg0)
#define MYSQL_NET_WRITE_START_ENABLED() (0)
#define MYSQL_NET_WRITE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_WRITE_DONE(arg0)
#define MYSQL_NET_WRITE_DONE_ENABLED() (0)
#define MYSQL_NET_WRITE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_START(arg0, arg1, arg2, arg3)
#define MYSQL_KEYCACHE_READ_START_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_BLOCK(arg0)
#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_HIT()
#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_MISS()
#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_DONE(arg0, arg1)
#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (0)
#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_START(arg0, arg1, arg2, arg3)
#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (0)
#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_BLOCK(arg0)
#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (0)
#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_DONE(arg0, arg1)
#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (0)
#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#ifdef __cplusplus
}

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
Copyright (c) 2012, 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
@ -22,7 +23,6 @@
#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

@ -61,6 +61,7 @@ uint thd_get_net_read_write(THD *thd);
void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
ulong thd_get_net_wait_timeout(THD *thd);
my_socket thd_get_fd(THD *thd);
int thd_store_globals(THD* thd);
THD *first_global_thread();
THD *next_global_thread(THD *thd);

View File

@ -239,11 +239,7 @@ struct st_vio
struct sockaddr_storage remote; /* Remote internet address */
int addrLen; /* Length of remote address */
enum enum_vio_type type; /* Type of connection */
/*
Description string. This member MUST NOT be used directly, but only
via function "vio_description"
*/
char desc[VIO_DESCRIPTION_SIZE];
const char *desc; /* String description */
char *read_buffer; /* buffer for vio_read_buff */
char *read_pos; /* start of unfetched data in the
read buffer */

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates.
/* Copyright (c) 2011, 2013, Oracle and/or its affiliates.
Copyright (c) 2011, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@ -17,7 +17,7 @@
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2012"
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2013"
/*
This define specifies copyright notice which is displayed by every MySQL

View File

@ -141,13 +141,14 @@ mysql_load_plugin
mysql_load_plugin_v
mysql_plugin_options
# Async API
mysql_get_timeout_value
mysql_get_timeout_value_ms
mysql_get_socket
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
@ -262,17 +263,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
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
)
# Also export the non-renamed variants
# (in case someone wants to rebuild mysqli-php or something similar)
# See MDEV-4127
default_charset_info
get_charset
get_charset_by_csname
net_realloc
client_errors
THR_KEY_mysys
)
# Add special script to fix symbols renames by Fedora
SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc)
SET(CLIENT_SOURCES_EXTRA rpm_support.cc)
SET(VERSION_SCRIPT_TEMPLATE
${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in)
ELSEIF(DEB)
@ -361,7 +371,7 @@ IF(UNIX)
ENDIF()
IF(NOT DISABLE_SHARED)
MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT SharedLibraries)
MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_EXTRA} COMPONENT SharedLibraries)
IF(UNIX)
# libtool compatability
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)

View File

@ -62,13 +62,35 @@
/* were just going to fake it here and get input from the keyboard */
void get_tty_password_buff(const char *opt_message, char *to, size_t length)
{
HANDLE consoleinput;
DWORD oldstate;
char *pos=to,*end=to+length-1;
int i=0;
consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ ,
NULL, OPEN_EXISTING, 0, NULL);
if (consoleinput == NULL || consoleinput == INVALID_HANDLE_VALUE)
{
/* This is a GUI application or service without console input, bail out. */
*to= 0;
return;
}
_cputs(opt_message ? opt_message : "Enter password: ");
/*
Switch to raw mode (no line input, no echo input).
Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
*/
GetConsoleMode(consoleinput, &oldstate);
SetConsoleMode(consoleinput, ENABLE_PROCESSED_INPUT);
for (;;)
{
int tmp;
tmp=_getch();
char tmp;
DWORD chars_read;
if (!ReadConsole(consoleinput, &tmp, 1, &chars_read, NULL))
break;
if (chars_read == 0)
break;
if (tmp == '\b' || tmp == 127)
{
if (pos != to)
@ -78,13 +100,16 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length)
continue;
}
}
if (tmp == -1 || tmp == '\n' || tmp == '\r' || tmp == 3)
if (tmp == '\n' || tmp == '\r')
break;
if (iscntrl(tmp) || pos == end)
continue;
_cputs("*");
*(pos++) = (char)tmp;
*(pos++) = tmp;
}
/* Reset console mode after password input. */
SetConsoleMode(consoleinput, oldstate);
CloseHandle(consoleinput);
*pos=0;
_cputs("\n");
}

View File

@ -21,6 +21,8 @@ libmysqlclient_16 {
my_print_help;
# pure-ftpd requires this
my_make_scrambled_password;
# fedora18 export
THR_KEY_mysys;
# hydra requires this
scramble;
# DBD::mysql requires this
@ -34,15 +36,27 @@ libmysqlclient_18 {
@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_
# require them. Fedora limits the namespace damage by prefixing mysql_
# (see mysql-dubious-exports.patch), which means the symbols are not present
# in libmysqlclient_16.
#
# MariaDB does not do the Fedora-style function renaming via #define in headers,
# however it exports mysql_ prefixed symbols in addition to the "normal" ones.
#
# To ensure successful recompilation of affected projects, as well as drop-in replacement
# for MySQL libraries, provided by distribution, both original symbols and their mysql_
# prefixed counterparts have to be exported.
# mysql-connector-odbc requires these
mysql_default_charset_info;
mysql_get_charset;
mysql_get_charset_by_csname;
mysql_net_realloc;
default_charset_info;
get_charset;
get_charset_by_csname;
net_realloc;
# PHP's mysqli.so requires this (via the ER() macro)
mysql_client_errors;
client_errors;
};

View File

@ -440,7 +440,7 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
int emb_read_change_user_result(MYSQL *mysql)
{
mysql->net.read_pos= (uchar*)""; // fake an OK packet
return mysql_errno(mysql) ? packet_error : 1 /* length of the OK packet */;
return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */;
}
MYSQL_METHODS embedded_methods=

View File

@ -1,4 +1,4 @@
# Copyright (c) 2006 MySQL AB, 2010 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006 MySQL AB, 2010 Oracle and/or its affiliates.
#
# 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
@ -19,7 +19,6 @@ SET(MYSQLSERVICES_SOURCES
my_snprintf_service.c
thd_alloc_service.c
thd_wait_service.c
my_thread_scheduler_service.c
progress_report_service.c
debug_sync_service.c
kill_statement_service.c)

View File

@ -76,7 +76,7 @@ it should also declare all the accompanying data structures, as necessary
==================================================================
/* GPL header */
#include <service_versions.h>
SERVICE_VERSION *foo_service= (void*)VERSION_foo;
SERVICE_VERSION foo_service= (void*)VERSION_foo;
==================================================================
7. add the new file to libservices/CMakeLists.txt (MYSQLSERVICES_SOURCES)

View File

@ -15,4 +15,4 @@
*/
#include <service_versions.h>
SERVICE_VERSION *debug_sync_service= (void*)VERSION_debug_sync;
SERVICE_VERSION debug_sync_service= (void*)VERSION_debug_sync;

View File

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

View File

@ -14,4 +14,4 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <service_versions.h>
SERVICE_VERSION *progress_report_service= (void*)VERSION_progress_report;
SERVICE_VERSION progress_report_service= (void*)VERSION_progress_report;

View File

@ -15,4 +15,4 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <service_versions.h>
SERVICE_VERSION *thd_alloc_service= (void*)VERSION_thd_alloc;
SERVICE_VERSION thd_alloc_service= (void*)VERSION_thd_alloc;

View File

@ -16,4 +16,4 @@
*/
#include <service_versions.h>
SERVICE_VERSION *thd_wait_service= (void*)VERSION_thd_wait;
SERVICE_VERSION thd_wait_service= (void*)VERSION_thd_wait;

View File

@ -1,4 +1,4 @@
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 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
@ -154,8 +154,10 @@ ENDMACRO()
FILE(GLOB infiles "collections/*.in")
FOREACH(collin ${infiles})
STRING(REPLACE ".in" "" collection ${collin})
STRING(REPLACE ".in" ".done" colldone ${collin})
# Only generate file once
IF(NOT EXISTS ${collection})
IF(NOT EXISTS ${colldone})
PROCESS_COLLECTION_INCLUDE(${collin} ${collection})
FILE(APPEND ${colldone} "${collin}\n")
ENDIF()
ENDFOREACH()

View File

@ -1,5 +1,5 @@
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list --unit-tests
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=row --vardir=var-row --mysqld=--binlog-format=row --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --mysqld=--binlog-format=row --ps-protocol --skip-test-list=collections/disabled-daily.list

View File

@ -18,9 +18,4 @@ rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several
sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails
# BUG #59055 : All ndb tests should be removed from the repository
# Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests
sys_vars.ndb_log_update_as_write_basic
sys_vars.have_ndbcluster_basic
sys_vars.ndb_log_updated_only_basic
sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5

View File

@ -1,5 +1,6 @@
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list --unit-tests
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental
perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list
perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental

View File

@ -4,14 +4,14 @@
# include default.daily
# include default.weekly
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-ndbcluster --skip-rpl --report-features --debug-server
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --skip-ndbcluster --report-features
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --skip-ndbcluster --ps-protocol
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-rpl --report-features --debug-server
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs1+ps --vardir=var-funcs_1_ps --suite=funcs_1 --ps-protocol
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts --suite=parts
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=stress --vardir=var-stress --suite=stress
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=jp --vardir=var-jp --suite=jp
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl --skip-ndbcluster
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist --vardir=var-nist --suite=nist
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist+ps --vardir=var-nist_ps --suite=nist --ps-protocol

View File

@ -13,10 +13,10 @@ tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing.
lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
ssl_crl_clients_valid : broken upstream
ssl_crl : broken upstream
ssl_crl_clrpath : broken upstream
show_explain : Psergey: random timeout in range-checked-for-each record query.

View File

@ -1,22 +0,0 @@
--exec $MYSQL test -e "show processlist" > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
--disable_warnings
drop table if exists t999;
--enable_warnings
# Create a table to hold the process list
create temporary table t999(
id int,
user char(255),
host char(255),
db char(255),
Command char(255),
time int,
State char(255),
info char(255)
);
# Load processlist into table, headers will create seom warnings
--disable_warnings
--replace_result $MYSQLTEST_VARDIR "."
eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
--enable_warnings
let $id = `select Id from t999 where Command="Binlog Dump"`;
drop table t999;

View File

@ -1,4 +1,4 @@
if (`SELECT COUNT(*) = 0 FROM information_schema.session_variables WHERE
variable_name = 'debug_sync' AND variable_value LIKE 'ON %'`) {
--skip Needs debug_sync enabled
if (`select count(*) = 0 from information_schema.session_variables where variable_name = 'debug_sync' and variable_value like 'on %'`)
{
skip debug_sync is not available;
}

View File

@ -0,0 +1,4 @@
if (`select count(*) < 2 from information_schema.plugins where plugin_name like 'rpl_semi_sync_%'`)
{
--skip Test requires semisync plugins
}

View File

@ -0,0 +1,4 @@
--plugin-load=$SEMISYNC_MASTER_SO
--plugin-load=$SEMISYNC_SLAVE_SO
--loose-rpl-semi-sync-master
--loose-rpl-semi-sync-slave

View File

@ -1,15 +0,0 @@
#
# Check if server has support for loading plugins
#
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip Requires dynamic loading
}
#
# Check if the variable SEMISYNC_MASTER_SO is set
#
if (!$SEMISYNC_MASTER_SO)
{
skip Need semisync plugins;
}

View File

@ -627,17 +627,12 @@ DROP TABLE t1,t2,t3;
create table t1 (a int) engine=innodb;
let $MYSQLD_DATADIR= `select @@datadir`;
copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm;
--error 1146
--error ER_NO_SUCH_TABLE_IN_ENGINE
select * from bug29807;
drop table t1;
--error 1051
drop table bug29807;
create table bug29807 (a int);
drop table bug29807;
--disable_query_log
call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal");
call mtr.add_suppression("Cannot find or open table test\/bug29807 from");
--enable_query_log
#

View File

@ -0,0 +1,37 @@
--error 0,3
--perl
my $n = 254 - length($ENV{MYSQLTEST_VARDIR});
my $name = $ENV{MYSQLTEST_VARDIR} . '/' . sprintf("%0${n}d", $$);
if (!open(LONG_NAME,">$name"))
{
# We cannot rely either on a particular error code, or error string
# to check that we indeed hit "File name too long".
# Instead, we will try to create a file with a short name
# the same way, in the same location. If it goes all right,
# we will assume the problem was with the file name length
open(SHORT_NAME,">$ENV{MYSQLTEST_VARDIR}/$$") ||
# Even a shorter name could not be created, something else is wrong
die "Could not create file $ENV{MYSQLTEST_VARDIR}/$$: $!";
close(SHORT_NAME);
unlink("$ENV{MYSQLTEST_VARDIR}/$$");
exit(3);
} else {
close(LONG_NAME);
unlink($name);
exit(0);
}
EOF
# If perl exited with error code 0, the check has passed,
# so the calling test will be executed.
# If perl exited with error code 3, it will be caught by
# --error above, and processed by the check below.
# If perl exited with some other error code, something went wrong,
# so the test will fail.
if ($errno)
{
--skip Long file names are not supported
}

View File

@ -29,4 +29,4 @@ INSTALL(TARGETS my_safe_process DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/Safe
IF(WIN32)
INSTALL(TARGETS my_safe_kill DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
ENDIF()
INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
INSTALL(FILES Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)

View File

@ -153,12 +153,19 @@ int main(int argc, char* const argv[] )
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
bool nocore = false;
struct sigaction sa,sa_abort;
sa.sa_handler= handle_signal;
sa.sa_flags= SA_NOCLDSTOP;
sigemptyset(&sa.sa_mask);
sa_abort.sa_handler= handle_abort;
sigemptyset(&sa_abort.sa_mask);
/* Install signal handlers */
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
signal(SIGCHLD, handle_signal);
signal(SIGABRT, handle_abort);
sigaction(SIGTERM, &sa,NULL);
sigaction(SIGINT, &sa,NULL);
sigaction(SIGCHLD, &sa,NULL);
sigaction(SIGABRT, &sa_abort,NULL);
sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);

View File

@ -1,166 +0,0 @@
#!/usr/bin/perl
# -*- cperl -*-
# Copyright (c) 2007, 2011, Oracle and/or its affiliates
#
# 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
use strict;
use warnings;
use lib 'lib';
use My::SafeProcess::Base;
use POSIX qw(WNOHANG);
###########################################################################
# Util functions
###########################################################################
#
#Print message to stderr
#
my $verbose= 0;
sub message {
if ($verbose > 0){
use Time::localtime;
my $tm= localtime();
my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d",
$tm->year % 100, $tm->mon+1, $tm->mday,
$tm->hour, $tm->min, $tm->sec);
print STDERR $timestamp, " monitor[$$]: ", @_, "\n";
}
}
###########################################################################
# Main program
###########################################################################
my $terminated= 0;
# Protect against being killed in the middle
# of child creation, just set the terminated flag
# to make sure the child will be killed off
# when program is ready to do that
$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; };
$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; };
my $parent_pid= getppid();
my $found_double_dash= 0;
while (my $arg= shift(@ARGV)){
if ($arg =~ /^--$/){
$found_double_dash= 1;
last;
}
elsif ($arg =~ /^--verbose$/){
$verbose= 1;
}
else {
die "Unknown option: $arg";
}
}
my $path= shift(@ARGV); # Executable
die "usage:\n" .
" safe_process.pl [opts] -- <path> [<args> [...<args_n>]]"
unless defined $path || $found_double_dash;
message("started");
#message("path: '$path'");
message("parent: $parent_pid");
# Start process to monitor
my $child_pid=
create_process(
path => $path,
args => \@ARGV,
setpgrp => 1,
);
message("Started child $child_pid");
eval {
sub handle_signal {
$terminated= 1;
message("Got signal @_");
# Ignore all signals
foreach my $name (keys %SIG){
$SIG{$name}= 'IGNORE';
}
die "signaled\n";
};
local $SIG{TERM}= \&handle_signal;
local $SIG{INT}= \&handle_signal;
local $SIG{CHLD}= sub {
message("Got signal @_");
kill('KILL', -$child_pid);
my $ret= waitpid($child_pid, 0);
if ($? & 127){
exit(65); # Killed by signal
}
exit($? >> 8);
};
# Monitoring loop
while(!$terminated) {
# Check if parent is still alive
if (kill(0, $parent_pid) < 1){
message("Parent is not alive anymore");
last;
}
# Wait for child to terminate but wakeup every
# second to also check that parent is still alive
my $ret_pid;
$ret_pid= waitpid($child_pid, &WNOHANG);
if ($ret_pid == $child_pid) {
# Process has exited, collect return status
my $ret_code= $? >> 8;
message("Child exit: $ret_code");
# Exit with exit status of the child
exit ($ret_code);
}
sleep(1);
}
};
if ( $@ ) {
# The monitoring loop should have been
# broken by handle_signal
warn "Unexpected: $@" unless ( $@ =~ /signaled/ );
}
# Use negative pid in order to kill the whole
# process group
#
my $ret= kill('KILL', -$child_pid);
message("Killed child: $child_pid, ret: $ret");
if ($ret > 0) {
message("Killed child: $child_pid");
# Wait blocking for the child to return
my $ret_pid= waitpid($child_pid, 0);
if ($ret_pid != $child_pid){
message("unexpected pid $ret_pid returned from waitpid($child_pid)");
}
}
message("DONE!");
exit (1);

View File

@ -769,18 +769,11 @@ sub collect_one_test_case {
if ( $tinfo->{'ndb_test'} )
{
# This is a NDB test
if ( $::opt_skip_ndbcluster == 2 )
if ( $::ndbcluster_enabled == 0)
{
# Ndb is not supported, skip it
# ndbcluster is disabled
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster support or ndb tests not enabled";
return $tinfo;
}
elsif ( $::opt_skip_ndbcluster )
{
# All ndb test's should be skipped
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster";
$tinfo->{'comment'}= "ndbcluster disabled";
return $tinfo;
}
}
@ -975,6 +968,8 @@ sub get_tags_from_file($$) {
} elsif ($over and $file =~ m@^$pdir/(.*)$@) {
$suffix = $1;
@prefix = map { "$_/" } $sdir, $pdir;
} else {
$over = 0; # file neither in $sdir nor in $pdir
}
while (my $line= <$F>)

View File

@ -28,7 +28,7 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
mtr_warning mtr_error mtr_debug mtr_verbose
mtr_verbose_restart mtr_report_test_passed
mtr_report_test_skipped mtr_print
mtr_report_test);
mtr_report_test isotime);
use mtr_match;
use My::Platform;
@ -106,6 +106,8 @@ sub mtr_report_test_passed ($) {
$tinfo->{'result'}= 'MTR_RES_PASSED';
mtr_report_test($tinfo);
resfile_global("endtime ", isotime (time));
}
@ -550,4 +552,12 @@ sub mtr_verbose_restart (@) {
}
# Used by --result-file for for formatting times
sub isotime($) {
my ($sec,$min,$hr,$day,$mon,$yr)= gmtime($_[0]);
return sprintf "%d-%02d-%02dT%02d:%02d:%02dZ",
$yr+1900, $mon+1, $day, $hr, $min, $sec;
}
1;

View File

@ -208,6 +208,8 @@ our @opt_mysqld_envs;
my $opt_stress;
my $opt_dry_run;
my $opt_compress;
my $opt_ssl;
my $opt_skip_ssl;
@ -334,8 +336,9 @@ sub check_timeout ($) { return testcase_timeout($_[0]) / 10; }
our $opt_warnings= 1;
our $opt_include_ndbcluster= 0;
our $opt_skip_ndbcluster= 1;
our $ndbcluster_enabled= 0;
my $opt_include_ndbcluster= 0;
my $opt_skip_ndbcluster= 0;
my $exe_ndbd;
my $exe_ndbmtd;
@ -346,7 +349,7 @@ my $exe_ndb_mgm;
our %mysqld_variables;
our @optional_plugins;
my $source_dist= 0;
my $source_dist= -d "../sql";
my $opt_max_save_core= env_or_val(MTR_MAX_SAVE_CORE => 5);
my $opt_max_save_datadir= env_or_val(MTR_MAX_SAVE_DATADIR => 20);
@ -362,14 +365,6 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE};
select(STDOUT);
$| = 1; # Automatically flush STDOUT
# Used by --result-file for for formatting times
sub isotime($) {
my ($sec,$min,$hr,$day,$mon,$yr)= gmtime($_[0]);
return sprintf "%d-%02d-%02dT%02d:%02d:%02dZ",
$yr+1900, $mon+1, $day, $hr, $min, $sec;
}
main();
@ -382,6 +377,8 @@ sub main {
# directly before it executes them, like "make test-force-pl" in RPM builds.
mtr_report("Logging: $0 ", join(" ", @ARGV));
$DEFAULT_SUITES.=",sequence,sql_discovery" if $source_dist;
command_line_setup();
# --help will not reach here, so now it's safe to assume we have binaries
@ -394,26 +391,6 @@ sub main {
if (!$opt_suites) {
$opt_suites= $DEFAULT_SUITES;
# Check for any extra suites to enable based on the path name
my %extra_suites=
(
"mysql-5.1-new-ndb" => "ndb_team",
"mysql-5.1-new-ndb-merge" => "ndb_team",
"mysql-5.1-telco-6.2" => "ndb_team",
"mysql-5.1-telco-6.2-merge" => "ndb_team",
"mysql-5.1-telco-6.3" => "ndb_team",
"mysql-6.0-ndb" => "ndb_team",
);
foreach my $dir ( reverse splitdir($basedir) ) {
my $extra_suite= $extra_suites{$dir};
if (defined $extra_suite) {
mtr_report("Found extra suite: $extra_suite");
$opt_suites= "$extra_suite,$opt_suites";
last;
}
}
}
mtr_report("Using suites: $opt_suites") unless @opt_cases;
@ -447,6 +424,14 @@ sub main {
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
mark_time_used('collect');
if ($opt_dry_run)
{
for (@$tests) {
print $_->fullname(), "\n";
}
exit 0;
}
if ( $opt_report_features ) {
# Put "report features" as the first test to run
my $tinfo = My::Test->new
@ -763,6 +748,10 @@ sub run_test_server ($$$) {
else {
mtr_report("\nRetrying test $tname, ".
"attempt($retries/$opt_retry)...\n");
#saving the log file as filename.failed in case of retry
my $worker_logdir= $result->{savedir};
my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
rename $log_file_name,$log_file_name.".failed";
delete($result->{result});
$result->{retries}= $retries+1;
$result->write_test($sock, 'TESTCASE');
@ -1139,7 +1128,7 @@ sub command_line_setup {
# Control what test suites or cases to run
'force+' => \$opt_force,
'with-ndbcluster-only' => \&collect_option,
'include-ndbcluster' => \$opt_include_ndbcluster,
'ndb|include-ndbcluster' => \$opt_include_ndbcluster,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
'suite|suites=s' => \$opt_suites,
'skip-rpl' => \&collect_option,
@ -1260,6 +1249,7 @@ sub command_line_setup {
'report-times' => \$opt_report_times,
'result-file' => \$opt_resfile,
'stress=s' => \$opt_stress,
'dry-run' => \$opt_dry_run,
'help|h' => \$opt_usage,
# list-options is internal, not listed in help
@ -1278,11 +1268,6 @@ sub command_line_setup {
report_option('verbose', $opt_verbose);
}
if ( -d "../sql" )
{
$source_dist= 1;
}
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ($glob_mysql_test_dir =~ / /)
@ -1581,7 +1566,6 @@ sub command_line_setup {
# --------------------------------------------------------------------------
if ( $opt_embedded_server )
{
$opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
$opt_skip_ssl= 1; # Turn off use of SSL
# Turn off use of bin log
@ -2037,7 +2021,7 @@ sub executable_setup () {
$exe_mysql_embedded= mtr_exe_maybe_exists("$basedir/libmysqld/examples/mysql_embedded");
if ( ! $opt_skip_ndbcluster )
if ( $ndbcluster_enabled )
{
# Look for single threaded NDB
$exe_ndbd=
@ -2299,7 +2283,7 @@ sub environment_setup {
# --------------------------------------------------------------------------
# Add the path where libndbclient can be found
# --------------------------------------------------------------------------
if ( !$opt_skip_ndbcluster )
if ( $ndbcluster_enabled )
{
push(@ld_library_paths, "$basedir/storage/ndb/src/.libs");
}
@ -2392,7 +2376,7 @@ sub environment_setup {
# ----------------------------------------------------
# Setup env for NDB
# ----------------------------------------------------
if ( ! $opt_skip_ndbcluster )
if ( $ndbcluster_enabled )
{
$ENV{'NDB_MGM'}=
my_find_bin($bindir,
@ -2823,7 +2807,7 @@ sub fix_vs_config_dir () {
$opt_vs_config="";
for (<$bindir/sql/*/mysqld.exe>) {
for (<$bindir/sql/*/mysqld.exe>) { #/
if (-M $_ < $modified)
{
$modified = -M _;
@ -2865,37 +2849,87 @@ sub vs_config_dirs ($$) {
sub check_ndbcluster_support {
my $ndbcluster_supported = 0;
if ($mysqld_variables{'ndb-connectstring'})
{
$ndbcluster_supported = 1;
}
if ($opt_skip_ndbcluster && $opt_include_ndbcluster)
{
# User is ambivalent. Theoretically the arg which was
# given last on command line should win, but that order is
# unknown at this time.
mtr_error("Ambigous command, both --include-ndbcluster " .
" and --skip-ndbcluster was specified");
}
# Check if this is MySQL Cluster, ie. mysql version string ends
# with -ndb-Y.Y.Y[-status]
if ( defined $mysql_version_extra &&
$mysql_version_extra =~ /^-ndb-/ )
$mysql_version_extra =~ /-ndb-([0-9]*)\.([0-9]*)\.([0-9]*)/ )
{
mtr_report(" - MySQL Cluster");
# Enable ndb engine and add more test suites
$opt_include_ndbcluster = 1;
$DEFAULT_SUITES.=",ndb";
# MySQL Cluster tree
mtr_report(" - MySQL Cluster detected");
if ($opt_skip_ndbcluster)
{
mtr_report(" - skipping ndbcluster(--skip-ndbcluster)");
return;
}
if (!$ndbcluster_supported)
{
# MySQL Cluster tree, but mysqld was not compiled with
# ndbcluster -> fail unless --skip-ndbcluster was used
mtr_error("This is MySQL Cluster but mysqld does not " .
"support ndbcluster. Use --skip-ndbcluster to " .
"force mtr to run without it.");
}
# mysqld was compiled with ndbcluster -> auto enable
}
else
{
# Not a MySQL Cluster tree
if (!$ndbcluster_supported)
{
if ($opt_include_ndbcluster)
{
mtr_error("Could not detect ndbcluster support ".
"requested with --include-ndbcluster");
}
# Silently skip, mysqld was compiled without ndbcluster
# which is the default case
return;
}
if ($opt_skip_ndbcluster)
{
# Compiled with ndbcluster but ndbcluster skipped
mtr_report(" - skipping ndbcluster(--skip-ndbcluster)");
return;
}
# Not a MySQL Cluster tree, enable ndbcluster
# if --include-ndbcluster was used
if ($opt_include_ndbcluster)
{
# enable ndbcluster
}
else
{
mtr_report(" - skipping ndbcluster(disabled by default)");
return;
}
}
if ($opt_include_ndbcluster)
{
$opt_skip_ndbcluster= 0;
}
if ($opt_skip_ndbcluster)
{
mtr_report(" - skipping ndbcluster");
return;
}
if ( ! $mysqld_variables{'ndb-connectstring'} )
{
#mtr_report(" - skipping ndbcluster, mysqld not compiled with ndbcluster");
$opt_skip_ndbcluster= 2;
return;
}
mtr_report(" - using ndbcluster when necessary, mysqld supports it");
mtr_report(" - enabling ndbcluster");
$ndbcluster_enabled= 1;
# Add MySQL Cluster test suites
$DEFAULT_SUITES.=",ndb,ndb_binlog,rpl_ndb,ndb_rpl,ndb_memcache";
return;
}
@ -4751,6 +4785,7 @@ sub extract_warning_lines ($$) {
qr|Error: io_setup\(\) failed|,
qr|Warning: io_setup\(\) failed|,
qr|Warning: io_setup\(\) attempt|,
qr|setrlimit could not change the size of core files to 'infinity';|,
);
my $matched_lines= [];
@ -6257,6 +6292,8 @@ Options to control what engine/variation to run
all generated configs
combination=<opt> Use at least twice to run tests with specified
options to mysqld
dry-run Don't run any tests, print the list of tests
that were selected for execution
Options to control directories to use
tmpdir=DIR The directory where temporary files are stored

View File

@ -415,7 +415,7 @@ alter table t1 drop key a;
drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM;
ALTER TABLE T12207 DISCARD TABLESPACE;
ERROR HY000: Table storage engine for 'T12207' doesn't have this option
ERROR HY000: Storage engine MyISAM of the table `test`.`T12207` doesn't have this option
DROP TABLE T12207;
create table t1 (a text) character set koi8r;
insert into t1 values (_koi8r'ÔĹÓÔ');
@ -978,7 +978,7 @@ SHOW CREATE TABLE `tt+2`;
Table Create Table
tt+2 CREATE TEMPORARY TABLE `tt+2` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
DROP TABLE `tt+1`, `tt+2`;
CREATE TABLE `#sql1` (c1 INT);
CREATE TABLE `@0023sql2` (c1 INT);
@ -1015,12 +1015,12 @@ SHOW CREATE TABLE `#sql2`;
Table Create Table
#sql2 CREATE TEMPORARY TABLE `#sql2` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
SHOW CREATE TABLE `@0023sql1`;
Table Create Table
@0023sql1 CREATE TEMPORARY TABLE `@0023sql1` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
DROP TABLE `#sql2`, `@0023sql1`;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
@ -1340,3 +1340,43 @@ rename table t2 to t1;
execute stmt1;
deallocate prepare stmt1;
drop table t2;
CREATE TABLE t1 (
id INT(11) NOT NULL,
x_param INT(11) DEFAULT NULL,
PRIMARY KEY (id)
);
ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
ADD COLUMN IF NOT EXISTS lol INT AFTER id;
Warnings:
Note 1060 Duplicate column name 'id'
ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
Warnings:
Note 1060 Duplicate column name 'lol'
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
Warnings:
Note 1091 Can't DROP 'lol'; check that column/key exists
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
Warnings:
Note 1061 Duplicate key name 'x_param'
ALTER TABLE t1 MODIFY IF EXISTS lol INT;
Warnings:
Note 1054 Unknown column 'lol' in 't1'
DROP INDEX IF EXISTS x_param ON t1;
DROP INDEX IF EXISTS x_param ON t1;
Warnings:
Note 1091 Can't DROP 'x_param'; check that column/key exists
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
Warnings:
Note 1061 Duplicate key name 'x_param1'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`x_param` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `x_param1` (`x_param`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;

View File

@ -2,5 +2,5 @@ drop table if exists t1,t2;
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option
Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
DROP TABLE t2;

View File

@ -4,18 +4,18 @@
CREATE TABLE t1 (
`a` int(11) DEFAULT NULL,
`col432` bit(8) DEFAULT NULL,
`col433` multipoint DEFAULT NULL,
`col434` polygon DEFAULT NULL,
`col433` geometry DEFAULT NULL,
`col434` geometry DEFAULT NULL,
`col435` decimal(50,17) unsigned DEFAULT NULL,
`col436` geometry NOT NULL,
`col437` tinyblob NOT NULL,
`col438` multipolygon DEFAULT NULL,
`col438` geometry DEFAULT NULL,
`col439` mediumblob NOT NULL,
`col440` tinyblob NOT NULL,
`col441` double unsigned DEFAULT NULL
);
CREATE TABLE t2 (
`a` multipoint DEFAULT NULL,
`a` geometry DEFAULT NULL,
`col460` date DEFAULT NULL,
`col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`col462` date NOT NULL,
@ -31,7 +31,7 @@ CREATE TABLE t3 (
`col579` bit(38) NOT NULL,
`col580` varchar(93) NOT NULL,
`col581` datetime DEFAULT NULL,
`col583` multipolygon DEFAULT NULL,
`col583` geometry DEFAULT NULL,
`col584` bit(47) NOT NULL
);
set session sort_buffer_size= 32768;

View File

@ -0,0 +1,10 @@
create table t1 (a date);
insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
set debug_dbug='d,str_to_datetime_warn';
select * from t1 where a > date_add('2000-01-01', interval 5 day);
a
2001-02-03
2002-03-04
Warnings:
Note 1003 2000-01-01
drop table t1;

View File

@ -268,37 +268,37 @@ cast(010203101112.121314 as datetime)
0001-02-03 10:11:12
select cast(120010203101112.121314 as datetime);
cast(120010203101112.121314 as datetime)
NULL
0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '120010203101112.121314'
select cast(cast(1.1 as decimal) as datetime);
cast(cast(1.1 as decimal) as datetime)
NULL
0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '1'
select cast(cast(-1.1 as decimal) as datetime);
cast(cast(-1.1 as decimal) as datetime)
NULL
0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '-1'
select cast('0' as date);
cast('0' as date)
NULL
0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select cast('' as date);
cast('' as date)
NULL
0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: ''
select cast('0' as datetime);
cast('0' as datetime)
NULL
0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select cast('' as datetime);
cast('' as datetime)
NULL
0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: ''
select cast('0' as time);
@ -306,7 +306,7 @@ cast('0' as time)
00:00:00
select cast('' as time);
cast('' as time)
NULL
00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: ''
select cast(NULL as DATE);
@ -323,13 +323,13 @@ cast(NULL as BINARY)
NULL
select cast(cast(120010203101112.121314 as double) as datetime);
cast(cast(120010203101112.121314 as double) as datetime)
NULL
0000-00-00 00:00:00
select cast(cast(1.1 as double) as datetime);
cast(cast(1.1 as double) as datetime)
0000-00-00 00:00:01
select cast(cast(-1.1 as double) as datetime);
cast(cast(-1.1 as double) as datetime)
NULL
0000-00-00 00:00:00
explain extended select cast(10 as double(5,2));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used

View File

@ -31,9 +31,9 @@ Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
create table t1 (b char(0) not null, index(b));
ERROR 42000: The used storage engine can't index column 'b'
ERROR 42000: The storage engine MyISAM can't index column `b`
create table t1 (a int not null,b text) engine=heap;
ERROR 42000: The used table type doesn't support BLOB/TEXT columns
ERROR 42000: Storage engine MEMORY doesn't support BLOB/TEXT columns
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
@ -1899,25 +1899,36 @@ create table t3 (a int) row_format=page;
drop table t1,t2,t3;
# -- End of Bug#45829
# new table creation/renaming blocked if old encoded table present
create table `t-1` (a int) engine=myisam;
insert into `t-1` values (1);
show tables;
Tables_in_test
t-1
flush tables;
convert table files in mysql 5.0 file name encoding
create table `#mysql50#t-1` (a int) engine=myisam;
insert into `#mysql50#t-1` values (1);
show tables;
Tables_in_test
#mysql50#t-1
create table `t-1` (a int);
ERROR 42S01: Table '#mysql50#t-1' already exists
show tables;
Tables_in_test
#mysql50#t-1
t-1
select * from `t-1`;
a
select * from `#mysql50#t-1`;
a
1
drop table `t-1`;
create table t1 (a int);
alter table t1 rename `t-1`;
ERROR 42S01: Table '#mysql50#t-1' already exists
show tables;
Tables_in_test
#mysql50#t-1
t-1
drop table `t-1`;
create table t1 (a int);
rename table t1 to `t-1`;
ERROR 42S01: Table '#mysql50#t-1' already exists
drop table `#mysql50#t-1`, t1;
show tables;
Tables_in_test
#mysql50#t-1
t-1
drop table `#mysql50#t-1`, `t-1`;
End of 5.1 tests

View File

@ -521,7 +521,7 @@ TIME_FORMAT("25:00:00", '%l %p')
1 AM
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
NULL
1151414896
Warnings:
Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s'
select str_to_date('04 /30/2004', '%m /%d/%Y');

View File

@ -734,7 +734,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT ÐÁÒÁÍ1 CHAR(10),
OUT ÐÁÒÁÍ2 CHAR(10))
BEGIN
@ -751,7 +751,7 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -768,7 +768,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8,
OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8)
BEGIN
@ -785,7 +785,7 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -810,7 +810,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT ÐÁÒÁÍ1 CHAR(10),
OUT ÐÁÒÁÍ2 CHAR(10))
BEGIN
@ -827,7 +827,7 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -844,7 +844,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8,
OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8)
BEGIN
@ -861,7 +861,7 @@ COLLATION(_utf8 'текст') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@ -734,7 +734,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
@ -751,7 +751,7 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -768,7 +768,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
@ -785,7 +785,7 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -810,7 +810,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
@ -827,7 +827,7 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@ -844,7 +844,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`(
CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
@ -861,7 +861,7 @@ COLLATION(_koi8r '
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
END */;;
END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;

View File

@ -441,3 +441,16 @@ ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1, t2;
DROP VIEW v1, v2;
set optimizer_switch=@save_derived_optimizer_switch;
create table t1 (n bigint(20) unsigned, d1 datetime, d2 datetime, key (d1));
insert t1 values (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
insert t1 values (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
insert t1 values (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
select * from (
select n, d1, d2, @result := 0 as result
from t1
where d1 < '2012-12-12 12:12:12' and n in (2085, 2084) order by d2 asc
) as calculated_result;
n d1 d2 result
2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
drop table t1;

View File

@ -2164,6 +2164,57 @@ a
set optimizer_switch=@save3912_optimizer_switch;
drop table t1, t2, t3;
#
# MDEV-4209: equi-join on BLOB column from materialized view
# or derived table
#
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='derived_with_keys=on';
CREATE TABLE t1 (c1 text, c2 int);
INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3);
CREATE TABLE t2 (c1 text, c2 int);
INSERT INTO t2 VALUES ('b',2), ('c',3);
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
EXPLAIN EXTENDED
SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where ((`v1`.`c1` = `test`.`t2`.`c1`) and (`v1`.`c2` = `test`.`t2`.`c2`))
SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
c1 c2
c 3
c 3
EXPLAIN EXTENDED
SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
WHERE t.g=t2.c1 AND t.m=t2.c2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
Warnings:
Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where ((`t`.`g` = `test`.`t2`.`c1`) and (`t`.`m` = `test`.`t2`.`c2`))
SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
WHERE t.g=t2.c1 AND t.m=t2.c2;
c1 c2
c 3
EXPLAIN EXTENDED
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
Warnings:
Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where (`v1`.`c1` = `test`.`t2`.`c1`)
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
c1 c2 c1 c2
c 3 c 3
c 3 c 3
DROP VIEW v1;
DROP TABLE t1,t2;
set optimizer_switch=@save_optimizer_switch;
#
# end of 5.3 tests
#
set optimizer_switch=@exit_optimizer_switch;

View File

@ -142,9 +142,9 @@ create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect table name '#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345'
show tables;
Tables_in_mysqltestbug26703
#mysql50#abc`def
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#mysql50#abc`def
use test;
drop database mysqltestbug26703;
End of 5.1 tests

View File

@ -182,13 +182,13 @@ select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)`
Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)`
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)`
Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)`
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int);
column_get(column_create(1, 1212 AS decimal), 1 as unsigned int)
1212
@ -261,13 +261,13 @@ select column_get(column_create(1, 1212 AS int), 1 as int);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)`
Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)`
explain extended
select column_get(column_create(1, 1212 AS int), 1 as signed int);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)`
Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)`
select column_get(column_create(1, -1212 AS int), 1 as int);
column_get(column_create(1, -1212 AS int), 1 as int)
-1212
@ -368,7 +368,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)`
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)`
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8);
column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8)
1212
@ -428,7 +428,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)`
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)`
#
# column get real
#
@ -440,13 +440,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as double);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)`
Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)`
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))`
Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))`
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double);
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double)
1.8446744073709552e19
@ -521,13 +521,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)`
Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)`
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))`
Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))`
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0));
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0))
18446744073709551615
@ -1336,6 +1336,77 @@ select hex(COLUMN_CREATE(0, 0.0 as decimal));
hex(COLUMN_CREATE(0, 0.0 as decimal))
000100000004
#
# MDEV-4292: parse error when selecting on views using dynamic column
#
create table t1 (i int, d blob);
create view v1 as select i, column_get(d, 1 as binary) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset binary) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as int) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as signed) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as unsigned) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as date) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as date) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as time) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as time) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as datetime) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as datetime) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as decimal) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as decimal(10,0)) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as double) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as double) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
create view v1 as select i, column_get(d, 1 as char) as a from t1;
select * from v1;
i a
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset latin1) AS `a` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
#
# end of 5.3 tests
#
#
# test of symbolic names
#
# creation test (names)

View File

@ -699,3 +699,14 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (
id int(11) auto_increment,
title varchar(100) default '',
PRIMARY KEY (id),
KEY ind5 (title)
) ENGINE=MyISAM;
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
Warnings:
Note 1061 Duplicate key name 'ft1'
DROP TABLE t1;

View File

@ -0,0 +1,8 @@
create table t1 (ft text) engine=myisam;
insert into t1 values ('test1'),('test2');
select distinct match(ft) against("test1" in boolean mode) from
(select distinct ft from t1) as t;
match(ft) against("test1" in boolean mode)
1
0
drop table t1;

View File

@ -96,3 +96,9 @@ b + interval a day
2002-02-04
drop table t1;
End of 5.0 tests
create table t1 (a varchar(10));
insert t1 values ('2000-12-03'),('2008-05-03');
select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
a
drop table t1;
End of 5.5 tests

View File

@ -1837,10 +1837,10 @@ INSERT INTO t2 VALUES
EXPLAIN EXTENDED
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<cache>(<in_optimizer>((1,2),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where 0
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
MAX(a)
NULL
@ -1851,7 +1851,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = 1) and (`test`.`t1`.`a` < 10))
Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t1`.`a` < 10))
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10;
MAX(a)
NULL
@ -2090,6 +2090,13 @@ set @@optimizer_switch=@save_optimizer_switch;
# Cleanup for BUG#46680
#
DROP TABLE IF EXISTS t1,t2,t3,empty1;
create table t1 (i int, d date);
insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
avg(export_set( 3, 'y', sha(i))) group_concat(d)
0 2008-10-02
0 2010-12-12
drop table t1;
#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
# file .\item_sum.cc, line 587

View File

@ -217,7 +217,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
member_id_to COUNT(*)
518491 2
DROP TABLE t1;
# End of test BUG#12713907
#
# MDEV-4269: crash when grouping by values()
#
SELECT @@storage_engine INTO @old_engine;
set storage_engine=innodb;
create table y select 1 b;
select 1 from y group by b;
1
1
select 1 from y group by values(b);
1
1
drop table y;
SET storage_engine=@old_engine;
#
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
#

View File

@ -338,6 +338,227 @@ set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm;
drop table t1,tv;
#
# GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
#
# IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
# Note: IS_USED_LOCK returns NULL if the lock is unused
select is_used_lock('test');
is_used_lock('test')
NULL
select is_free_lock('test');
is_free_lock('test')
1
# GET_LOCK returns 1 if it manages to acquire a lock
select get_lock('test', 0);
get_lock('test', 0)
1
# IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired
select is_free_lock('test');
is_free_lock('test')
0
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
1
# -> Switching to connection 'con1'
# IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another
# connection
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
0
select is_free_lock('test');
is_free_lock('test')
0
# GET_LOCK returns 0 if it can't acquire a lock (wait timeout)
select get_lock('test', 0);
get_lock('test', 0)
0
# RELEASE_LOCK returns 0 if the lock belongs to another connection
select release_lock('test');
release_lock('test')
0
# -> Switching to connection 'default'
# RELEASE_LOCK returns 1 if it successfully releases a lock
select release_lock('test');
release_lock('test')
1
# RELEASE_LOCK returns NULL if it doesn't release a lock and there is no such lock
select release_lock('test');
release_lock('test')
NULL
# Test that get_lock() returns NULL if error.
select get_lock('test', 0);
get_lock('test', 0)
1
# -> Switching to connection 'con1'
create table t1 select connection_id() as id;
select get_lock('test', 7200);
# -> Switching to connection 'default'
select (@id := id) - id from t1;
(@id := id) - id
0
kill query @id;
# -> Switching to connection 'con1'
get_lock('test', 7200)
NULL
# -> Switching to connection 'default'
# GET_LOCK() works recursively
select get_lock('test', 0);
get_lock('test', 0)
1
select get_lock('test', 0);
get_lock('test', 0)
1
select get_lock('test', 0);
get_lock('test', 0)
1
# RELEASE_LOCK() needs to be called recursively then, too
select release_lock('test');
release_lock('test')
1
select release_lock('test');
release_lock('test')
1
select release_lock('test');
release_lock('test')
1
# Once the last instance of the lock is released,
# the next call returns NULL
select release_lock('test');
release_lock('test')
1
# Multiple locks in the same session are OK
select get_lock('test1', 0);
get_lock('test1', 0)
1
select get_lock('test2', 0);
get_lock('test2', 0)
1
select get_lock('test3', 0);
get_lock('test3', 0)
1
select release_lock('test1');
release_lock('test1')
1
select release_lock('test2');
release_lock('test2')
1
select release_lock('test3');
release_lock('test3')
1
# Deadlocks are detected e.g. in case of a mutual wait
select get_lock('test1', 0);
get_lock('test1', 0)
1
# -> Switching to connection 'con1'
select get_lock('test2', 0);
get_lock('test2', 0)
1
select get_lock('test1', 7200);
# -> Switching to connection 'default'
select get_lock('test2', 7200);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select release_lock('test1');
release_lock('test1')
1
# -> Switching to connection 'con1'
get_lock('test1', 7200)
1
select release_lock('test2');
release_lock('test2')
1
select release_lock('test1');
release_lock('test1')
1
# -> Switching to connection 'default'
# LOCK/UNLOCK TABLES works fine with a user lock.
lock table t1 write;
select get_lock('test', 0);
get_lock('test', 0)
1
unlock tables;
commit;
select release_lock('test');
release_lock('test')
1
# GLOBAL READ LOCK works with fine with user locks
select get_lock('test1', 0);
get_lock('test1', 0)
1
flush tables with read lock;
select get_lock('test2', 0);
get_lock('test2', 0)
1
unlock tables;
commit;
select release_lock('test1');
release_lock('test1')
1
select release_lock('test2');
release_lock('test2')
1
# BEGIN/COMMIT/ROLLBACK don't unlock user locks.
begin;
select get_lock('test1', 0);
get_lock('test1', 0)
1
select get_lock('test2', 0);
get_lock('test2', 0)
1
select count(*) from t1;
count(*)
1
rollback;
select release_lock('test1');
release_lock('test1')
1
select release_lock('test2');
release_lock('test2')
1
# Deadlocks between user locks and LOCK TABLES locks
# are detected OK.
select get_lock('test', 0);
get_lock('test', 0)
1
# -> Switching to connection 'con1'
lock table t1 write;
select get_lock('test', 7200);
# -> Switching to connection 'default'
lock table t1 read;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select release_lock('test');
release_lock('test')
1
# -> Switching to connection 'con1'
get_lock('test', 7200)
1
select release_lock('test');
release_lock('test')
1
unlock tables;
# cleanup
drop table t1;
# check too long identifier names
select get_lock(repeat('a', 192), 0);
get_lock(repeat('a', 192), 0)
1
select is_used_lock(repeat('a', 192)) = connection_id();
is_used_lock(repeat('a', 192)) = connection_id()
1
select is_free_lock(repeat('a', 192));
is_free_lock(repeat('a', 192))
0
select release_lock(repeat('a', 192));
release_lock(repeat('a', 192))
1
select get_lock(repeat('a', 193), 0);
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
select is_used_lock(repeat('a', 193));
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
select is_free_lock(repeat('a', 193));
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
select release_lock(repeat('a', 193));
ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
#
# End of 5.5 tests
#
#

View File

@ -168,7 +168,7 @@ date("1997-12-31 23:59:59.000001")
1997-12-31
select date("1997-13-31 23:59:59.000001");
date("1997-13-31 23:59:59.000001")
NULL
0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '1997-13-31 23:59:59.000001'
select time("1997-12-31 23:59:59.000001");
@ -176,7 +176,7 @@ time("1997-12-31 23:59:59.000001")
23:59:59.000001
select time("1997-12-31 25:59:59.000001");
time("1997-12-31 25:59:59.000001")
NULL
00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001'
select microsecond("1997-12-31 23:59:59.000001");

View File

@ -2634,6 +2634,31 @@ SELECT * FROM t1;
a
aaaaaaaaaaaaaa
DROP TABLE t1;
SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
SUBSTRING('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
LEFT('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
RIGHT('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
REPEAT('1', DAY(FROM_UNIXTIME(-1)))
NULL
SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
NULL
SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
NULL
create table t1 (i int);
insert into t1 values (null),(8);
select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
group_concat( i ) field
NULL NULL
8
drop table t1;
End of 5.1 tests
Start of 5.4 tests
SELECT format(12345678901234567890.123, 3);
@ -2864,9 +2889,6 @@ sha1('P'),
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
SET @@global.max_allowed_packet:= @tmp_max;
#
# End of 5.5 tests
#
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
@ -2880,3 +2902,15 @@ NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
SET @@global.max_allowed_packet:= @tmp_max;
#
# MDEV-4272: DIV operator crashes in Item_func_int_div::val_int
# (incorrect NULL value handling by convert)
#
create table t1(a int) select null;
select 1 div convert(a using utf8) from t1;
1 div convert(a using utf8)
NULL
drop table t1;
#
# End of 5.5 tests
#

View File

@ -1781,7 +1781,7 @@ Warnings:
Warning 1441 Datetime function: time field overflow
select cast('131415.123e0' as time);
cast('131415.123e0' as time)
NULL
00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '131415.123e0'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
@ -1801,12 +1801,12 @@ unix_timestamp(null)
NULL
select truncate(date('2010-40-10'), 6);
truncate(date('2010-40-10'), 6)
NULL
0.000000
Warnings:
Warning 1292 Incorrect datetime value: '2010-40-10'
select extract(month from '2010-40-50');
extract(month from '2010-40-50')
NULL
0
Warnings:
Warning 1292 Incorrect datetime value: '2010-40-50'
select subtime('0000-00-10 10:10:10', '30 10:00:00');
@ -1924,3 +1924,15 @@ microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
select now(258);
ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
1
SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
1

View File

@ -758,7 +758,7 @@ SPATIAL KEY(g)
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
CREATE TABLE t1 (
line LINESTRING NOT NULL,
line GEOMETRY NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
@ -1553,7 +1553,7 @@ End of 5.0 tests.
# Bug #57323/11764487: myisam corruption with insert ignore
# and invalid spatial data
#
CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL,
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");

View File

@ -406,20 +406,20 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second
first second w c o e d t i r
120 120 1 1 0 1 0 1 1 0
120 121 0 0 1 0 0 0 1 0
120 122 0 1 NULL 0 NULL 0 NULL 0
120 123 0 1 NULL 0 NULL 0 NULL 0
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 1 1 0
121 122 0 1 NULL 0 NULL 0 NULL 0
121 123 0 1 NULL 0 NULL 0 NULL 0
122 120 1 0 NULL 0 NULL 0 NULL 0
122 121 1 0 NULL 0 NULL 0 NULL 0
122 122 1 1 NULL 1 NULL 0 NULL 0
122 123 1 1 NULL 1 NULL 0 NULL 0
123 120 1 0 NULL 0 NULL 0 NULL 0
123 121 1 0 NULL 0 NULL 0 NULL 0
123 122 1 1 NULL 1 NULL 0 NULL 0
123 123 1 1 NULL 1 NULL 0 NULL 0
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
122 121 NULL NULL NULL NULL NULL NULL NULL NULL
122 122 NULL NULL NULL NULL NULL NULL NULL NULL
122 123 NULL NULL NULL NULL NULL NULL NULL NULL
123 120 NULL NULL NULL NULL NULL NULL NULL NULL
123 121 NULL NULL NULL NULL NULL NULL NULL NULL
123 122 NULL NULL NULL NULL NULL NULL NULL NULL
123 123 NULL NULL NULL NULL NULL NULL NULL NULL
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@ -1047,7 +1047,7 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=myisam;
create table t1(a geometry NOT NULL)engine=myisam;
insert into t1 values (geomfromtext("point(0 1)"));
insert into t1 values (geomfromtext("point(1 0)"));
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
@ -1063,6 +1063,84 @@ create table t1(a char(32) not null) engine=myisam;
create spatial index i on t1 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
drop table t1;
CREATE TABLE t0 (a BINARY(32) NOT NULL);
CREATE SPATIAL INDEX i on t0 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
INSERT INTO t0 VALUES (1);
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
SPATIAL INDEX i1 (col0)
) ENGINE=MyISAM;
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t1 (
col0 BINARY NOT NULL,
col2 TIMESTAMP
) ENGINE=MyISAM;
CREATE SPATIAL INDEX idx0 ON t1(col0);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t2 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 POINT
);
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t3 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 LINESTRING,
SPATIAL INDEX i1 (col1, col2)
);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
DROP TABLE t0, t1, t2;
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
#
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
NULL
#
# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
# GEOMETRY FUNCTION ARGUMENTS
#
SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
ERROR 22007: Illegal non geometric '' value found during parsing
#
# MDEV-4252 geometry query crashes server
#
select astext(0x0100000000030000000100000000000010);
astext(0x0100000000030000000100000000000010)
NULL
select astext(st_centroid(0x0100000000030000000100000000000010));
astext(st_centroid(0x0100000000030000000100000000000010))
NULL
select astext(st_exteriorring(0x0100000000030000000100000000000010));
astext(st_exteriorring(0x0100000000030000000100000000000010))
NULL
select envelope(0x0100000000030000000100000000000010);
envelope(0x0100000000030000000100000000000010)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
NULL
#
# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
#
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
NULL
#
# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
#
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))))
NULL
End of 5.1 tests
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
@ -1428,6 +1506,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
DROP DATABASE gis_ogs;
USE test;
#
# BUG #1043845 st_distance() results are incorrect depending on variable order
#
@ -1451,20 +1530,23 @@ geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
0.008148695928146028
USE test;
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
# MDEV-4310 geometry function equals hangs forever.
#
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
create table t1(a geometry not null)engine=myisam;
insert into t1 values(geomfromtext("POINT(0 0)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
select equals(`a`,convert(`a` using utf8)) from `t1`;
equals(`a`,convert(`a` using utf8))
1
NULL
#
# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
# GEOMETRY FUNCTION ARGUMENTS
#
SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
ERROR 22007: Illegal non geometric '' value found during parsing
End of 5.1 tests
NULL
Warnings:
Warning 1300 Invalid utf8 character string: 'E043'
Warning 1300 Invalid utf8 character string: 'E043'
drop table t1;
End of 5.3 tests
#
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
#
@ -1491,4 +1573,11 @@ SELECT 1 FROM g1 WHERE a >= ANY
(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ;
1
DROP TABLE g1;
#
# MDEV-3819 missing constraints for spatial column types
#
create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
drop table t1;
End of 5.5 tests

View File

@ -86,9 +86,9 @@ GRANT SHOW VIEW, SELECT ON v3 to mysqltest_u1@localhost;
use mysqltest_db1;
** Connect as restricted user mysqltest_u1.
** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
** but will return no rows
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5';
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 mysqltest_db1 t5 1 mysqltest_db1 i 1 s1 A NULL NULL NULL YES BTREE
** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination.
SHOW INDEX FROM t5;
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5'

View File

@ -1946,6 +1946,250 @@ Warning 1292 Truncated incorrect INTEGER value: 'K'
Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
DROP TABLE t1;
SET BIG_TABLES=0;
#
# MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause
# Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...'
# WITH GROUP BY ON DUPLICATED FIELDS
#
CREATE TABLE t1(
col1 int,
UNIQUE INDEX idx (col1));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
EXPLAIN SELECT col1 AS field1, col1 AS field2
FROM t1 GROUP BY field1, field2;;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort
FLUSH STATUS;
SELECT col1 AS field1, col1 AS field2
FROM t1 GROUP BY field1, field2;;
field1 field2
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
Sort_scan 1
EXPLAIN SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
FROM t1 GROUP BY field1, field2;;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort
FLUSH STATUS;
SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
FROM t1 GROUP BY field1, field2;;
field1 field2
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
SHOW SESSION STATUS LIKE 'Sort_scan%';
Variable_name Value
Sort_scan 1
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
FROM v1
GROUP BY field1, field2;
field1 field2
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
SELECT SQL_BIG_RESULT tbl1.col1 AS field1, tbl2.col1 AS field2
FROM t1 as tbl1, t1 as tbl2
GROUP BY field1, field2
LIMIT 3;
field1 field2
1 1
1 2
1 3
explain
select col1 f1, col1 f2 from t1 order by f2, f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort
select col1 f1, col1 f2 from t1 order by f2, f1;
f1 f2
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
explain
select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx 5 NULL 7 Using index for group-by; Using temporary; Using filesort
select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
f1 f2
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
explain
select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort
select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
f1 f2
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
CREATE TABLE t2(
col1 int,
col2 int,
UNIQUE INDEX idx (col1, col2));
INSERT INTO t2(col1, col2) VALUES
(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
explain
select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort
select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
f1 f2 f3
1 20 1
2 19 2
3 18 3
4 17 4
5 16 5
6 15 6
7 14 7
8 13 8
9 12 9
10 11 10
11 10 11
12 9 12
13 8 13
14 7 14
15 6 15
16 5 16
17 4 17
18 3 18
19 2 19
20 1 20
explain
select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort
select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
f1 f2 f3
1 20 1
2 19 2
3 18 3
4 17 4
5 16 5
6 15 6
7 14 7
8 13 8
9 12 9
10 11 10
11 10 11
12 9 12
13 8 13
14 7 14
15 6 15
16 5 16
17 4 17
18 3 18
19 2 19
20 1 20
DROP VIEW v1;
DROP TABLE t1, t2;
# End of 5.1 tests
#
# LP bug#694450 Wrong result with non-standard GROUP BY + ORDER BY

View File

@ -1714,7 +1714,7 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
Warnings:
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b'))
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 'a') and (`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`a2` >= 'b'))
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
@ -1731,7 +1731,7 @@ explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
Warnings:
Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b'))
Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`b` = 'a') and (`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`a2` >= 'b'))
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@ -3187,6 +3187,106 @@ a b
drop table t1;
End of 5.1 tests
#
# MDEV-765 lp:825075 - Wrong result with GROUP BY + multipart key + MIN/MAX loose scan
#
CREATE TABLE t1 (a varchar(1), b varchar(1), KEY (b,a));
INSERT INTO t1 VALUES
('0',NULL),('9',NULL),('8','c'),('4','d'),('7','d'),(NULL,'f'),
('7','f'),('8','g'),(NULL,'j');
explain
SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
max(a) b
NULL f
NULL j
explain
SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
b min(a)
d 7
f 7
explain
SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
b min(a)
NULL 0
d 4
explain
SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 4 const 1 Using where; Using index
SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
b min(a)
explain
SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 8 NULL 9 Using where; Using index
SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
b min(a)
d 7
f 7
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'c'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'd'
Warning 1292 Truncated incorrect DOUBLE value: 'f'
Warning 1292 Truncated incorrect DOUBLE value: 'g'
explain
SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
b min(a)
NULL 9
c 8
d 4
f 7
g 8
drop table t1;
#
# MDEV-4140 Wrong result with GROUP BY + multipart key + MIN/MAX loose scan and a subquery
#
CREATE TABLE t1 (a int, b int, KEY (b, a)) ;
INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0);
CREATE TABLE t2 (c int) ;
INSERT INTO t2 VALUES (0),(1);
EXPLAIN
SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL b 10 NULL 10 Using where; Using index for group-by
SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
MIN(a) b
1 0
9 99
EXPLAIN
SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range NULL b 10 NULL 10 Using where; Using index for group-by
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
MIN(a) b
1 0
9 99
EXPLAIN
SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL b 10 NULL 9 Using where; Using index
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY t1a index NULL b 10 NULL 9 Using index; Using join buffer (flat, BNL join)
2 SUBQUERY t1b index NULL b 10 NULL 9 Using index; Using join buffer (incremental, BNL join)
SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
MIN(a) b
1 0
9 99
drop table t1, t2;
End of 5.3 tests
#
# WL#3220 (Loose index scan for COUNT DISTINCT)
#
CREATE TABLE t1 (a INT, b INT, c INT, KEY (a,b));

View File

@ -70,7 +70,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index
drop table t1;
create table t1(pk int primary key) engine=innodb;
create view v1 as select pk from t1 where pk < 20;

View File

@ -473,7 +473,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6))
Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6))
EXPLAIN EXTENDED
SELECT table1.f1, table2.f2
FROM t1 AS table1
@ -485,7 +485,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having (7 = 8)
Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having (7 = 8)
DROP TABLE t1;
#
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355

View File

@ -36,6 +36,7 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
ALL_PLUGINS PLUGIN_NAME
PROCESSLIST ID
PROFILING QUERY_ID
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
@ -88,6 +89,7 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
ALL_PLUGINS PLUGIN_NAME
PROCESSLIST ID
PROFILING QUERY_ID
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA

View File

@ -46,6 +46,7 @@ table_name not like 'ndb_%' AND table_name not like 'innodb_%' AND
table_name not like 'pbxt_%' AND table_name not like 'xtradb_%';
select * from v1;
c
ALL_PLUGINS
CHARACTER_SETS
CLIENT_STATISTICS
COLLATIONS
@ -802,6 +803,7 @@ information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
information_schema PARTITIONS PARTITION_DESCRIPTION
information_schema PLUGINS PLUGIN_DESCRIPTION
information_schema ALL_PLUGINS PLUGIN_DESCRIPTION
information_schema PROCESSLIST INFO
information_schema ROUTINES DTD_IDENTIFIER
information_schema ROUTINES ROUTINE_DEFINITION
@ -1180,7 +1182,7 @@ group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
varchar(27) information_schema.COLUMNS 1
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PROFILING 6
varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.PROFILING 9
create table t1(f1 char(1) not null, f2 char(9) not null)
default character set utf8;
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from

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