This commit is contained in:
Igor Babaev 2012-05-18 09:50:30 -07:00
commit d48b4a83a2
401 changed files with 2094 additions and 5378 deletions

View file

@ -1140,3 +1140,4 @@ libmysqld/gcalc_tools.cc
sql/share/errmsg.sys
sql/share/mysql
install_manifest.txt
sql/db.opt

View file

@ -33,7 +33,7 @@
And many others
*/
#define MTEST_VERSION "3.3"
#define MTEST_VERSION "3.4"
#include "client_priv.h"
#include <mysql_version.h>
@ -78,6 +78,8 @@ static my_bool non_blocking_api_enabled= 0;
#define MAX_DELIMITER_LENGTH 16
#define DEFAULT_MAX_CONN 64
#define DIE_BUFF_SIZE 8192
/* Flags controlling send and reap */
#define QUERY_SEND_FLAG 1
#define QUERY_REAP_FLAG 2
@ -106,6 +108,7 @@ static int opt_port= 0;
static int opt_max_connect_retries;
static int opt_result_format_version;
static int opt_max_connections= DEFAULT_MAX_CONN;
static int error_count= 0;
static my_bool opt_compress= 0, silent= 0, verbose= 0;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static my_bool tty_password= 0;
@ -122,7 +125,7 @@ static my_bool disable_connect_log= 1;
static my_bool disable_warnings= 0, disable_column_names= 0;
static my_bool prepare_warnings_enabled= 0;
static my_bool disable_info= 1;
static my_bool abort_on_error= 1;
static my_bool abort_on_error= 1, opt_continue_on_error= 0;
static my_bool server_initialized= 0;
static my_bool is_windows= 0;
static char **default_argv;
@ -559,14 +562,15 @@ const char *from, int len);
static void cleanup_and_exit(int exit_code) __attribute__((noreturn));
void die(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
void abort_not_supported_test(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2) __attribute__((noreturn));
void verbose_msg(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void log_msg(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void really_die(const char *msg) __attribute__((noreturn));
void report_or_die(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void die(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2)
__attribute__((noreturn));
static void make_error_message(char *buf, size_t len, const char *fmt, va_list args);
void abort_not_supported_test(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2)
__attribute__((noreturn));
void verbose_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
void log_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
VAR* var_from_env(const char *, const char *);
VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
@ -983,7 +987,10 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
else
{
if (!(v= var_get(p, &p, 0, 0)))
die("Bad variable in eval");
{
report_or_die( "Bad variable in eval");
return;
}
dynstr_append_mem(query_eval, v->str_val, v->str_val_len);
}
break;
@ -1270,9 +1277,13 @@ void handle_command_error(struct st_command *command, uint error,
int i;
if (command->abort_on_error)
die("command \"%.*s\" failed with error: %u my_errno: %d errno: %d",
{
report_or_die("command \"%.*s\" failed with error: %u my_errno: %d "
"errno: %d",
command->first_word_len, command->query, error, my_errno,
sys_errno);
return;
}
i= match_expected_error(command, error, NULL);
@ -1285,14 +1296,17 @@ void handle_command_error(struct st_command *command, uint error,
DBUG_VOID_RETURN;
}
if (command->expected_errors.count > 0)
die("command \"%.*s\" failed with wrong error: %u my_errno: %d errno: %d",
command->first_word_len, command->query, error, my_errno, sys_errno);
report_or_die("command \"%.*s\" failed with wrong error: %u "
"my_errno: %d errno: %d",
command->first_word_len, command->query, error, my_errno,
sys_errno);
}
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
command->expected_errors.err[0].code.errnum != 0)
{
/* Error code we wanted was != 0, i.e. not an expected success */
die("command \"%.*s\" succeeded - should have failed with errno %d...",
report_or_die("command \"%.*s\" succeeded - should have failed with "
"errno %d...",
command->first_word_len, command->query,
command->expected_errors.err[0].code.errnum);
}
@ -1437,50 +1451,59 @@ static void cleanup_and_exit(int exit_code)
exit(exit_code);
}
void print_file_stack()
size_t print_file_stack(char *s, const char *end)
{
char *start= s;
struct st_test_file* err_file= cur_file;
if (err_file == file_stack)
return;
return 0;
for (;;)
{
err_file--;
fprintf(stderr, "included from %s at line %d:\n",
err_file->file_name, err_file->lineno);
s+= my_snprintf(s, end - s, "included from %s at line %d:\n",
err_file->file_name, err_file->lineno);
if (err_file == file_stack)
break;
}
return s - start;
}
static void make_error_message(char *buf, size_t len, const char *fmt, va_list args)
{
char *s= buf, *end= buf + len;
s+= my_snprintf(s, end - s, "mysqltest: ");
if (cur_file && cur_file != file_stack)
{
s+= my_snprintf(s, end - s, "In included file \"%s\": \n",
cur_file->file_name);
s+= print_file_stack(s, end);
}
if (start_lineno > 0)
s+= my_snprintf(s, end -s, "At line %u: ", start_lineno);
if (!fmt)
fmt= "unknown error";
s+= my_vsnprintf(s, end - s, fmt, args);
s+= my_snprintf(s, end -s, "\n", start_lineno);
}
void die(const char *fmt, ...)
{
static int dying= 0;
char buff[DIE_BUFF_SIZE];
va_list args;
DBUG_ENTER("die");
DBUG_PRINT("enter", ("start_lineno: %d", start_lineno));
va_start(args, fmt);
make_error_message(buff, sizeof(buff), fmt, args);
really_die(buff);
}
void really_die(const char *msg)
{
static int dying= 0;
fflush(stdout);
/* Print the error message */
fprintf(stderr, "mysqltest: ");
if (cur_file && cur_file != file_stack)
{
fprintf(stderr, "In included file \"%s\": \n",
cur_file->file_name);
print_file_stack();
}
if (start_lineno > 0)
fprintf(stderr, "At line %u: ", start_lineno);
if (fmt)
{
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}
else
fprintf(stderr, "unknown error");
fprintf(stderr, "\n");
fprintf(stderr, "%s", msg);
fflush(stderr);
/*
@ -1504,6 +1527,28 @@ void die(const char *fmt, ...)
cleanup_and_exit(1);
}
void report_or_die(const char *fmt, ...)
{
va_list args;
DBUG_ENTER("report_or_die");
char buff[DIE_BUFF_SIZE];
va_start(args, fmt);
make_error_message(buff, sizeof(buff), fmt, args);
va_end(args);
if (opt_continue_on_error)
{
/* Just log the error and continue */
replace_dynstr_append(&ds_res, buff);
error_count++;
DBUG_VOID_RETURN;
}
really_die(buff);
}
void abort_not_supported_test(const char *fmt, ...)
{
@ -1516,7 +1561,10 @@ void abort_not_supported_test(const char *fmt, ...)
file_stack->file_name);
fprintf(stderr, "Detected in file %s at line %d\n",
cur_file->file_name, cur_file->lineno);
print_file_stack();
char buff[DIE_BUFF_SIZE];
print_file_stack(buff, buff + sizeof(buff));
fprintf(stderr, "%s", buff);
/* Print error message */
va_start(args, fmt);
@ -1648,7 +1696,10 @@ static int run_command(char* cmd,
DBUG_PRINT("enter", ("cmd: %s", cmd));
if (!(res_file= popen(cmd, "r")))
die("popen(\"%s\", \"r\") failed", cmd);
{
report_or_die("popen(\"%s\", \"r\") failed", cmd);
return -1;
}
while (fgets(buf, sizeof(buf), res_file))
{
@ -1748,7 +1799,10 @@ static int diff_check(const char *diff_name)
if (!(res_file= popen(buf, "r")))
die("popen(\"%s\", \"r\") failed", buf);
/* if diff is not present, nothing will be in stdout to increment have_diff */
/*
if diff is not present, nothing will be in stdout to increment
have_diff
*/
if (fgets(buf, sizeof(buf), res_file))
have_diff= 1;
@ -2061,7 +2115,7 @@ int dyn_string_cmp(DYNAMIC_STRING* ds, const char *fname)
void check_result()
{
const char* mess= "Result content mismatch\n";
const char *mess= 0;
DBUG_ENTER("check_result");
DBUG_ASSERT(result_file_name);
@ -2069,9 +2123,13 @@ void check_result()
switch (compare_files(log_file.file_name(), result_file_name)) {
case RESULT_OK:
break; /* ok */
if (!error_count)
break; /* ok */
mess= "Got errors while running test";
/* Fallthrough */
case RESULT_LENGTH_MISMATCH:
mess= "Result length mismatch\n";
if (!mess)
mess= "Result length mismatch\n";
/* Fallthrough */
case RESULT_CONTENT_MISMATCH:
{
@ -2081,6 +2139,10 @@ void check_result()
*/
char reject_file[FN_REFLEN];
size_t reject_length;
if (!mess)
mess= "Result content mismatch\n";
dirname_part(reject_file, result_file_name, &reject_length);
if (access(reject_file, W_OK) == 0)
@ -2180,8 +2242,8 @@ static int strip_surrounding(char* str, char c1, char c2)
static void strip_parentheses(struct st_command *command)
{
if (strip_surrounding(command->first_argument, '(', ')'))
die("%.*s - argument list started with '%c' must be ended with '%c'",
command->first_word_len, command->query, '(', ')');
die("%.*s - argument list started with '%c' must be ended with '%c'",
command->first_word_len, command->query, '(', ')');
}
@ -2518,8 +2580,8 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
if (mysql_real_query(mysql, ds_query.str, ds_query.length))
{
handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
/* If error was acceptable, return empty string */
dynstr_free(&ds_query);
eval_expr(var, "", 0);
@ -2527,7 +2589,12 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
}
if (!(res= mysql_store_result(mysql)))
die("Query '%s' didn't return a result set", ds_query.str);
{
report_or_die("Query '%s' didn't return a result set", ds_query.str);
dynstr_free(&ds_query);
eval_expr(var, "", 0);
return;
}
dynstr_free(&ds_query);
if ((row= mysql_fetch_row(res)) && row[0])
@ -2696,16 +2763,23 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
/* Run the query */
if (mysql_real_query(mysql, ds_query.str, ds_query.length))
{
handle_error (curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
/* If error was acceptable, return empty string */
dynstr_free(&ds_query);
dynstr_free(&ds_col);
eval_expr(var, "", 0);
DBUG_VOID_RETURN;
}
if (!(res= mysql_store_result(mysql)))
die("Query '%s' didn't return a result set", ds_query.str);
{
report_or_die("Query '%s' didn't return a result set", ds_query.str);
dynstr_free(&ds_query);
dynstr_free(&ds_col);
eval_expr(var, "", 0);
return;
}
{
/* Find column number from the given column name */
@ -2725,8 +2799,11 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
if (col_no == -1)
{
mysql_free_result(res);
die("Could not find column '%s' in the result of '%s'",
ds_col.str, ds_query.str);
report_or_die("Could not find column '%s' in the result of '%s'",
ds_col.str, ds_query.str);
dynstr_free(&ds_query);
dynstr_free(&ds_col);
return;
}
DBUG_PRINT("info", ("Found column %d with name '%s'",
i, fields[i].name));
@ -3165,7 +3242,10 @@ void do_exec(struct st_command *command)
while (*cmd && my_isspace(charset_info, *cmd))
cmd++;
if (!*cmd)
die("Missing argument in exec");
{
report_or_die("Missing argument in exec");
return;
}
command->last_argument= command->end;
init_dynamic_string(&ds_cmd, 0, command->query_len+256, 256);
@ -3197,10 +3277,12 @@ void do_exec(struct st_command *command)
DBUG_PRINT("info", ("Executing '%s' as '%s'",
command->first_argument, ds_cmd.str));
if (!(res_file= my_popen(&ds_cmd, "r")) && command->abort_on_error)
if (!(res_file= my_popen(&ds_cmd, "r")))
{
dynstr_free(&ds_cmd);
die("popen(\"%s\", \"r\") failed", command->first_argument);
if (command->abort_on_error)
report_or_die("popen(\"%s\", \"r\") failed", command->first_argument);
return;
}
ds_result= &ds_res;
@ -3237,11 +3319,12 @@ void do_exec(struct st_command *command)
if (command->abort_on_error)
{
log_msg("exec of '%s' failed, error: %d, status: %d, errno: %d",
ds_cmd.str, error, status, errno);
report_or_die("exec of '%s' failed, error: %d, status: %d, errno: %d\n"
"Output from before failure:\n%s\n",
ds_cmd.str, error, status, errno,
ds_res.str);
dynstr_free(&ds_cmd);
die("command \"%s\" failed\n\nOutput from before failure:\n%s\n",
command->first_argument, ds_res.str);
return;
}
DBUG_PRINT("info",
@ -3256,8 +3339,8 @@ void do_exec(struct st_command *command)
{
dynstr_free(&ds_cmd);
if (command->expected_errors.count > 0)
die("command \"%s\" failed with wrong error: %d",
command->first_argument, status);
report_or_die("command \"%s\" failed with wrong error: %d",
command->first_argument, status);
}
}
else if (command->expected_errors.err[0].type == ERR_ERRNO &&
@ -3267,8 +3350,10 @@ void do_exec(struct st_command *command)
log_msg("exec of '%s failed, error: %d, errno: %d",
ds_cmd.str, error, errno);
dynstr_free(&ds_cmd);
die("command \"%s\" succeeded - should have failed with errno %d...",
command->first_argument, command->expected_errors.err[0].code.errnum);
report_or_die("command \"%s\" succeeded - should have failed with "
"errno %d...",
command->first_argument,
command->expected_errors.err[0].code.errnum);
}
dynstr_free(&ds_cmd);
@ -3302,7 +3387,8 @@ int do_modify_var(struct st_command *command,
const char *p= command->first_argument;
VAR* v;
if (!*p)
die("Missing argument to %.*s", command->first_word_len, command->query);
die("Missing argument to %.*s", command->first_word_len,
command->query);
if (*p != '$')
die("The argument to %.*s must be a variable (start with $)",
command->first_word_len, command->query);
@ -3368,7 +3454,10 @@ void do_system(struct st_command *command)
DBUG_ENTER("do_system");
if (strlen(command->first_argument) == 0)
die("Missing arguments to system, nothing to do!");
{
report_or_die("Missing arguments to system, nothing to do!");
return;
}
init_dynamic_string(&ds_cmd, 0, command->query_len + 64, 256);
@ -3389,12 +3478,14 @@ void do_system(struct st_command *command)
if (my_system(&ds_cmd))
{
if (command->abort_on_error)
die("system command '%s' failed", command->first_argument);
/* If ! abort_on_error, log message and continue */
dynstr_append(&ds_res, "system command '");
replace_dynstr_append(&ds_res, command->first_argument);
dynstr_append(&ds_res, "' failed\n");
report_or_die("system command '%s' failed", command->first_argument);
else
{
/* If ! abort_on_error, log message and continue */
dynstr_append(&ds_res, "system command '");
replace_dynstr_append(&ds_res, command->first_argument);
dynstr_append(&ds_res, "' failed\n");
}
}
command->last_argument= command->end;
@ -3941,12 +4032,12 @@ void read_until_delimiter(DYNAMIC_STRING *ds,
No characters except \n are allowed on
the same line as the command
*/
die("Trailing characters found after command");
report_or_die("Trailing characters found after command");
}
if (feof(cur_file->file))
die("End of file encountered before '%s' delimiter was found",
ds_delimiter->str);
report_or_die("End of file encountered before '%s' delimiter was found",
ds_delimiter->str);
if (match_delimiter(c, ds_delimiter->str, ds_delimiter->length))
{
@ -4350,8 +4441,13 @@ void do_perl(struct st_command *command)
/* Format the "perl <filename>" command */
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
if (!(res_file= popen(buf, "r")) && command->abort_on_error)
die("popen(\"%s\", \"r\") failed", buf);
if (!(res_file= popen(buf, "r")))
{
if (command->abort_on_error)
die("popen(\"%s\", \"r\") failed", buf);
dynstr_free(&ds_delimiter);
return;
}
while (fgets(buf, sizeof(buf), res_file))
{
@ -4506,14 +4602,14 @@ void do_sync_with_master2(struct st_command *command, long offset)
information is not initialized, the arguments are
incorrect, or an error has occured
*/
die("%.*s failed: '%s' returned NULL "\
die("%.*s failed: '%s' returned NULL " \
"indicating slave SQL thread failure",
command->first_word_len, command->query, query_buf);
}
if (result == -1)
die("%.*s failed: '%s' returned -1 "\
die("%.*s failed: '%s' returned -1 " \
"indicating timeout after %d seconds",
command->first_word_len, command->query, query_buf, timeout);
else
@ -4808,7 +4904,8 @@ int do_sleep(struct st_command *command, my_bool real_sleep)
while (my_isspace(charset_info, *p))
p++;
if (!*p)
die("Missing argument to %.*s", command->first_word_len, command->query);
die("Missing argument to %.*s", command->first_word_len,
command->query);
sleep_start= p;
/* Check that arg starts with a digit, not handled by my_strtod */
if (!my_isdigit(charset_info, *sleep_start))
@ -4880,16 +4977,21 @@ int query_get_string(MYSQL* mysql, const char* query,
MYSQL_ROW row;
if (mysql_query(mysql, query))
die("'%s' failed: %d %s", query,
mysql_errno(mysql), mysql_error(mysql));
{
report_or_die("'%s' failed: %d %s", query,
mysql_errno(mysql), mysql_error(mysql));
return 1;
}
if ((res= mysql_store_result(mysql)) == NULL)
die("Failed to store result: %d %s",
mysql_errno(mysql), mysql_error(mysql));
{
report_or_die("Failed to store result: %d %s",
mysql_errno(mysql), mysql_error(mysql));
return 1;
}
if ((row= mysql_fetch_row(res)) == NULL)
{
mysql_free_result(res);
ds= 0;
return 1;
}
init_dynamic_string(ds, (row[column] ? row[column] : "NULL"), ~0, 32);
@ -5161,7 +5263,7 @@ void do_get_errcodes(struct st_command *command)
while (*p && p != end)
{
if (!my_isdigit(charset_info, *p))
die("Invalid argument to error: '%s' - "\
die("Invalid argument to error: '%s' - " \
"the errno may only consist of digits[0-9]",
command->first_argument);
p++;
@ -6084,7 +6186,7 @@ void do_block(enum block_cmd cmd, struct st_command* command)
eval_expr(&v2, curr_ptr, &expr_end);
if ((operand!=EQ_OP && operand!=NE_OP) && ! (v.is_int && v2.is_int))
die ("Only == and != are supported for string values");
die("Only == and != are supported for string values");
/* Now we overwrite the first variable with 0 or 1 (for false or true) */
@ -6442,7 +6544,7 @@ int read_line(char *buf, int size)
*p++= c;
}
}
die("The input buffer is too small for this query.x\n" \
die("The input buffer is too small for this query.x\n" \
"check your query or increase MAX_QUERY and recompile");
DBUG_RETURN(0);
}
@ -6675,6 +6777,12 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use the compressed server/client protocol.",
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"continue-on-error", 0,
"Continue test even if we got an error. "
"This is mostly useful when testing a storage engine to see what from a test file it can execute, "
"or to find all syntax errors in a newly created big test file",
&opt_continue_on_error, &opt_continue_on_error, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"cursor-protocol", 0, "Use cursors for prepared statements.",
&cursor_protocol, &cursor_protocol, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -7006,7 +7114,8 @@ int parse_args(int argc, char **argv)
{
/* Check that the result file exists */
if (result_file_name && access(result_file_name, F_OK) != 0)
die("The specified result file '%s' does not exist", result_file_name);
die("The specified result file '%s' does not exist",
result_file_name);
}
return 0;
@ -7333,8 +7442,8 @@ void append_stmt_result(DYNAMIC_STRING *ds, MYSQL_STMT *stmt,
}
if (error != MYSQL_NO_DATA)
die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: error: %d",
error);
die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: "
"error: %d", error);
if (mysql_stmt_fetch(stmt) != MYSQL_NO_DATA)
die("mysql_fetch didn't end with MYSQL_NO_DATA from statement: %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
@ -7666,7 +7775,8 @@ static int match_expected_error(struct st_command *command,
NULL is quite likely, but not in conjunction with a SQL-state expect!
*/
if (unlikely(err_sqlstate == NULL))
die("expecting a SQL-state (%s) from query '%s' which cannot produce one...",
die("expecting a SQL-state (%s) from query '%s' which cannot "
"produce one...",
command->expected_errors.err[i].code.sqlstate, command->query);
if (strncmp(command->expected_errors.err[i].code.sqlstate,
@ -7720,7 +7830,11 @@ void handle_error(struct st_command *command,
}
if (command->abort_on_error)
die("query '%s' failed: %d: %s", command->query, err_errno, err_error);
{
report_or_die("query '%s' failed: %d: %s", command->query, err_errno,
err_error);
DBUG_VOID_RETURN;
}
DBUG_PRINT("info", ("expected_errors.count: %d",
command->expected_errors.count));
@ -7766,13 +7880,15 @@ void handle_error(struct st_command *command,
if (command->expected_errors.count > 0)
{
if (command->expected_errors.err[0].type == ERR_ERRNO)
die("query '%s' failed with wrong errno %d: '%s', instead of %d...",
command->query, err_errno, err_error,
command->expected_errors.err[0].code.errnum);
report_or_die("query '%s' failed with wrong errno %d: '%s', instead of "
"%d...",
command->query, err_errno, err_error,
command->expected_errors.err[0].code.errnum);
else
die("query '%s' failed with wrong sqlstate %s: '%s', instead of %s...",
command->query, err_sqlstate, err_error,
command->expected_errors.err[0].code.sqlstate);
report_or_die("query '%s' failed with wrong sqlstate %s: '%s', "
"instead of %s...",
command->query, err_sqlstate, err_error,
command->expected_errors.err[0].code.sqlstate);
}
revert_properties();
@ -7799,15 +7915,17 @@ void handle_no_error(struct st_command *command)
command->expected_errors.err[0].code.errnum != 0)
{
/* Error code we wanted was != 0, i.e. not an expected success */
die("query '%s' succeeded - should have failed with errno %d...",
command->query, command->expected_errors.err[0].code.errnum);
report_or_die("query '%s' succeeded - should have failed with errno %d...",
command->query, command->expected_errors.err[0].code.errnum);
}
else if (command->expected_errors.err[0].type == ERR_SQLSTATE &&
strcmp(command->expected_errors.err[0].code.sqlstate,"00000") != 0)
{
/* SQLSTATE we wanted was != "00000", i.e. not an expected success */
die("query '%s' succeeded - should have failed with sqlstate %s...",
command->query, command->expected_errors.err[0].code.sqlstate);
report_or_die("query '%s' succeeded - should have failed with "
"sqlstate %s...",
command->query,
command->expected_errors.err[0].code.sqlstate);
}
DBUG_VOID_RETURN;
}
@ -8105,10 +8223,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
DBUG_ENTER("run_query");
if (cn->pending && (flags & QUERY_SEND_FLAG))
die ("Cannot run query on connection between send and reap");
die("Cannot run query on connection between send and reap");
if (!(flags & QUERY_SEND_FLAG) && !cn->pending)
die ("Cannot reap on a connection without pending send");
die("Cannot reap on a connection without pending send");
init_dynamic_string(&ds_warnings, NULL, 0, 256);
ds_warn= &ds_warnings;
@ -8293,13 +8411,14 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (sp_created)
{
if (util_query(mysql, "DROP PROCEDURE mysqltest_tmp_sp "))
die("Failed to drop sp: %d: %s", mysql_errno(mysql), mysql_error(mysql));
report_or_die("Failed to drop sp: %d: %s", mysql_errno(mysql),
mysql_error(mysql));
}
if (view_created)
{
if (util_query(mysql, "DROP VIEW mysqltest_tmp_v "))
die("Failed to drop view: %d: %s",
report_or_die("Failed to drop view: %d: %s",
mysql_errno(mysql), mysql_error(mysql));
}
@ -8463,9 +8582,10 @@ void get_command_type(struct st_command* command)
else
{
/* -- "comment" that didn't contain a mysqltest command */
die("Found line beginning with -- that didn't contain "\
"a valid mysqltest command, check your syntax or "\
report_or_die("Found line beginning with -- that didn't contain " \
"a valid mysqltest command, check your syntax or " \
"use # if you intended to write a comment");
command->type= Q_COMMENT;
}
}
@ -9190,7 +9310,7 @@ int main(int argc, char **argv)
if (parsing_disabled == 0)
parsing_disabled= 1;
else
die("Parsing is already disabled");
report_or_die("Parsing is already disabled");
break;
case Q_ENABLE_PARSING:
/*
@ -9200,7 +9320,7 @@ int main(int argc, char **argv)
if (parsing_disabled == 1)
parsing_disabled= 0;
else
die("Parsing is already enabled");
report_or_die("Parsing is already enabled");
break;
case Q_DIE:
/* Abort test with error code and error message */
@ -9404,7 +9524,8 @@ void do_get_replace_column(struct st_command *command)
if (!(column_number= atoi(to)) || column_number > MAX_COLUMNS)
die("Wrong column number to replace_column in '%s'", command->query);
if (!*from)
die("Wrong number of arguments to replace_column in '%s'", command->query);
die("Wrong number of arguments to replace_column in '%s'",
command->query);
to= get_string(&buff, &from, command);
my_free(replace_column[column_number-1]);
replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE));

View file

@ -19,6 +19,15 @@ INCLUDE(CheckCCompilerFlag)
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
"-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing")
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
HAVE_NO_MISSING_FIELD_INITIALIZERS)
IF (HAVE_NO_MISSING_FIELD_INITIALIZERS)
SET(MY_MAINTAINER_WARNINGS
"${MY_MAINTAINER_WARNINGS} -Wno-missing-field-initializers")
ENDIF()
CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement"
HAVE_DECLARATION_AFTER_STATEMENT)
IF(HAVE_DECLARATION_AFTER_STATEMENT)

View file

@ -126,10 +126,12 @@ ENDIF()
IF(MSVC)
# Tiny version is used to identify the build, it can be set with cmake -DTINY_VERSION=<number>
# to bzr revno for example (in the CI builds)
SET(TINY_VERSION "0" CACHE INTERNAL "")
IF(NOT TINY_VERSION)
SET(TINY_VERSION "0")
ENDIF()
GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
SET(FILETYPE VFT_APP)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
@ -137,7 +139,7 @@ IF(MSVC)
SET(FILETYPE VFT_DLL)
CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
FUNCTION(ADD_VERSION_INFO target target_type sources_var)
IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE")
SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)

View file

@ -23,6 +23,15 @@
# The below was used for really old versions of FreeBSD, roughly: before 5.1.9
# ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH)
# Find libexecinfo (library that contains backtrace_symbols etc)
INCLUDE_DIRECTORIES(/usr/local/include)
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} /usr/local/include )
SET(ENV{LIB} "$ENV{LIB}:/usr/local/lib")
FIND_LIBRARY(EXECINFO NAMES execinfo)
IF(EXECINFO)
SET(LIBEXECINFO ${EXECINFO})
ENDIF()
# Use atomic builtins
IF(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")

View file

@ -589,6 +589,8 @@
#cmakedefine WITH_MYISAM_STORAGE_ENGINE 1
#cmakedefine WITH_MYISAMMRG_STORAGE_ENGINE 1
#cmakedefine WITH_HEAP_STORAGE_ENGINE 1
#cmakedefine WITH_INNOBASE_STORAGE_ENGINE 1
#cmakedefine WITH_XTRADB_STORAGE_ENGINE 1
#cmakedefine WITH_CSV_STORAGE_ENGINE 1
#cmakedefine WITH_PARTITION_STORAGE_ENGINE 1
#cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1

View file

@ -147,7 +147,7 @@ IF(UNIX)
FIND_PACKAGE(Threads)
SET(CMAKE_REQUIRED_LIBRARIES
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBEXECINFO})
IF(CMAKE_REQUIRED_LIBRARIES)
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)

View file

@ -38,10 +38,10 @@ int func1()
int main (int argc, char *argv[])
{
int i;
#ifdef DBUG_OFF
return 1;
#endif
#else
int i;
if (argc == 1)
return 0;
@ -83,4 +83,5 @@ int main (int argc, char *argv[])
DBUG_SET(""); /* to not have my_end() in the traces */
my_end(0);
return 0;
#endif /* DBUG_OFF */
}

View file

@ -1,6 +1,5 @@
usr/bin/mysql_config
usr/include/mysql/*.h
usr/include/mysql/psi/*.h
usr/include/mysql
usr/lib/libmysqlclient.a
usr/lib/libmysqlclient_r.a
usr/lib/libmysqlservices.a

View file

@ -1,2 +1,2 @@
usr/lib/libmysqlclient.so.16 usr/lib/libmysqlclient.so
usr/lib/libmysqlclient_r.so.16 usr/lib/libmysqlclient_r.so
usr/lib/libmysqlclient.so.18 usr/lib/libmysqlclient.so
usr/lib/libmysqlclient_r.so.18 usr/lib/libmysqlclient_r.so

View file

@ -67,7 +67,7 @@ static struct my_option my_long_options[] =
{"defaults-extra-file", 'e',
"Read this file after the global config file and before the config "
"file in the users home directory; should be the first option",
&my_defaults_extra_file, &my_defaults_extra_file, 0,
(void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix",
@ -75,8 +75,8 @@ static struct my_option my_long_options[] =
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.",
&my_defaults_extra_file,
&my_defaults_extra_file, 0, GET_STR,
(void *)&my_defaults_extra_file,
(void *)&my_defaults_extra_file, 0, GET_STR,
REQUIRED_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},

View file

@ -14,11 +14,11 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SET(HEADERS_GEN_CONFIGURE
${CMAKE_CURRENT_BINARY_DIR}/mysql_version.h
${CMAKE_CURRENT_BINARY_DIR}/my_config.h
${CMAKE_CURRENT_BINARY_DIR}/mysqld_ername.h
${CMAKE_CURRENT_BINARY_DIR}/mysqld_error.h
${CMAKE_CURRENT_BINARY_DIR}/sql_state.h
mysql_version.h
my_config.h
mysqld_ername.h
mysqld_error.h
sql_state.h
)
SET(HEADERS
@ -49,8 +49,19 @@ SET(HEADERS
m_ctype.h
my_attribute.h
my_compiler.h
${HEADERS_GEN_CONFIGURE}
)
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development)
FOREACH(f ${HEADERS_GEN_CONFIGURE})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
ENDFOREACH(f)
INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} COMPONENT Development FILES_MATCHING PATTERN "*.h")
STRING(REPLACE "." "\\." EXCL_RE "${HEADERS};${HEADERS_GEN_CONFIGURE}")
STRING(REPLACE ";" "|" EXCL_RE "${EXCL_RE}")
INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development
FILES_MATCHING PATTERN "*.h"
PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE)

View file

@ -24,7 +24,6 @@ extern "C" {
#include <my_base.h>
#include <my_sys.h>
#include <m_ctype.h>
#include "../storage/maria/ma_pagecache.h"
#include "my_compare.h"
#include "ft_global.h"
#include <myisamchk.h>
@ -268,7 +267,6 @@ extern my_bool maria_flush, maria_single_user, maria_page_checksums;
extern my_bool maria_delay_key_write;
extern my_off_t maria_max_temp_length;
extern ulong maria_bulk_insert_tree_size, maria_data_pointer_size;
extern PAGECACHE maria_pagecache_var, *maria_pagecache;
extern MY_TMPDIR *maria_tmpdir;
/*
This is used to check if a symlink points into the mysql data home,
@ -353,69 +351,6 @@ typedef struct st_maria_bit_buff
uint error;
} MARIA_BIT_BUFF;
typedef struct st_maria_sort_info
{
/* sync things */
mysql_mutex_t mutex;
mysql_cond_t cond;
MARIA_HA *info, *new_info;
HA_CHECK *param;
char *buff;
SORT_KEY_BLOCKS *key_block, *key_block_end;
SORT_FT_BUF *ft_buf;
my_off_t filelength, dupp, buff_length;
pgcache_page_no_t page;
ha_rows max_records;
uint current_key, total_keys;
uint got_error, threads_running;
myf myf_rw;
enum data_file_type new_data_file_type, org_data_file_type;
} MARIA_SORT_INFO;
typedef struct st_maria_sort_param
{
pthread_t thr;
IO_CACHE read_cache, tempfile, tempfile_for_exceptions;
DYNAMIC_ARRAY buffpek;
MARIA_BIT_BUFF bit_buff; /* For parallel repair of packrec. */
MARIA_KEYDEF *keyinfo;
MARIA_SORT_INFO *sort_info;
HA_KEYSEG *seg;
uchar **sort_keys;
uchar *rec_buff;
void *wordlist, *wordptr;
MEM_ROOT wordroot;
uchar *record;
MY_TMPDIR *tmpdir;
/*
The next two are used to collect statistics, see maria_update_key_parts for
description.
*/
ulonglong unique[HA_MAX_KEY_SEG+1];
ulonglong notnull[HA_MAX_KEY_SEG+1];
MARIA_RECORD_POS pos,max_pos,filepos,start_recpos, current_filepos;
uint key, key_length,real_key_length,sortbuff_size;
uint maxbuffers, keys, find_length, sort_keys_length;
my_bool fix_datafile, master;
my_bool calc_checksum; /* calculate table checksum */
size_t rec_buff_size;
int (*key_cmp)(struct st_maria_sort_param *, const void *, const void *);
int (*key_read)(struct st_maria_sort_param *, uchar *);
int (*key_write)(struct st_maria_sort_param *, const uchar *);
void (*lock_in_memory)(HA_CHECK *);
int (*write_keys)(struct st_maria_sort_param *, register uchar **,
uint , struct st_buffpek *, IO_CACHE *);
uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint);
int (*write_key)(struct st_maria_sort_param *, IO_CACHE *,uchar *,
uint, uint);
} MARIA_SORT_PARAM;
/* functions in maria_check */
void maria_chk_init(HA_CHECK *param);
void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info);
@ -443,7 +378,6 @@ int maria_filecopy(HA_CHECK *param, File to, File from, my_off_t start,
my_off_t length, const char *type);
int maria_movepoint(MARIA_HA *info, uchar *record, my_off_t oldpos,
my_off_t newpos, uint prot_key);
int maria_write_data_suffix(MARIA_SORT_INFO *sort_info, my_bool fix_datafile);
int maria_test_if_almost_full(MARIA_HA *info);
int maria_recreate_table(HA_CHECK *param, MARIA_HA **org_info, char *filename);
int maria_disable_indexes(MARIA_HA *info);
@ -456,10 +390,6 @@ my_bool maria_test_if_sort_rep(MARIA_HA *info, ha_rows rows, ulonglong key_map,
int maria_init_bulk_insert(MARIA_HA *info, ulong cache_size, ha_rows rows);
void maria_flush_bulk_insert(MARIA_HA *info, uint inx);
void maria_end_bulk_insert(MARIA_HA *info);
int maria_assign_to_pagecache(MARIA_HA *info, ulonglong key_map,
PAGECACHE *key_cache);
void maria_change_pagecache(PAGECACHE *old_key_cache,
PAGECACHE *new_key_cache);
int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves);
void maria_versioning(MARIA_HA *info, my_bool versioning);
void maria_ignore_trids(MARIA_HA *info);

View file

@ -28,6 +28,10 @@ INSTALL(
PATTERN ".cvsignore" EXCLUDE
PATTERN "*.am" EXCLUDE
PATTERN "*.in" EXCLUDE
PATTERN "*.vcxproj" EXCLUDE
PATTERN "*.vcxproj.filters" EXCLUDE
PATTERN "*.vcxproj.user" EXCLUDE
PATTERN "CTest" EXCLUDE
)
ENDIF()

View file

@ -60,6 +60,8 @@ loose-performance-schema-max-table-handles=1000
binlog-direct-non-transactional-updates
default-storage-engine=myisam
# here, at the end of [mysqld] group mtr will automatically disable
# all optional plugins.

View file

@ -1,16 +0,0 @@
# Created by Horst Hunger 2008-04-15
# see also have_64bit_ulong.inc
--disable_query_log
--disable_warnings
let $save = `SELECT @@pseudo_thread_id`;
SET @@pseudo_thread_id = 4294967296;
let $mach32 = `SELECT @@pseudo_thread_id <= 4294967295`;
eval SET @@pseudo_thread_id = $save;
--enable_warnings
--enable_query_log
if (!$mach32)
{
skip Need a 32 bit unsigned long;
}

View file

@ -1,14 +0,0 @@
# Created by Horst Hunger 2008-04-15
# see also have_32bit_ulong.inc
--disable_query_log
let $save = `SELECT @@pseudo_thread_id`;
SET @@pseudo_thread_id = 4294967296;
let $mach64 = `SELECT @@pseudo_thread_id > 4294967295`;
eval SET @@pseudo_thread_id = $save;
--enable_query_log
if (!$mach64)
{
skip Need a 64 unsigned long ;
}

View file

@ -25,6 +25,8 @@ use strict;
use base qw(Exporter);
our @EXPORT= qw(collect_option collect_test_cases);
use Carp;
use mtr_report;
use mtr_match;
@ -103,12 +105,12 @@ sub collect_test_cases ($$$$) {
# If not reordering, we also shouldn't group by suites, unless
# no test cases were named.
# This also effects some logic in the loop following this.
# This also affects some logic in the loop following this.
if ($opt_reorder or !@$opt_cases)
{
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
push(@$cases, collect_suite_name($suite, $opt_cases));
}
}
@ -136,7 +138,7 @@ sub collect_test_cases ($$$$) {
$sname= "main" if !$opt_reorder and !$sname;
mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname;
# If suite was part of name, find it there, may come with combinations
my @this_case = collect_one_suite($sname, [ $test_name_spec ]);
my @this_case = collect_suite_name($sname, [ $test_name_spec ]);
if (@this_case)
{
push (@$cases, @this_case);
@ -310,55 +312,74 @@ sub parse_disabled {
}
}
sub collect_one_suite
#
# processes one user-specified suite name.
# it could contain wildcards, e.g engines/*
#
sub collect_suite_name
{
my $suitename= shift; # Test suite name
my $opt_cases= shift;
my $over;
my %suites;
($suitename, $over) = split '-', $suitename;
mtr_verbose("Collecting: $suitename");
my $suitedir= $::glob_mysql_test_dir; # Default
my @overlays = ();
if ( $suitename ne "main" )
{
# Allow suite to be path to "some dir" if $suitename has at least
# one directory part
if ( -d $suitename and splitdir($suitename) > 1 ){
$suitedir= $suitename;
mtr_report(" - from '$suitedir'");
if ( -d $suitename and splitdir($suitename) > 1 ) {
$suites{$suitename} = [ $suitename ];
mtr_report(" - from '$suitename'");
}
else
{
@overlays = my_find_dir(dirname($::glob_mysql_test_dir),
["mysql-test/suite",
"storage/*/mysql-test",
"plugin/*/mysql-test"],
[$suitename]);
my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
["mysql-test/suite",
"storage/*/mysql-test",
"plugin/*/mysql-test"],
[$suitename]);
#
# XXX at the moment, for simplicity, we will not fully support one plugin
# overlaying a suite of another plugin. Only suites in the main
# mysql-test directory can be safely overlayed. To be fixed, when needed.
# To fix it we'll need a smarter overlay detection (that is, detection of
# what is an overlay and what is the "original" suite) than simply
# "prefer directories with more files".
# if $suitename contained wildcards, we'll have many suites and
# their overlays here. Let's group them appropriately.
#
if ($overlays[0] !~ m@/mysql-test/suite/$suitename$@) {
# prefer directories with more files
@overlays = sort { scalar(<$a/*>) <=> scalar(<$b/*>) } @overlays;
for (@dirs) {
m@^.*/mysql-test/(?:suite/)?(.*)$@ or confess $_;
push @{$suites{$1}}, $_;
}
$suitedir = shift @overlays;
}
} else {
@overlays = my_find_dir(dirname($::glob_mysql_test_dir),
["storage/*/mysql-test",
"plugin/*/mysql-test"],
['main'], NOT_REQUIRED);
$suites{$suitename} = [ $::glob_mysql_test_dir,
my_find_dir(dirname($::glob_mysql_test_dir),
["storage/*/mysql-test",
"plugin/*/mysql-test"],
['main'], NOT_REQUIRED) ];
}
my @cases;
while (my ($name, $dirs) = each %suites) {
#
# XXX at the moment, for simplicity, we will not fully support one
# plugin overlaying a suite of another plugin. Only suites in the main
# mysql-test directory can be safely overlayed. To be fixed, when
# needed. To fix it we'll need a smarter overlay detection (that is,
# detection of what is an overlay and what is the "original" suite)
# than simply "prefer directories with more files".
#
if ($dirs->[0] !~ m@/mysql-test/suite/$name$@) {
# prefer directories with more files
@$dirs = sort { scalar(<$a/*>) <=> scalar(<$b/*>) } @$dirs;
}
push @cases, collect_one_suite($opt_cases, $name, $over, @$dirs);
}
return @cases;
}
sub collect_one_suite {
my ($opt_cases, $suitename, $over, $suitedir, @overlays) = @_;
mtr_verbose("Collecting: $suitename");
mtr_verbose("suitedir: $suitedir");
mtr_verbose("overlays: @overlays") if @overlays;
@ -380,7 +401,7 @@ sub collect_one_suite
local %file_combinations = ();
local %file_in_overlay = ();
die unless m@/(?:storage|plugin)/(\w+)/mysql-test/\w+$@;
confess $_ unless m@/(?:storage|plugin)/(\w+)/mysql-test/[\w/]*\w$@;
next unless defined $over and ($over eq '' or $over eq $1);
push @cases,
# don't add cases that take *all* data from the parent suite
@ -396,7 +417,7 @@ sub process_suite {
if ($overname) {
$parent = $suites{$basename};
die unless $parent;
confess unless $parent;
$suitename = $basename . '-' . $overname;
} else {
$suitename = $basename;
@ -544,7 +565,7 @@ sub make_combinations($@)
if ($combinations[0]->{skip}) {
$test->{skip} = 1;
$test->{comment} = $combinations[0]->{skip} unless $test->{comment};
die unless @combinations == 1;
confess unless @combinations == 1;
return ($test);
}

View file

@ -78,7 +78,8 @@ BEGIN {
use lib "lib";
use Cwd;
use Cwd ;
use Cwd 'realpath';
use Getopt::Long;
use My::File::Path; # Patched version of File::Path
use File::Basename;
@ -163,11 +164,14 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
my $DEFAULT_SUITES= join(',', map { "$_-" } qw(
main
archive
binlog
csv
federated
funcs_1
funcs_2
handler
heap
innodb
maria
optimizer_unfixed_bugs
@ -226,7 +230,7 @@ my %opts_extern;
sub using_extern { return (keys %opts_extern > 0);};
our $opt_fast= 0;
our $opt_force;
our $opt_force= 0;
our $opt_mem= $ENV{'MTR_MEM'};
our $opt_clean_vardir= $ENV{'MTR_CLEAN_VARDIR'};
@ -1037,8 +1041,14 @@ sub ignore_option {
# Setup any paths that are $opt_vardir related
sub set_vardir {
my ($vardir)= @_;
$opt_vardir= $vardir;
if(IS_WINDOWS)
{
$opt_vardir= $vardir;
}
else
{
$opt_vardir= realpath($vardir);
}
$path_vardir_trace= $opt_vardir;
# Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
@ -1126,7 +1136,7 @@ sub command_line_setup {
'defaults-extra-file=s' => \&collect_option,
# Control what test suites or cases to run
'force' => \$opt_force,
'force+' => \$opt_force,
'with-ndbcluster-only' => \&collect_option,
'include-ndbcluster' => \$opt_include_ndbcluster,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
@ -5846,6 +5856,11 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "%s", $_) for @args_saved;
}
if ($opt_force > 1)
{
mtr_add_arg($args, "--continue-on-error");
}
my $suite = $tinfo->{suite};
if ($suite->{parent}) {
mtr_add_arg($args, "--overlay-dir=%s/", $suite->{dir});
@ -6275,7 +6290,11 @@ Options to control directories to use
Options to control what test suites or cases to run
force Continue to run the suite after failure
force Continue after a failure. When specified once, a
failure in a test file will abort this test file, and
the execution will continue from the next test file.
When specified twice, execution will continue executing
the failed test file from the next command.
with-ndbcluster-only Run only tests that include "ndb" in the filename
skip-ndb[cluster] Skip all tests that need cluster. Default.
include-ndb[cluster] Enable all tests that need cluster

View file

@ -0,0 +1,10 @@
FLUSH STATUS;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
0
KILL CONNECTION_ID();
ERROR 70100: Connection was killed
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
1
FLUSH STATUS;

View file

@ -0,0 +1 @@
"all ok"

View file

@ -2044,6 +2044,59 @@ a
drop table t1,t2;
set optimizer_switch=@save968720_optimizer_switch;
#
# LP BUG#978847 Server crashes in Item_ref::real_item on
# INSERT .. SELECT with FROM subquery and derived_merge=ON
SET @save978847_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_merge=on';
CREATE TABLE t1 ( a INT, b INT );
INSERT INTO t1 VALUES (2,1),(3,2);
select * from t1;
a b
2 1
3 2
INSERT INTO t1 SELECT * FROM
( SELECT * FROM t1 ) AS alias;
select * from t1;
a b
2 1
3 2
2 1
3 2
prepare stmt1 from 'INSERT INTO t1 SELECT SQL_BIG_RESULT * FROM
( SELECT * FROM t1 ) AS alias';
execute stmt1;
select * from t1;
a b
2 1
3 2
2 1
3 2
2 1
3 2
2 1
3 2
execute stmt1;
select * from t1;
a b
2 1
3 2
2 1
3 2
2 1
3 2
2 1
3 2
2 1
3 2
2 1
3 2
2 1
3 2
2 1
3 2
drop table t1;
set optimizer_switch=@save978847_optimizer_switch;
#
# end of 5.3 tests
#
set optimizer_switch=@exit_optimizer_switch;

View file

@ -0,0 +1,5 @@
FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT;
UNLOCK TABLES;
CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES ( REPEAT('i',1048576) );
DROP TABLE t1;

View file

@ -434,3 +434,21 @@ ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGON
SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,
1
select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3));
ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3))
POLYGON((3.999999999999999 6.999999999999998,4 7,3.999999999999999 6.999999999999998))
SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
-2.910427500435995 0.727606875108998,
-0.910427500435995 8.727606875108998,
7.664100588675687 1.503849116986468,
1.664100588675687 -2.496150883013531,
0.0 -3.0
))' ), 3 )));
ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
-2.910427500435995 0.727606875108998,
-0.910427500435995 8.727606875108998,
7.664100588675687 1.503849116986468,
1.664100588675687 -2.496150883013531,
0.0 -3.0
))' ),
136

View file

@ -1976,6 +1976,53 @@ Warning 1292 Truncated incorrect DOUBLE value: 'g'
Warning 1292 Truncated incorrect DOUBLE value: 'v'
SET SESSION SQL_MODE=default;
drop table t1;
#
# LP bug#967242 Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE
#
CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('x');
CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM;
INSERT INTO t2 VALUES
(4, 'd'),(8, 'g'),(3, 'x'),(3, 'f'),
(0, 'p'),(3, 'j'),(8, 'c');
SELECT t2_1.b as zzz
FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
WHERE
rand() + 1 > 0 OR
a = t2_1.c
GROUP BY zzz;
zzz
0
3
4
8
SELECT t2_1.b as zzz
FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
WHERE
1 > 0 OR
a = t2_1.c
GROUP BY zzz;
zzz
0
3
4
8
SELECT t2_1.b as zzz
FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
WHERE
t2_1.b + 1 > 0 OR
a = t2_1.c
GROUP BY zzz;
zzz
0
3
4
8
#TODO: in merge with 5.3 add original test suite
drop table t1, t2;
# End of 5.2 tests
#
# lp:872702: Crash in add_ref_to_table_cond() when grouping by a PK

View file

@ -0,0 +1,5 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( a DATE );
SELECT * FROM t1 WHERE ( SELECT a FROM t1 ) IN ('2012-04-25','2012-04-26');
a
DROP TABLE t1;

View file

@ -13,9 +13,26 @@ FILES
GLOBAL_STATUS
GLOBAL_VARIABLES
INDEX_STATISTICS
INNODB_BUFFER_POOL_PAGES
INNODB_BUFFER_POOL_PAGES_BLOB
INNODB_BUFFER_POOL_PAGES_INDEX
INNODB_CMP
INNODB_CMPMEM
INNODB_CMPMEM_RESET
INNODB_CMP_RESET
INNODB_INDEX_STATS
INNODB_LOCKS
INNODB_LOCK_WAITS
INNODB_RSEG
INNODB_SYS_COLUMNS
INNODB_SYS_FIELDS
INNODB_SYS_FOREIGN
INNODB_SYS_FOREIGN_COLS
INNODB_SYS_INDEXES
INNODB_SYS_STATS
INNODB_SYS_TABLES
INNODB_SYS_TABLESTATS
INNODB_TABLE_STATS
INNODB_TRX
KEY_CACHES
KEY_COLUMN_USAGE
@ -68,9 +85,26 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
INNODB_BUFFER_POOL_PAGES page_type
INNODB_BUFFER_POOL_PAGES_BLOB space_id
INNODB_BUFFER_POOL_PAGES_INDEX index_id
INNODB_CMP page_size
INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
INNODB_CMP_RESET page_size
INNODB_INDEX_STATS table_schema
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
INNODB_RSEG rseg_id
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
INNODB_SYS_FOREIGN ID
INNODB_SYS_FOREIGN_COLS ID
INNODB_SYS_INDEXES INDEX_ID
INNODB_SYS_STATS INDEX_ID
INNODB_SYS_TABLES SCHEMA
INNODB_SYS_TABLESTATS SCHEMA
INNODB_TABLE_STATS table_schema
INNODB_TRX trx_id
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
@ -123,9 +157,26 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
INDEX_STATISTICS TABLE_SCHEMA
INNODB_BUFFER_POOL_PAGES page_type
INNODB_BUFFER_POOL_PAGES_BLOB space_id
INNODB_BUFFER_POOL_PAGES_INDEX index_id
INNODB_CMP page_size
INNODB_CMPMEM page_size
INNODB_CMPMEM_RESET page_size
INNODB_CMP_RESET page_size
INNODB_INDEX_STATS table_schema
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
INNODB_RSEG rseg_id
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
INNODB_SYS_FOREIGN ID
INNODB_SYS_FOREIGN_COLS ID
INNODB_SYS_INDEXES INDEX_ID
INNODB_SYS_STATS INDEX_ID
INNODB_SYS_TABLES SCHEMA
INNODB_SYS_TABLESTATS SCHEMA
INNODB_TABLE_STATS table_schema
INNODB_TRX trx_id
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
@ -184,9 +235,26 @@ FILES information_schema.FILES 1
GLOBAL_STATUS information_schema.GLOBAL_STATUS 1
GLOBAL_VARIABLES information_schema.GLOBAL_VARIABLES 1
INDEX_STATISTICS information_schema.INDEX_STATISTICS 1
INNODB_BUFFER_POOL_PAGES information_schema.INNODB_BUFFER_POOL_PAGES 1
INNODB_BUFFER_POOL_PAGES_BLOB information_schema.INNODB_BUFFER_POOL_PAGES_BLOB 1
INNODB_BUFFER_POOL_PAGES_INDEX information_schema.INNODB_BUFFER_POOL_PAGES_INDEX 1
INNODB_CMP information_schema.INNODB_CMP 1
INNODB_CMPMEM information_schema.INNODB_CMPMEM 1
INNODB_CMPMEM_RESET information_schema.INNODB_CMPMEM_RESET 1
INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
INNODB_INDEX_STATS information_schema.INNODB_INDEX_STATS 1
INNODB_LOCKS information_schema.INNODB_LOCKS 1
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
INNODB_RSEG information_schema.INNODB_RSEG 1
INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1
INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1
INNODB_SYS_FOREIGN information_schema.INNODB_SYS_FOREIGN 1
INNODB_SYS_FOREIGN_COLS information_schema.INNODB_SYS_FOREIGN_COLS 1
INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
INNODB_SYS_STATS information_schema.INNODB_SYS_STATS 1
INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
INNODB_SYS_TABLESTATS information_schema.INNODB_SYS_TABLESTATS 1
INNODB_TABLE_STATS information_schema.INNODB_TABLE_STATS 1
INNODB_TRX information_schema.INNODB_TRX 1
KEY_CACHES information_schema.KEY_CACHES 1
KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
@ -228,9 +296,26 @@ Database: information_schema
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| INDEX_STATISTICS |
| INNODB_BUFFER_POOL_PAGES |
| INNODB_BUFFER_POOL_PAGES_BLOB |
| INNODB_BUFFER_POOL_PAGES_INDEX |
| INNODB_CMP |
| INNODB_CMPMEM |
| INNODB_CMPMEM_RESET |
| INNODB_CMP_RESET |
| INNODB_INDEX_STATS |
| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
| INNODB_RSEG |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_SYS_INDEXES |
| INNODB_SYS_STATS |
| INNODB_SYS_TABLES |
| INNODB_SYS_TABLESTATS |
| INNODB_TABLE_STATS |
| INNODB_TRX |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
@ -273,9 +358,26 @@ Database: INFORMATION_SCHEMA
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| INDEX_STATISTICS |
| INNODB_BUFFER_POOL_PAGES |
| INNODB_BUFFER_POOL_PAGES_BLOB |
| INNODB_BUFFER_POOL_PAGES_INDEX |
| INNODB_CMP |
| INNODB_CMPMEM |
| INNODB_CMPMEM_RESET |
| INNODB_CMP_RESET |
| INNODB_INDEX_STATS |
| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
| INNODB_RSEG |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_SYS_INDEXES |
| INNODB_SYS_STATS |
| INNODB_SYS_TABLES |
| INNODB_SYS_TABLESTATS |
| INNODB_TABLE_STATS |
| INNODB_TRX |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
@ -309,5 +411,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 40
information_schema 57
mysql 26

View file

@ -31,18 +31,18 @@
4 4
show status like "Handler_icp%";
Variable_name Value
-Handler_icp_attempts 2
-Handler_icp_attempts 2
-Handler_icp_match 1
+Handler_icp_attempts 0
+Handler_icp_attempts 0
+Handler_icp_match 0
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
-Handler_icp_attempts 2
-Handler_icp_attempts 2
-Handler_icp_match 1
+Handler_icp_attempts 0
+Handler_icp_attempts 0
+Handler_icp_match 0
DROP TABLE t1;
#

View file

@ -818,21 +818,21 @@ INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 0
Handler_icp_attempts 0
Handler_icp_match 0
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 2
Handler_icp_attempts 2
Handler_icp_match 1
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 2
Handler_icp_attempts 2
Handler_icp_match 1
DROP TABLE t1;
#

View file

@ -3221,7 +3221,7 @@ explain
select t1.a, count(t2.p) as count
from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index; Using temporary; Using filesort
1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
select t1.a, count(t2.p) as count
from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
@ -3522,7 +3522,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 20
Handler_icp_attempts 20
Handler_icp_match 4
set join_cache_level=6;
select t2.f1, t2.f2, t2.f3 from t1,t2
@ -3539,7 +3539,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 40
Handler_icp_attempts 40
Handler_icp_match 8
set join_cache_level=7;
select t2.f1, t2.f2, t2.f3 from t1,t2
@ -3556,7 +3556,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 60
Handler_icp_attempts 60
Handler_icp_match 12
set join_cache_level=8;
select t2.f1, t2.f2, t2.f3 from t1,t2
@ -3573,7 +3573,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref f1 f1 4 test.t1.f1 3 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 80
Handler_icp_attempts 80
Handler_icp_match 16
drop table t1,t2;
set join_cache_level=default;
@ -4274,7 +4274,7 @@ pk int NOT NULL, i int NOT NULL, v varchar(1) NOT NULL,
PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2 (v,i)
) COLLATE latin1_bin;
INSERT INTO t1 VALUES
(10,8,'v'), (11,8,'f'), (12,5,'v'), (13,8,'s'), (14,8,'a'),
(10,8,'v'), (11,8,'f'), (13,8,'s'), (14,8,'a'),
(15,6,'p'), (16,7,'z'), (17,2,'a'), (18,5,'h'), (19,7,'h'),
(25,3,'m'), (26,5,'a'), (27,9,'n'), (28,1,'d'), (29,107,'a');
INSERT INTO t1 VALUES
@ -4327,7 +4327,7 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL idx1 NULL NULL NULL 20 Using temporary; Using filesort
1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t1 ref idx2 idx2 3 test.t3.v 5 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT t2.v FROM t1, t2, t3
@ -4345,9 +4345,9 @@ SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL idx1 NULL NULL NULL 20 Using temporary; Using filesort
1 SIMPLE t2 index idx1 idx2 7 NULL 20 Using index; Using temporary; Using filesort
1 SIMPLE t3 hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 Using where; Using join buffer (flat, BNLH join)
1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 45 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t1 hash_ALL idx2 #hash#idx2 3 test.t3.v 44 Using where; Using join buffer (incremental, BNLH join)
SELECT t2.v FROM t1, t2, t3
WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
GROUP BY t2.v ORDER BY t1.pk,t2.v;

View file

@ -822,21 +822,21 @@ INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 0
Handler_icp_attempts 0
Handler_icp_match 0
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 2
Handler_icp_attempts 2
Handler_icp_match 1
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 2
Handler_icp_attempts 2
Handler_icp_match 1
DROP TABLE t1;
drop table if exists t0, t1, t1i, t1m;

View file

@ -0,0 +1,7 @@
select error;
mysqltest: At line 1: query 'select error' failed: 1054: Unknown column 'error' in 'field list'
SELECT ERROR;
mysqltest: At line 1: query 'SELECT ERROR' failed: 1054: Unknown column 'ERROR' in 'field list'
SELECT 2;
2
2

View file

@ -0,0 +1,10 @@
call mtr.add_suppression("InnoDB");
SELECT
PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE,PLUGIN_LIBRARY,PLUGIN_LIBRARY_VERSION,LOAD_OPTION
FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb';
PLUGIN_NAME InnoDB
PLUGIN_STATUS DISABLED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_LIBRARY NULL
PLUGIN_LIBRARY_VERSION NULL
LOAD_OPTION ON

View file

@ -0,0 +1,11 @@
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
INSERT INTO t2 VALUES (3),(4);
OPTIMIZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
test.t2 optimize status OK
drop table t1, t2;

View file

@ -442,9 +442,11 @@ show global variables like "query_cache_min_res_unit";
Variable_name Value
query_cache_min_res_unit 4096
set GLOBAL query_cache_min_res_unit=1001;
Warnings:
Warning 1292 Truncated incorrect query_cache_min_res_unit value: '1001'
show global variables like "query_cache_min_res_unit";
Variable_name Value
query_cache_min_res_unit 1008
query_cache_min_res_unit 1000
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
create table t2 (a int not null);

View file

@ -275,7 +275,7 @@ Variable_name Value
Handler_commit 0
Handler_delete 0
Handler_discover 0
Handler_icp_attempts 0
Handler_icp_attempts 0
Handler_icp_match 0
Handler_mrr_init 0
Handler_mrr_key_refills 0
@ -316,7 +316,7 @@ Variable_name Value
Handler_commit 0
Handler_delete 0
Handler_discover 0
Handler_icp_attempts 0
Handler_icp_attempts 0
Handler_icp_match 0
Handler_mrr_init 0
Handler_mrr_key_refills 0

View file

@ -100,7 +100,7 @@ Variable_name Value
Handler_commit 19
Handler_delete 1
Handler_discover 0
Handler_icp_attempts 0
Handler_icp_attempts 0
Handler_icp_match 0
Handler_mrr_init 0
Handler_mrr_key_refills 0

View file

@ -4585,7 +4585,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
NULL 0
NULL NULL
DROP TABLE t1, st1, st2;
#
# Bug #48709: Assertion failed in sql_select.cc:11782:
@ -6521,5 +6521,46 @@ INSERT INTO t1 VALUES (1);
SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
a
drop table t1;
#
# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
# main query and implicit grouping
#
CREATE TABLE t1 (f1 int) engine=MyISAM;
INSERT INTO t1 VALUES (7),(8);
CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
INSERT INTO t2 VALUES (3,'f');
EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
EXPLAIN
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 1
EXPLAIN
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
drop table t1,t2;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;

View file

@ -4587,7 +4587,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
NULL 0
NULL NULL
DROP TABLE t1, st1, st2;
#
# Bug #48709: Assertion failed in sql_select.cc:11782:
@ -6520,6 +6520,47 @@ INSERT INTO t1 VALUES (1);
SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
a
drop table t1;
#
# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
# main query and implicit grouping
#
CREATE TABLE t1 (f1 int) engine=MyISAM;
INSERT INTO t1 VALUES (7),(8);
CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
INSERT INTO t2 VALUES (3,'f');
EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
EXPLAIN
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 1
EXPLAIN
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
drop table t1,t2;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;

View file

@ -4583,7 +4583,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
NULL 0
NULL NULL
DROP TABLE t1, st1, st2;
#
# Bug #48709: Assertion failed in sql_select.cc:11782:
@ -6516,6 +6516,47 @@ INSERT INTO t1 VALUES (1);
SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
a
drop table t1;
#
# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
# main query and implicit grouping
#
CREATE TABLE t1 (f1 int) engine=MyISAM;
INSERT INTO t1 VALUES (7),(8);
CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
INSERT INTO t2 VALUES (3,'f');
EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
EXPLAIN
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 1
EXPLAIN
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
drop table t1,t2;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;

View file

@ -4591,7 +4591,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
NULL 0
NULL NULL
DROP TABLE t1, st1, st2;
#
# Bug #48709: Assertion failed in sql_select.cc:11782:
@ -6527,6 +6527,47 @@ INSERT INTO t1 VALUES (1);
SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
a
drop table t1;
#
# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
# main query and implicit grouping
#
CREATE TABLE t1 (f1 int) engine=MyISAM;
INSERT INTO t1 VALUES (7),(8);
CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
INSERT INTO t2 VALUES (3,'f');
EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
EXPLAIN
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 1
EXPLAIN
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
drop table t1,t2;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set optimizer_switch=default;

View file

@ -4583,7 +4583,7 @@ SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
FROM t1
WHERE a = 230;
MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
NULL 0
NULL NULL
DROP TABLE t1, st1, st2;
#
# Bug #48709: Assertion failed in sql_select.cc:11782:
@ -6516,6 +6516,47 @@ INSERT INTO t1 VALUES (1);
SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
a
drop table t1;
#
# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
# main query and implicit grouping
#
CREATE TABLE t1 (f1 int) engine=MyISAM;
INSERT INTO t1 VALUES (7),(8);
CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
INSERT INTO t2 VALUES (3,'f');
EXPLAIN
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 NULL
EXPLAIN
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
EXPLAIN
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 1
EXPLAIN
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
COUNT(f1) f4
0 0
drop table t1,t2;
# return optimizer switch changed in the beginning of this test
set optimizer_switch=@subselect_tmp;
set @optimizer_switch_for_subselect_test=null;

View file

@ -2671,4 +2671,44 @@ a
DEALLOCATE PREPARE pstmt;
DROP VIEW v1;
DROP TABLE t1, t2;
#
# BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF
#
set @tmp_jcl_978479= @@join_cache_level;
set join_cache_level=0;
set @tmp_os_978479= @@optimizer_switch;
set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off';
# Part#1: make sure EXPLAIN is using LooseScan:
CREATE TABLE t1 ( a INT, b INT );
INSERT INTO t1 VALUES
(4,0),(6,8),(3,1),(5,8),(3,9),(2,4),
(2,6),(9,1),(5,4),(7,7),(5,4);
CREATE ALGORITHM=TEMPTABLE
VIEW v1 AS SELECT * FROM t1;
# This will use LooseScan:
EXPLAIN
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where
1 PRIMARY <derived3> ref key0 key0 5 test.t1_1.a 2 Start temporary
1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 Using where; End temporary
3 DERIVED t1 ALL NULL NULL NULL NULL 11
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 );
a b a b
3 1 9 1
5 8 4 0
3 9 9 1
2 4 6 8
2 4 4 0
2 6 6 8
2 6 4 0
5 4 4 0
7 7 7 7
5 4 4 0
DROP VIEW v1;
DROP TABLE t1;
set @@join_cache_level= @tmp_jcl_978479;
set @@optimizer_switch= @tmp_os_978479;
set optimizer_switch=@subselect_sj_tmp;

View file

@ -2685,6 +2685,46 @@ a
DEALLOCATE PREPARE pstmt;
DROP VIEW v1;
DROP TABLE t1, t2;
#
# BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF
#
set @tmp_jcl_978479= @@join_cache_level;
set join_cache_level=0;
set @tmp_os_978479= @@optimizer_switch;
set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off';
# Part#1: make sure EXPLAIN is using LooseScan:
CREATE TABLE t1 ( a INT, b INT );
INSERT INTO t1 VALUES
(4,0),(6,8),(3,1),(5,8),(3,9),(2,4),
(2,6),(9,1),(5,4),(7,7),(5,4);
CREATE ALGORITHM=TEMPTABLE
VIEW v1 AS SELECT * FROM t1;
# This will use LooseScan:
EXPLAIN
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1_1 ALL NULL NULL NULL NULL 11 Using where
1 PRIMARY <derived3> ref key0 key0 5 test.t1_1.a 2 Start temporary
1 PRIMARY t1_2 ALL NULL NULL NULL NULL 11 Using where; End temporary
3 DERIVED t1 ALL NULL NULL NULL NULL 11
SELECT * FROM t1 AS t1_1, t1 AS t1_2
WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 );
a b a b
3 1 9 1
5 8 4 0
3 9 9 1
2 4 6 8
2 4 4 0
2 6 6 8
2 6 4 0
5 4 4 0
7 7 7 7
5 4 4 0
DROP VIEW v1;
DROP TABLE t1;
set @@join_cache_level= @tmp_jcl_978479;
set @@optimizer_switch= @tmp_os_978479;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off

View file

@ -21,6 +21,12 @@ name cdate note
name1 1998-01-01 note01
name2 1998-01-01 note01
drop table t1,t2;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(1);
SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL;
a
1
DROP TABLE t1;
CREATE TABLE t1 ( datum DATE );
INSERT INTO t1 VALUES ( "2000-1-1" );
INSERT INTO t1 VALUES ( "2000-1-2" );

View file

@ -0,0 +1,9 @@
CREATE TABLE t1 ( a INT, b CHAR(3) );
INSERT INTO t1 VALUES ( 1, 'foo' );
CREATE TABLE t2 ( c CHAR(3), d INT );
INSERT INTO t2 VALUES ( 'foo', 1 );
UPDATE IGNORE t1, t2 SET b = 'bar', c = 'bar'
WHERE a != ( SELECT 1 UNION SELECT 2 );
Warnings:
Warning 1242 Subquery returns more than 1 row
DROP TABLE t1, t2;

View file

@ -26,6 +26,9 @@ sub skip_combinations {
$skip{'include/not_windows.inc'} = 'Requires not Windows' if IS_WINDOWS;
$skip{'t/plugin_loaderr.test'} = 'needs compiled-in innodb'
unless $::mysqld_variables{'innodb'} eq "ON";
# disable tests that use ipv6, if unsupported
use Socket;
$skip{'include/check_ipv6.inc'} = 'No IPv6'

View file

@ -0,0 +1,9 @@
package My::Suite::Archive;
@ISA = qw(My::Suite);
return ("Need Archive engine" unless $ENV{HA_ARCHIVE_SO} or
$::mysqld_variables{'archive'} eq "ON");
bless { };

View file

@ -2365,8 +2365,8 @@ select_type SIMPLE
table t1
type index
possible_keys NULL
key PRIMARY
key_len 4
key b
key_len 10
ref NULL
rows 10
Extra Using index
@ -2652,7 +2652,7 @@ select_type SIMPLE
table t1
type index
possible_keys NULL
key PRIMARY
key b
key_len 8
ref NULL
rows 3

View file

@ -824,21 +824,21 @@ INSERT INTO t1 VALUES ('3', '3'),('4','4'),('5','5');
flush status;
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 0
Handler_icp_attempts 0
Handler_icp_match 0
SELECT * FROM t1 FORCE INDEX(c1) WHERE (c1='3' or c1='4') and c1 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 2
Handler_icp_attempts 2
Handler_icp_match 1
SELECT * FROM t1 WHERE (c2='3' or c2='4') and c2 % 2 = 0 ;
c1 c2
4 4
show status like "Handler_icp%";
Variable_name Value
Handler_icp_attempts 2
Handler_icp_attempts 2
Handler_icp_match 1
DROP TABLE t1;
set storage_engine= @save_storage_engine;

View file

@ -0,0 +1,29 @@
drop table if exists t1,t2;
Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
CREATE TABLE t1 (i INT) ENGINE=Aria;
CREATE TABLE t2 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE, t2 WRITE;
DROP TABLE t1;
UNLOCK TABLES;
DROP TABLE t2;
CREATE TABLE t1 (i INT) ENGINE=Aria;
CREATE TABLE t2 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE, t2 WRITE;
FLUSH TABLE t1;
select * from t1;
i
unlock tables;
drop table t1,t2;
CREATE TABLE t1 (i INT) ENGINE=Aria;
CREATE TABLE t2 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE, t2 WRITE;
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair status OK
select * from t1;
i
drop table t2;
unlock tables;
drop table t1;

View file

@ -0,0 +1,44 @@
#
# Testing of potential problems in Aria with locking
#
-- source include/have_maria.inc
drop table if exists t1,t2;
#
# Test for Bug#973039
# Assertion `share->in_trans == 0' failed in maria_close on DROP TABLE
# under LOCK
#
# Test DROP TABLE
CREATE TABLE t1 (i INT) ENGINE=Aria;
CREATE TABLE t2 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE, t2 WRITE;
# Also fails with FLUSH TABLE t1 and with REPAIR TABLE t1 USE_FRM
DROP TABLE t1;
UNLOCK TABLES;
DROP TABLE t2;
#Test FLUSH TABLE
CREATE TABLE t1 (i INT) ENGINE=Aria;
CREATE TABLE t2 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE, t2 WRITE;
FLUSH TABLE t1;
select * from t1;
unlock tables;
drop table t1,t2;
# Test REPAIR ... USE_FRM and unlock tables last
CREATE TABLE t1 (i INT) ENGINE=Aria;
CREATE TABLE t2 (i INT) ENGINE=Aria;
LOCK TABLE t1 WRITE, t2 WRITE;
repair table t1 use_frm;
select * from t1;
drop table t2;
unlock tables;
drop table t1;

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