Merge branch '5.5' into bb-10.0

This commit is contained in:
Sergei Golubchik 2016-06-21 14:11:02 +02:00
commit c081c978a2
84 changed files with 1451 additions and 1053 deletions

View File

@ -235,8 +235,6 @@ my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
int error = 0;
switch(optid) { switch(optid) {
case 'c': case 'c':
opt_count_iterations= 1; opt_count_iterations= 1;
@ -284,8 +282,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break; break;
case '?': case '?':
case 'I': /* Info */ case 'I': /* Info */
error++; usage();
break; exit(0);
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300 #if MYSQL_VERSION_ID > 32300
charsets_dir = argument; charsets_dir = argument;
@ -296,11 +294,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt->name); opt->name);
break; break;
} }
if (error)
{
usage();
exit(1);
}
return 0; return 0;
} }

View File

@ -246,7 +246,7 @@ static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when); static void DBerror(MYSQL *mysql, const char *when);
static void safe_exit(int error); static void safe_exit(int error);
static void print_result(); static void print_result();
static uint fixed_name_length(const char *name); static size_t fixed_name_length(const char *name);
static char *fix_table_name(char *dest, char *src); static char *fix_table_name(char *dest, char *src);
int what_to_do = 0; int what_to_do = 0;
@ -594,10 +594,10 @@ static int process_selected_tables(char *db, char **table_names, int tables)
} /* process_selected_tables */ } /* process_selected_tables */
static uint fixed_name_length(const char *name) static size_t fixed_name_length(const char *name)
{ {
const char *p; const char *p;
uint extra_length= 2; /* count the first/last backticks */ size_t extra_length= 2; /* count the first/last backticks */
DBUG_ENTER("fixed_name_length"); DBUG_ENTER("fixed_name_length");
for (p= name; *p; p++) for (p= name; *p; p++)
@ -605,7 +605,7 @@ static uint fixed_name_length(const char *name)
if (*p == '`') if (*p == '`')
extra_length++; extra_length++;
} }
DBUG_RETURN((uint) ((p - name) + extra_length)); DBUG_RETURN((size_t) ((p - name) + extra_length));
} }
@ -664,7 +664,7 @@ static int process_all_tables_in_db(char *database)
*/ */
char *tables, *end; char *tables, *end;
uint tot_length = 0; size_t tot_length = 0;
char *views, *views_end; char *views, *views_end;
uint tot_views_length = 0; uint tot_views_length = 0;
@ -769,7 +769,9 @@ static int fix_table_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9)) if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1); DBUG_RETURN(1);
sprintf(qbuf, "RENAME TABLE `%s` TO `%s`", name, name + 9); my_snprintf(qbuf, sizeof(qbuf), "RENAME TABLE %`s TO %`s",
name, name + 9);
rc= run_query(qbuf, 1); rc= run_query(qbuf, 1);
if (verbose) if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
@ -784,7 +786,8 @@ static int fix_database_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9)) if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1); DBUG_RETURN(1);
sprintf(qbuf, "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME", name); my_snprintf(qbuf, sizeof(qbuf), "ALTER DATABASE %`s UPGRADE DATA DIRECTORY "
"NAME", name);
rc= run_query(qbuf, 1); rc= run_query(qbuf, 1);
if (verbose) if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK"); printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
@ -806,7 +809,7 @@ static int rebuild_table(char *name)
ptr= strxmov(ptr, " FORCE", NullS); ptr= strxmov(ptr, " FORCE", NullS);
if (verbose >= 3) if (verbose >= 3)
puts(query); puts(query);
if (mysql_real_query(sock, query, (uint)(ptr - query))) if (mysql_real_query(sock, query, (ulong)(ptr - query)))
{ {
fprintf(stderr, "Failed to %s\n", query); fprintf(stderr, "Failed to %s\n", query);
fprintf(stderr, "Error: %s\n", mysql_error(sock)); fprintf(stderr, "Error: %s\n", mysql_error(sock));
@ -870,7 +873,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
{ {
char *query, *end, options[100], message[100]; char *query, *end, options[100], message[100];
char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name; char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name;
uint query_length= 0; size_t query_length= 0, query_size= sizeof(char)*(length+110);
const char *op = 0; const char *op = 0;
const char *tab_view; const char *tab_view;
DBUG_ENTER("handle_request_for_tables"); DBUG_ENTER("handle_request_for_tables");
@ -923,10 +926,12 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
DBUG_RETURN(fix_table_storage_name(tables)); DBUG_RETURN(fix_table_storage_name(tables));
} }
if (!(query =(char *) my_malloc((sizeof(char)*(length+110)), MYF(MY_WME)))) if (!(query =(char *) my_malloc(query_size, MYF(MY_WME))))
DBUG_RETURN(1); DBUG_RETURN(1);
if (opt_all_in_1) if (opt_all_in_1)
{ {
DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size);
/* No backticks here as we added them before */ /* No backticks here as we added them before */
query_length= sprintf(query, "%s%s%s %s", op, query_length= sprintf(query, "%s%s%s %s", op,
tab_view, tables, options); tab_view, tables, options);
@ -942,7 +947,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
(int) (ptr - org))); (int) (ptr - org)));
table_name= table_name_buff; table_name= table_name_buff;
ptr= strxmov(ptr, " ", options, NullS); ptr= strxmov(ptr, " ", options, NullS);
query_length= (uint) (ptr - query); query_length= (size_t) (ptr - query);
} }
if (verbose >= 3) if (verbose >= 3)
puts(query); puts(query);
@ -1208,7 +1213,7 @@ int main(int argc, char **argv)
process_databases(argv); process_databases(argv);
if (opt_auto_repair) if (opt_auto_repair)
{ {
uint i; size_t i;
if (!opt_silent && (tables4repair.elements || tables4rebuild.elements)) if (!opt_silent && (tables4repair.elements || tables4rebuild.elements))
puts("\nRepairing tables"); puts("\nRepairing tables");

View File

@ -92,7 +92,7 @@
static void add_load_option(DYNAMIC_STRING *str, const char *option, static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value); const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, uint length, static ulong find_set(TYPELIB *lib, const char *x, size_t length,
char **err_pos, uint *err_len); char **err_pos, uint *err_len);
static char *alloc_query_str(ulong size); static char *alloc_query_str(ulong size);
@ -890,7 +890,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_set_charset= 0; opt_set_charset= 0;
opt_compatible_mode_str= argument; opt_compatible_mode_str= argument;
opt_compatible_mode= find_set(&compatible_mode_typelib, opt_compatible_mode= find_set(&compatible_mode_typelib,
argument, (uint) strlen(argument), argument, strlen(argument),
&err_ptr, &err_len); &err_ptr, &err_len);
if (err_len) if (err_len)
{ {
@ -900,7 +900,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
#if !defined(DBUG_OFF) #if !defined(DBUG_OFF)
{ {
uint size_for_sql_mode= 0; size_t size_for_sql_mode= 0;
const char **ptr; const char **ptr;
for (ptr= compatible_mode_names; *ptr; ptr++) for (ptr= compatible_mode_names; *ptr; ptr++)
size_for_sql_mode+= strlen(*ptr); size_for_sql_mode+= strlen(*ptr);
@ -1171,8 +1171,8 @@ static int fetch_db_collation(const char *db_name,
break; break;
} }
strncpy(db_cl_name, db_cl_row[0], db_cl_size); strncpy(db_cl_name, db_cl_row[0], db_cl_size-1);
db_cl_name[db_cl_size - 1]= 0; /* just in case. */ db_cl_name[db_cl_size - 1]= 0;
} while (FALSE); } while (FALSE);
@ -1305,7 +1305,7 @@ get_gtid_pos(char *out_gtid_pos, int master)
static char *my_case_str(const char *str, static char *my_case_str(const char *str,
uint str_len, size_t str_len,
const char *token, const char *token,
uint token_len) uint token_len)
{ {
@ -1521,7 +1521,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
*/ */
static char *cover_definer_clause(const char *stmt_str, static char *cover_definer_clause(const char *stmt_str,
uint stmt_length, size_t stmt_length,
const char *definer_version_str, const char *definer_version_str,
uint definer_version_length, uint definer_version_length,
const char *stmt_version_str, const char *stmt_version_str,
@ -1721,14 +1721,14 @@ static void dbDisconnect(char *host)
} /* dbDisconnect */ } /* dbDisconnect */
static void unescape(FILE *file,char *pos,uint length) static void unescape(FILE *file,char *pos, size_t length)
{ {
char *tmp; char *tmp;
DBUG_ENTER("unescape"); DBUG_ENTER("unescape");
if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME)))) if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME))))
die(EX_MYSQLERR, "Couldn't allocate memory"); die(EX_MYSQLERR, "Couldn't allocate memory");
mysql_real_escape_string(&mysql_connection, tmp, pos, length); mysql_real_escape_string(&mysql_connection, tmp, pos, (ulong)length);
fputc('\'', file); fputc('\'', file);
fputs(tmp, file); fputs(tmp, file);
fputc('\'', file); fputc('\'', file);
@ -1842,7 +1842,7 @@ static char *quote_for_like(const char *name, char *buff)
Quote '<' '>' '&' '\"' chars and print a string to the xml_file. Quote '<' '>' '&' '\"' chars and print a string to the xml_file.
*/ */
static void print_quoted_xml(FILE *xml_file, const char *str, ulong len, static void print_quoted_xml(FILE *xml_file, const char *str, size_t len,
my_bool is_attribute_name) my_bool is_attribute_name)
{ {
const char *end; const char *end;
@ -2103,7 +2103,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
squeezed to a single hyphen. squeezed to a single hyphen.
*/ */
static void print_xml_comment(FILE *xml_file, ulong len, static void print_xml_comment(FILE *xml_file, size_t len,
const char *comment_string) const char *comment_string)
{ {
const char* end; const char* end;
@ -2220,7 +2220,7 @@ static uint dump_events_for_db(char *db)
DBUG_ENTER("dump_events_for_db"); DBUG_ENTER("dump_events_for_db");
DBUG_PRINT("enter", ("db: '%s'", db)); DBUG_PRINT("enter", ("db: '%s'", db));
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db)); mysql_real_escape_string(mysql, db_name_buff, db, (ulong)strlen(db));
/* nice comments */ /* nice comments */
print_comment(sql_file, 0, print_comment(sql_file, 0,
@ -2340,7 +2340,6 @@ static uint dump_events_for_db(char *db)
(const char *) delimiter); (const char *) delimiter);
my_free(query_str); my_free(query_str);
restore_time_zone(sql_file, delimiter); restore_time_zone(sql_file, delimiter);
restore_sql_mode(sql_file, delimiter); restore_sql_mode(sql_file, delimiter);
@ -2433,7 +2432,7 @@ static uint dump_routines_for_db(char *db)
DBUG_ENTER("dump_routines_for_db"); DBUG_ENTER("dump_routines_for_db");
DBUG_PRINT("enter", ("db: '%s'", db)); DBUG_PRINT("enter", ("db: '%s'", db));
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db)); mysql_real_escape_string(mysql, db_name_buff, db, (ulong)strlen(db));
/* nice comments */ /* nice comments */
print_comment(sql_file, 0, print_comment(sql_file, 0,
@ -2491,9 +2490,9 @@ static uint dump_routines_for_db(char *db)
if the user has EXECUTE privilege he see routine names, but NOT the if the user has EXECUTE privilege he see routine names, but NOT the
routine body of other routines that are not the creator of! routine body of other routines that are not the creator of!
*/ */
DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d", DBUG_PRINT("info",("length of body for %s row[2] '%s' is %zu",
routine_name, row[2] ? row[2] : "(null)", routine_name, row[2] ? row[2] : "(null)",
row[2] ? (int) strlen(row[2]) : 0)); row[2] ? strlen(row[2]) : 0));
if (row[2] == NULL) if (row[2] == NULL)
{ {
print_comment(sql_file, 1, "\n-- insufficient privileges to %s\n", print_comment(sql_file, 1, "\n-- insufficient privileges to %s\n",
@ -4076,7 +4075,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
int i; int i;
char name_buff[NAME_LEN*2+3]; char name_buff[NAME_LEN*2+3];
mysql_real_escape_string(mysql, name_buff, db, strlen(db)); mysql_real_escape_string(mysql, name_buff, db, (ulong)strlen(db));
init_dynamic_string_checked(&dynamic_where, " AND TABLESPACE_NAME IN (" init_dynamic_string_checked(&dynamic_where, " AND TABLESPACE_NAME IN ("
"SELECT DISTINCT TABLESPACE_NAME FROM" "SELECT DISTINCT TABLESPACE_NAME FROM"
@ -4089,7 +4088,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
for (i=0 ; i<tables ; i++) for (i=0 ; i<tables ; i++)
{ {
mysql_real_escape_string(mysql, name_buff, mysql_real_escape_string(mysql, name_buff,
table_names[i], strlen(table_names[i])); table_names[i], (ulong)strlen(table_names[i]));
dynstr_append_checked(&dynamic_where, "'"); dynstr_append_checked(&dynamic_where, "'");
dynstr_append_checked(&dynamic_where, name_buff); dynstr_append_checked(&dynamic_where, name_buff);
@ -4119,7 +4118,7 @@ static int dump_tablespaces_for_databases(char** databases)
{ {
char db_name_buff[NAME_LEN*2+3]; char db_name_buff[NAME_LEN*2+3];
mysql_real_escape_string(mysql, db_name_buff, mysql_real_escape_string(mysql, db_name_buff,
databases[i], strlen(databases[i])); databases[i], (ulong)strlen(databases[i]));
dynstr_append_checked(&dynamic_where, "'"); dynstr_append_checked(&dynamic_where, "'");
dynstr_append_checked(&dynamic_where, db_name_buff); dynstr_append_checked(&dynamic_where, db_name_buff);
dynstr_append_checked(&dynamic_where, "',"); dynstr_append_checked(&dynamic_where, "',");
@ -5320,7 +5319,7 @@ static int start_transaction(MYSQL *mysql_con)
} }
static ulong find_set(TYPELIB *lib, const char *x, uint length, static ulong find_set(TYPELIB *lib, const char *x, size_t length,
char **err_pos, uint *err_len) char **err_pos, uint *err_len)
{ {
const char *end= x + length; const char *end= x + length;
@ -5378,7 +5377,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
fputc(' ',file); fputc(' ',file);
fputs(prefix, file); fputs(prefix, file);
if (string_value) if (string_value)
unescape(file,row[0],(uint) strlen(row[0])); unescape(file,row[0], strlen(row[0]));
else else
fputs(row[0], file); fputs(row[0], file);
check_io(file); check_io(file);
@ -5632,8 +5631,8 @@ static my_bool get_view_structure(char *table, char* db)
verbose_msg("-- Retrieving view structure for table %s...\n", table); verbose_msg("-- Retrieving view structure for table %s...\n", table);
#ifdef NOT_REALLY_USED_YET #ifdef NOT_REALLY_USED_YET
sprintf(insert_pat, "SET SQL_QUOTE_SHOW_CREATE=%d", dynstr_append_checked(&insert_pat, "SET SQL_QUOTE_SHOW_CREATE=");
(opt_quoted || opt_keywords)); dynstr_append_checked(&insert_pat, (opt_quoted || opt_keywords)? "1":"0");
#endif #endif
result_table= quote_name(table, table_buff, 1); result_table= quote_name(table, table_buff, 1);

View File

@ -51,9 +51,9 @@ static int list_tables(MYSQL *mysql,const char *db,const char *table);
static int list_table_status(MYSQL *mysql,const char *db,const char *table); static int list_table_status(MYSQL *mysql,const char *db,const char *table);
static int list_fields(MYSQL *mysql,const char *db,const char *table, static int list_fields(MYSQL *mysql,const char *db,const char *table,
const char *field); const char *field);
static void print_header(const char *header,uint head_length,...); static void print_header(const char *header,size_t head_length,...);
static void print_row(const char *header,uint head_length,...); static void print_row(const char *header,size_t head_length,...);
static void print_trailer(uint length,...); static void print_trailer(size_t length,...);
static void print_res_header(MYSQL_RES *result); static void print_res_header(MYSQL_RES *result);
static void print_res_top(MYSQL_RES *result); static void print_res_top(MYSQL_RES *result);
static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur); static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur);
@ -379,7 +379,8 @@ static int
list_dbs(MYSQL *mysql,const char *wild) list_dbs(MYSQL *mysql,const char *wild)
{ {
const char *header; const char *header;
uint length, counter = 0; size_t length = 0;
uint counter = 0;
ulong rowcount = 0L; ulong rowcount = 0L;
char tables[NAME_LEN+1], rows[NAME_LEN+1]; char tables[NAME_LEN+1], rows[NAME_LEN+1];
char query[NAME_LEN + 100]; char query[NAME_LEN + 100];
@ -417,7 +418,7 @@ list_dbs(MYSQL *mysql,const char *wild)
printf("Wildcard: %s\n",wild); printf("Wildcard: %s\n",wild);
header="Databases"; header="Databases";
length=(uint) strlen(header); length= strlen(header);
field=mysql_fetch_field(result); field=mysql_fetch_field(result);
if (length < field->max_length) if (length < field->max_length)
length=field->max_length; length=field->max_length;
@ -505,7 +506,8 @@ static int
list_tables(MYSQL *mysql,const char *db,const char *table) list_tables(MYSQL *mysql,const char *db,const char *table)
{ {
const char *header; const char *header;
uint head_length, counter = 0; size_t head_length;
uint counter = 0;
char query[NAME_LEN + 100], rows[NAME_LEN], fields[16]; char query[NAME_LEN + 100], rows[NAME_LEN], fields[16];
MYSQL_FIELD *field; MYSQL_FIELD *field;
MYSQL_RES *result; MYSQL_RES *result;
@ -542,7 +544,7 @@ list_tables(MYSQL *mysql,const char *db,const char *table)
putchar('\n'); putchar('\n');
header="Tables"; header="Tables";
head_length=(uint) strlen(header); head_length= strlen(header);
field=mysql_fetch_field(result); field=mysql_fetch_field(result);
if (head_length < field->max_length) if (head_length < field->max_length)
head_length=field->max_length; head_length=field->max_length;
@ -660,7 +662,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild)
len= sizeof(query); len= sizeof(query);
len-= my_snprintf(query, len, "show table status from `%s`", db); len-= my_snprintf(query, len, "show table status from `%s`", db);
if (wild && wild[0] && len) if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS); strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n",
@ -693,7 +695,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
const char *wild) const char *wild)
{ {
char query[NAME_LEN + 100]; char query[NAME_LEN + 100];
int len; size_t len;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_ROW row; MYSQL_ROW row;
ulong UNINIT_VAR(rows); ulong UNINIT_VAR(rows);
@ -723,7 +725,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`", len-= my_snprintf(query, len, "show /*!32332 FULL */ columns from `%s`",
table); table);
if (wild && wild[0] && len) if (wild && wild[0] && len)
strxnmov(query + strlen(query), len, " like '", wild, "'", NullS); strxnmov(query + strlen(query), len - 1, " like '", wild, "'", NullS);
if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql))) if (mysql_query(mysql,query) || !(result=mysql_store_result(mysql)))
{ {
fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n", fprintf(stderr,"%s: Cannot list columns in db: %s, table: %s: %s\n",
@ -771,10 +773,10 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
*****************************************************************************/ *****************************************************************************/
static void static void
print_header(const char *header,uint head_length,...) print_header(const char *header,size_t head_length,...)
{ {
va_list args; va_list args;
uint length,i,str_length,pre_space; size_t length,i,str_length,pre_space;
const char *field; const char *field;
va_start(args,head_length); va_start(args,head_length);
@ -797,10 +799,10 @@ print_header(const char *header,uint head_length,...)
putchar('|'); putchar('|');
for (;;) for (;;)
{ {
str_length=(uint) strlen(field); str_length= strlen(field);
if (str_length > length) if (str_length > length)
str_length=length+1; str_length=length+1;
pre_space=(uint) (((int) length-(int) str_length)/2)+1; pre_space= ((length- str_length)/2)+1;
for (i=0 ; i < pre_space ; i++) for (i=0 ; i < pre_space ; i++)
putchar(' '); putchar(' ');
for (i = 0 ; i < str_length ; i++) for (i = 0 ; i < str_length ; i++)
@ -834,11 +836,11 @@ print_header(const char *header,uint head_length,...)
static void static void
print_row(const char *header,uint head_length,...) print_row(const char *header,size_t head_length,...)
{ {
va_list args; va_list args;
const char *field; const char *field;
uint i,length,field_length; size_t i,length,field_length;
va_start(args,head_length); va_start(args,head_length);
field=header; length=head_length; field=header; length=head_length;
@ -847,7 +849,7 @@ print_row(const char *header,uint head_length,...)
putchar('|'); putchar('|');
putchar(' '); putchar(' ');
fputs(field,stdout); fputs(field,stdout);
field_length=(uint) strlen(field); field_length= strlen(field);
for (i=field_length ; i <= length ; i++) for (i=field_length ; i <= length ; i++)
putchar(' '); putchar(' ');
if (!(field=va_arg(args,char *))) if (!(field=va_arg(args,char *)))
@ -861,10 +863,10 @@ print_row(const char *header,uint head_length,...)
static void static void
print_trailer(uint head_length,...) print_trailer(size_t head_length,...)
{ {
va_list args; va_list args;
uint length,i; size_t length,i;
va_start(args,head_length); va_start(args,head_length);
length=head_length; length=head_length;
@ -907,7 +909,7 @@ static void print_res_top(MYSQL_RES *result)
mysql_field_seek(result,0); mysql_field_seek(result,0);
while((field = mysql_fetch_field(result))) while((field = mysql_fetch_field(result)))
{ {
if ((length=(uint) strlen(field->name)) > field->max_length) if ((length= strlen(field->name)) > field->max_length)
field->max_length=length; field->max_length=length;
else else
length=field->max_length; length=field->max_length;

View File

@ -50,10 +50,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
switch(optid) { switch(optid) {
case 'V': case 'V':
printf("%s version %s by Jani Tolonen\n", progname, VER); printf("%s version %s by Jani Tolonen\n", progname, VER);
exit(-1); exit(0);
case 'I': case 'I':
case '?': case '?':
usage(); usage();
exit(0);
} }
return 0; return 0;
} }
@ -69,7 +70,10 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0) (t= atoi(argv[1])) <= 0)
{
usage(); usage();
exit(-1);
}
for (; t > 0; t--) for (; t > 0; t--)
{ {
if (kill((pid_t) pid, sig)) if (kill((pid_t) pid, sig))
@ -100,5 +104,4 @@ void usage(void)
printf("integer arguments.\n\n"); printf("integer arguments.\n\n");
printf("Options:\n"); printf("Options:\n");
my_print_help(my_long_options); my_print_help(my_long_options);
exit(-1);
} }

View File

@ -1,6 +1,5 @@
/* /*
Copyright (C) 2000-2007 MySQL AB Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -76,3 +76,9 @@ INSTALL(DIRECTORY . DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Developm
PATTERN CMakeFiles EXCLUDE PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE PATTERN mysql EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE) REGEX "\\./(${EXCL_RE}$)" EXCLUDE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/. DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development
FILES_MATCHING PATTERN "*.h"
PATTERN CMakeFiles EXCLUDE
PATTERN mysql EXCLUDE
REGEX "\\./(${EXCL_RE}$)" EXCLUDE)

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -331,7 +331,8 @@ typedef struct st_sort_info
my_off_t filelength, dupp, buff_length; my_off_t filelength, dupp, buff_length;
ha_rows max_records; ha_rows max_records;
uint current_key, total_keys; uint current_key, total_keys;
uint got_error, threads_running; volatile uint got_error;
uint threads_running;
myf myf_rw; myf myf_rw;
enum data_file_type new_data_file_type; enum data_file_type new_data_file_type;
} MI_SORT_INFO; } MI_SORT_INFO;

View File

@ -118,8 +118,12 @@ ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
# On Unix, it is libmysqld.a # On Unix, it is libmysqld.a
IF(WIN32) IF(WIN32)
SET(MYSQLSERVER_OUTPUT_NAME mysqlserver) SET(MYSQLSERVER_OUTPUT_NAME mysqlserver)
SET(COMPONENT_MYSQLSERVER "Embedded")
SET(COMPONENT_LIBMYSQLD "Embedded")
ELSE() ELSE()
SET(MYSQLSERVER_OUTPUT_NAME mysqld) SET(MYSQLSERVER_OUTPUT_NAME mysqld)
SET(COMPONENT_MYSQLSERVER "Development")
SET(COMPONENT_LIBMYSQLD "Server")
ENDIF() ENDIF()
@ -144,9 +148,9 @@ FOREACH(LIB ${LIBS})
ENDFOREACH() ENDFOREACH()
MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS}
OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Development) OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT ${COMPONENT_MYSQLSERVER})
INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT Development) INSTALL(FILES embedded_priv.h DESTINATION ${INSTALL_INCLUDEDIR}/private COMPONENT ${COMPONENT_MYSQLSERVER})
# Visual Studio users need debug static library # Visual Studio users need debug static library
IF(MSVC) IF(MSVC)
@ -173,7 +177,7 @@ ENDFOREACH()
IF(NOT DISABLE_SHARED) IF(NOT DISABLE_SHARED)
MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API} MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API}
COMPONENT Server) COMPONENT ${COMPONENT_LIBMYSQLD})
IF(UNIX) IF(UNIX)
# Name the shared library, handle versioning (provides same api as client # Name the shared library, handle versioning (provides same api as client
# library hence the same version) # library hence the same version)

View File

@ -1807,9 +1807,12 @@ sub set_build_thread_ports($) {
if ( lc($opt_build_thread) eq 'auto' ) { if ( lc($opt_build_thread) eq 'auto' ) {
my $found_free = 0; my $found_free = 0;
$build_thread = 300; # Start attempts from here $build_thread = 300; # Start attempts from here
my $build_thread_upper = $build_thread + ($opt_parallel > 1500
? 3000
: 2 * $opt_parallel) + 300;
while (! $found_free) while (! $found_free)
{ {
$build_thread= mtr_get_unique_id($build_thread, 349); $build_thread= mtr_get_unique_id($build_thread, $build_thread_upper);
if ( !defined $build_thread ) { if ( !defined $build_thread ) {
mtr_error("Could not get a unique build thread id"); mtr_error("Could not get a unique build thread id");
} }

View File

@ -277,9 +277,40 @@ CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('m'),('n'); INSERT INTO t1 VALUES ('m'),('n');
CREATE VIEW v1 AS SELECT 'w' ; CREATE VIEW v1 AS SELECT 'w' ;
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 ); SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<=' a
m
n
drop view v1; drop view v1;
drop table t1; drop table t1;
SET character_set_connection = default; SET character_set_connection = default;
SET optimizer_switch= default; SET optimizer_switch= default;
#End of 5.3 tests #End of 5.3 tests
#
# Start of 5.5 tests
#
#
# MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
#
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('A'),('a'),('B'),('b');
CREATE VIEW v1 AS SELECT 'a';
SELECT * FROM v1,t1 where t1.a=v1.a;
a a
a A
a a
DROP VIEW v1;
DROP TABLE t1;
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('b'),('c');
CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b';
SELECT * FROM v1,t1 WHERE t1.a=v1.a;
a a
a a
b b
DROP VIEW v1;
DROP TABLE t1;
#
# End of 5.5 tests
#

View File

@ -6108,6 +6108,45 @@ OCTET_LENGTH(a) a
255 255
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
#
#
SET NAMES utf8;
SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data;
data
131072
SELECT length(data) AS len FROM (
SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data
) AS sub;
len
131072
SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data;
data
131070
SELECT length(data) AS len FROM (
SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data
) AS sub;
len
131070
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub;
len
73532
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub;
len
73534
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub;
len
73556
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub;
len
131070
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub;
len
131072
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
len
131074
#
# End of 5.5 tests # End of 5.5 tests
# #
# #

View File

@ -2825,6 +2825,40 @@ OCTET_LENGTH(a) a
252 😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎 252 😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎😎
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
#
#
SET NAMES utf8mb4;
SELECT length(repeat(_utf8mb4 0xE29883, 21844)) AS data;
data
65532
SELECT length(data) AS len
FROM ( SELECT repeat(_utf8mb4 0xE29883, 21844) AS data ) AS sub;
len
65532
SELECT length(repeat(_utf8mb4 0xE29883, 21846)) AS data;
data
65538
SELECT length(data) AS len
FROM ( SELECT repeat(_utf8mb4 0xE29883, 21846) AS data ) AS sub;
len
65538
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21844) AS data ) AS sub;
len
65532
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21845) AS data ) AS sub;
len
65535
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub;
len
65538
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub;
len
196605
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub;
len
196608
#
# End of 5.5 tests # End of 5.5 tests
# #
# #

View File

@ -28,3 +28,18 @@ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`
UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
DROP TABLE t2, t1; DROP TABLE t2, t1;
#
# BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN
# KEY CONSTRAINT
CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB;
CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL,
CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB;
# Without patch, reports incorrect error.
INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
REPLACE INTO t2 VALUES('abc', 2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
Warnings:
Warning 1452 Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk` FOREIGN KEY (`fld2`) REFERENCES `t1` (`fld1`))
DROP TABLE t2, t1;

View File

@ -102,6 +102,34 @@ SELECT monthname('2001-03-01');
monthname('2001-03-01') monthname('2001-03-01')
März März
# #
# MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
#
SET NAMES utf8;
CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
INSERT INTO t1 VALUES ('test',now());
Warnings:
Note 1265 Data truncated for column 'd' at row 1
SET lc_time_names=ru_RU;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>'
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
ERROR HY000: Illegal mix of collations (utf8_general_ci,COERCIBLE) and (latin1_swedish_ci,IMPLICIT) for operation '<>'
SET lc_time_names=en_US;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
c
test
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
c
test
SET NAMES latin1;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
c
test
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
c
test
DROP TABLE t1;
#
# Start of 5.6 tests # Start of 5.6 tests
# #
# #

View File

@ -376,6 +376,11 @@ Repairing views
test.v1 OK test.v1 OK
drop view v1; drop view v1;
drop table t1; drop table t1;
create table `#mysql50#t1``1` (a int) engine=myisam;
show tables;
Tables_in_test
t1`1
drop table `t1``1`;
# #
#MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck
# #

View File

@ -643,3 +643,23 @@ CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
SET default_storage_engine = NEW.INNODB; SET default_storage_engine = NEW.INNODB;
ERROR 42S22: Unknown column 'INNODB' in 'NEW' ERROR 42S22: Unknown column 'INNODB' in 'NEW'
DROP TABLE t1; DROP TABLE t1;
select 0==0;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=0' at line 1
select 1=!0, 1 = ! 0;
1=!0 1 = ! 0
1 1
select !!0, ! ! 0;
!!0 ! ! 0
0 0
select 2>!0, 2 > ! 0;
2>!0 2 > ! 0
1 1
select 0<=!0, 0 <= !0;
0<=!0 0 <= !0
1 1
select 1<<!0, 1 << !0;
1<<!0 1 << !0
2 2
select 0<!0, 0 < ! 0;
0<!0 0 < ! 0
1 1

View File

@ -0,0 +1,24 @@
#
# Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND
#
# try to connect with wrong '--ssl-ca' path : should fail
ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed
# try to connect with correct '--ssl-ca' path : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
#
# Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
# PATH SUBSTITUTION
#
# try to connect with '--ssl-ca' option using tilde home directoy
# path substitution : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
# try to connect with '--ssl-key' option using tilde home directoy
# path substitution : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
# try to connect with '--ssl-cert' option using tilde home directoy
# path substitution : should connect
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA

View File

@ -440,6 +440,7 @@ select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
drop table t1; drop table t1;
# #
# MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
# MDEV-9972 Least function retuns date in date time format
# #
CREATE TABLE t1 ( CREATE TABLE t1 (
id BIGINT NOT NULL, id BIGINT NOT NULL,
@ -463,9 +464,9 @@ LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)),
IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin
FROM t1 LEFT JOIN t2 ON (t1.id=t2.id); FROM t1 LEFT JOIN t2 ON (t1.id=t2.id);
id date_debut date_fin id date_debut date_fin
1 2016-01-01 2016-01-31 00:00:00 1 2016-01-01 2016-01-31
2 2016-02-01 2016-01-28 00:00:00 2 2016-02-01 2016-01-28
3 2016-03-01 2016-03-31 00:00:00 3 2016-03-01 2016-03-31
4 2016-04-01 NULL 4 2016-04-01 NULL
DROP TABLE t1,t2; DROP TABLE t1,t2;
SELECT SELECT

View File

@ -1,82 +1,48 @@
set names utf8;
CREATE TABLE corrupt_bit_test_ā(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100),
c INT,
z INT,
INDEX(b))
ENGINE=InnoDB;
INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1);
CREATE UNIQUE INDEX idxā ON corrupt_bit_test_ā(c, b);
CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b);
SELECT * FROM corrupt_bit_test_ā;
a b c z a b c z
1 x 1 1 1 x 1 1
select @@unique_checks;
@@unique_checks
0
select @@innodb_change_buffering_debug;
@@innodb_change_buffering_debug
1
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā;
count(*) count(*)
1024 2
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1);
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
check table corrupt_bit_test_ā;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxā" is corrupted. test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: The B-tree of index "idxē" is corrupted. test.corrupt_bit_test_ā check Warning InnoDB: Index "idxā" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt test.corrupt_bit_test_ā check error Corrupt
select c from corrupt_bit_test_ā; ERROR HY000: Index "idx" is corrupted
ERROR HY000: Index "idx" is corrupted
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
show warnings;
Level Code Message Level Code Message
Warning 180 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted Warning 180 InnoDB: Index "idxē" for table "test"."corrupt_bit_test_ā" is marked as corrupted
Error 1712 Index corrupt_bit_test_ā is corrupted Error 1712 Index corrupt_bit_test_ā is corrupted
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
select * from corrupt_bit_test_ā use index(primary) where a = 10001;
a b c z a b c z
10001 a 20001 20001 10001 a 20001 20001
begin;
insert into corrupt_bit_test_ā values (10002, "a", 20002, 20002);
delete from corrupt_bit_test_ā where a = 10001;
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
rollback;
drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.corrupt_bit_test_ā check Warning InnoDB: Index "idx" is marked as corrupted
test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted test.corrupt_bit_test_ā check Warning InnoDB: Index "idxē" is marked as corrupted
test.corrupt_bit_test_ā check error Corrupt test.corrupt_bit_test_ā check error Corrupt
set names utf8;
select z from corrupt_bit_test_ā;
ERROR HY000: Index corrupt_bit_test_ā is corrupted ERROR HY000: Index corrupt_bit_test_ā is corrupted
drop index idxē on corrupt_bit_test_ā; Table Create Table
select z from corrupt_bit_test_ā limit 10; corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(100) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`z` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `idxē` (`z`,`b`),
KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
ERROR HY000: Index "idx" is corrupted
ERROR HY000: Index "idx" is corrupted
Table Create Table
corrupt_bit_test_ā CREATE TABLE `corrupt_bit_test_ā` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` char(100) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
`z` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `idx` (`b`)
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=latin1
z z
20001 20001
1 1
1
2 2
11
12
21
22
31
32
drop table corrupt_bit_test_ā;
DROP DATABASE pad;
SET GLOBAL innodb_change_buffering_debug = 0;

View File

@ -2,46 +2,24 @@
# Test for persistent corrupt bit for corrupted index and table # Test for persistent corrupt bit for corrupted index and table
# #
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_innodb_16k.inc #-- source include/have_innodb_16k.inc
-- source include/not_embedded.inc
# Issues with innodb_change_buffering_debug on Windows, so the test scenario
# cannot be created on windows
--source include/not_windows.inc
# This test needs debug server # This test needs debug server
--source include/have_debug.inc -- source include/have_debug.inc
-- disable_query_log -- disable_query_log
call mtr.add_suppression("Flagged corruption of idx.*in CHECK TABLE"); call mtr.add_suppression("Flagged corruption of idx.*in");
# This test setup is extracted from bug56680.test:
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
SET GLOBAL innodb_change_buffering_debug = 1;
# Turn off Unique Check to create corrupted index with dup key
SET UNIQUE_CHECKS=0;
CREATE DATABASE pad;
let $i=338;
while ($i)
{
--eval CREATE TABLE pad.t$i(a INT PRIMARY KEY)ENGINE=InnoDB;
dec $i;
}
-- enable_query_log
set names utf8; set names utf8;
SET UNIQUE_CHECKS=0;
CREATE TABLE corrupt_bit_test_ā( CREATE TABLE corrupt_bit_test_ā(
a INT AUTO_INCREMENT PRIMARY KEY, a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100), b CHAR(100),
c INT, c INT,
z INT, z INT,
INDEX(b)) INDEX idx(b))
ENGINE=InnoDB; ENGINE=InnoDB;
INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1); INSERT INTO corrupt_bit_test_ā VALUES(0,'x',1, 1);
@ -54,37 +32,20 @@ CREATE UNIQUE INDEX idxē ON corrupt_bit_test_ā(z, b);
SELECT * FROM corrupt_bit_test_ā; SELECT * FROM corrupt_bit_test_ā;
select @@unique_checks;
select @@innodb_change_buffering_debug;
# Create enough rows for the table, so that the insert buffer will be
# used for modifying the secondary index page. There must be multiple
# index pages, because changes to the root page are never buffered.
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā; INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1,z+1 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+10,z+10 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+20,z+20 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+50,z+50 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+100,z+100 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+200,z+200 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+400,z+400 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+800,z+800 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+1600,z+1600 FROM corrupt_bit_test_ā;
INSERT INTO corrupt_bit_test_ā SELECT 0,b,c+4000,z+4000 FROM corrupt_bit_test_ā;
select count(*) from corrupt_bit_test_ā; select count(*) from corrupt_bit_test_ā;
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c); # This will flag all secondary indexes corrupted
SET SESSION debug_dbug="+d,dict_set_index_corrupted";
# Create a dup key error on index "idxē" and "idxā" by inserting a dup value
INSERT INTO corrupt_bit_test_ā VALUES(13000,'x',1,1);
# creating an index should succeed even if other secondary indexes are corrupted
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
# Check table will find the unique indexes corrupted
# with dup key
check table corrupt_bit_test_ā; check table corrupt_bit_test_ā;
SET SESSION debug_dbug="";
# Cannot create new indexes while corrupted indexes exist
--error ER_INDEX_CORRUPT
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
--error ER_INDEX_CORRUPT
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
# This selection intend to use the corrupted index. Expect to fail # This selection intend to use the corrupted index. Expect to fail
-- error ER_INDEX_CORRUPT -- error ER_INDEX_CORRUPT
@ -109,7 +70,6 @@ delete from corrupt_bit_test_ā where a = 10001;
insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001); insert into corrupt_bit_test_ā values (10001, "a", 20001, 20001);
rollback; rollback;
# Drop one corrupted index before reboot
drop index idxā on corrupt_bit_test_ā; drop index idxā on corrupt_bit_test_ā;
check table corrupt_bit_test_ā; check table corrupt_bit_test_ā;
@ -119,14 +79,26 @@ set names utf8;
-- error ER_INDEX_CORRUPT -- error ER_INDEX_CORRUPT
select z from corrupt_bit_test_ā; select z from corrupt_bit_test_ā;
show create table corrupt_bit_test_ā;
# Drop the corrupted index # Drop the corrupted index
drop index idxē on corrupt_bit_test_ā; drop index idxē on corrupt_bit_test_ā;
# Cannot create new indexes while a corrupt index exists.
--error ER_INDEX_CORRUPT
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
--error ER_INDEX_CORRUPT
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
show create table corrupt_bit_test_ā;
drop index idx on corrupt_bit_test_ā;
# Now that there exist no corrupted indexes, we can create new indexes.
CREATE INDEX idx3 ON corrupt_bit_test_ā(b, c);
CREATE INDEX idx4 ON corrupt_bit_test_ā(b, z);
# Now select back to normal # Now select back to normal
select z from corrupt_bit_test_ā limit 10; select z from corrupt_bit_test_ā limit 10;
# Drop table # Drop table
drop table corrupt_bit_test_ā; drop table corrupt_bit_test_ā;
DROP DATABASE pad;
SET GLOBAL innodb_change_buffering_debug = 0;

View File

@ -113,7 +113,7 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARN
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest; SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
NULL NULL NULL 55 32 1 2 NULL NULL NULL 55 32 1 2
statements_digest b12e7d0f2ac88c8fad9ac8dabb347b09 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 0 0 0 statements_digest 52e3729216b72a67a671ac3b93a1f1d3 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 0 0 0
SHOW VARIABLES LIKE "performance_schema_digests_size"; SHOW VARIABLES LIKE "performance_schema_digests_size";
Variable_name Value Variable_name Value
performance_schema_digests_size 2 performance_schema_digests_size 2

View File

@ -37,7 +37,7 @@ select digest, digest_text, count_star
from performance_schema.events_statements_summary_by_digest from performance_schema.events_statements_summary_by_digest
where digest_text like "%in_%_digest%"; where digest_text like "%in_%_digest%";
digest digest_text count_star digest digest_text count_star
1281ed1e23aaa2e5528e90ebf98cfbdd SELECT ? AS `in_master_digest` 1 d4c0df8aac0e1b575629aad4534b5c7b SELECT ? AS `in_master_digest` 1
insert into test.marker values (2); insert into test.marker values (2);
**** On Slave **** **** On Slave ****
select * from test.marker; select * from test.marker;
@ -64,7 +64,7 @@ select digest, digest_text, count_star
from performance_schema.events_statements_summary_by_digest from performance_schema.events_statements_summary_by_digest
where digest_text like "%in_%_digest%"; where digest_text like "%in_%_digest%";
digest digest_text count_star digest digest_text count_star
e0d84aed3bfac675887b38c4902f057f SELECT ? AS `in_slave_digest` 1 aa6b10b84ad0f249ef4fcece8da6dd77 SELECT ? AS `in_slave_digest` 1
**** On Master **** **** On Master ****
delete from performance_schema.setup_objects delete from performance_schema.setup_objects
where object_schema='master'; where object_schema='master';

View File

@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
#################################### ####################################
SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long; SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
event_name digest digest_text sql_text event_name digest digest_text sql_text
statement/sql/truncate e1c917a43f978456fab15240f89372ca TRUNCATE TABLE truncate table events_statements_history_long statement/sql/truncate c4afa12dd9165da1a5fe8b74cf43005d TRUNCATE TABLE truncate table events_statements_history_long
statement/sql/select 4cc1c447d79877c4e8df0423fd0cde9a SELECT ? + ? + SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 statement/sql/select 719c3d02e550844d831d96809f405c39 SELECT ? + ? + SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1

View File

@ -112,41 +112,41 @@ DROP TRIGGER trg;
SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS, SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest; SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SUM_ROWS_AFFECTED SUM_WARNINGS SUM_ERRORS
statements_digest b12e7d0f2ac88c8fad9ac8dabb347b09 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 0 0 0 statements_digest 52e3729216b72a67a671ac3b93a1f1d3 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 0 0 0
statements_digest 390f3ff3444c4de44fcbd052b11caf4e SELECT ? FROM `t1` 2 0 0 0 statements_digest a76073841b59a83de0fcdb6a0158b94a SELECT ? FROM `t1` 2 0 0 0
statements_digest 8726524372f6e4924bbe1393b772498e SELECT ?, ... FROM `t1` 2 0 0 0 statements_digest d91813c4d7a128822624a55b43bab7b2 SELECT ?, ... FROM `t1` 2 0 0 0
statements_digest 5b06fb13fa9af5e8a4ec26bac8f994cd SELECT ? FROM `t2` 1 0 0 0 statements_digest 8d1d0319e2ce41e1c41455a06b8905f8 SELECT ? FROM `t2` 1 0 0 0
statements_digest 82201946968b4baca616292f96e933a7 SELECT ?, ... FROM `t2` 2 0 0 0 statements_digest 704f1e85525022d18028b3493bf61e65 SELECT ?, ... FROM `t2` 2 0 0 0
statements_digest 35d365779571257e8837f01b39dd9df5 INSERT INTO `t1` VALUES (?) 2 2 0 0 statements_digest 7f60599ab03830f5571b306d71e47ba3 INSERT INTO `t1` VALUES (?) 2 2 0 0
statements_digest eaaf6c26e98130ec21cfae1389e3eb94 INSERT INTO `t2` VALUES (?) 1 1 0 0 statements_digest 103d388f122df6a6a2c9f7fa01d90d7d INSERT INTO `t2` VALUES (?) 1 1 0 0
statements_digest 28f3cfdcfffeff3219bdd255ed15e6ac INSERT INTO `t3` VALUES (...) 4 4 0 0 statements_digest f1f56fda9303c1e2555bd67d431398ab INSERT INTO `t3` VALUES (...) 4 4 0 0
statements_digest 166a9591b81371a6ea389f27cfc1e5fd INSERT INTO `t4` VALUES (...) 1 1 0 0 statements_digest 08fc8813613c3cd44736a4abbb0cd095 INSERT INTO `t4` VALUES (...) 1 1 0 0
statements_digest fb25b9f9146120fb72c3c732e79dcc82 INSERT INTO `t5` VALUES (...) 1 1 0 0 statements_digest ab209b79451b94d03d8e20374ec18795 INSERT INTO `t5` VALUES (...) 1 1 0 0
statements_digest 58bb7798d974224ff08742502eed1aae INSERT INTO `t1` VALUES (?) /* , ... */ 2 7 0 0 statements_digest 4729eb58cad3b77435bcd17864cfe322 INSERT INTO `t1` VALUES (?) /* , ... */ 2 7 0 0
statements_digest 3352b44dcaf21f59141ea76b5cace5c0 INSERT INTO `t3` VALUES (...) /* , ... */ 1 3 0 0 statements_digest 8e543c7785feeeb3e9a1957397a1033f INSERT INTO `t3` VALUES (...) /* , ... */ 1 3 0 0
statements_digest 1905c012e5d6a3a12e39b0b3ce13b22a INSERT INTO `t5` VALUES (...) /* , ... */ 1 3 0 0 statements_digest 3dd587a1c42991bb323cbaa4c6fb61d0 INSERT INTO `t5` VALUES (...) /* , ... */ 1 3 0 0
statements_digest 981d682c1e63b437c33230eb558d0f64 INSERT INTO `t6` VALUES (...) 5 5 0 0 statements_digest 6f2f9f471f739d16b4ff4faf256e839e INSERT INTO `t6` VALUES (...) 5 5 0 0
statements_digest aeb185ab9b6e9d5a49e47c8741b8acdf SELECT ? + ? 3 0 0 0 statements_digest 9701bfa1fb64563334f1a52953e065f3 SELECT ? + ? 3 0 0 0
statements_digest d3804664eeee11407f3fcbd5c29a1f73 SELECT ? 1 0 0 0 statements_digest b0785a540ffc1743c4e0879d193a4b10 SELECT ? 1 0 0 0
statements_digest 6382c1dfc79755af2dd46113acea142b CREATE SCHEMA `statements_digest_temp` 2 2 0 0 statements_digest bee0eebfc340dbd233ee8c86270ac6ea CREATE SCHEMA `statements_digest_temp` 2 2 0 0
statements_digest 256f8dfc97d90a79103ebd6616b8d7aa DROP SCHEMA `statements_digest_temp` 2 0 0 0 statements_digest a35fd3ac67e64b9ac41a53781a7f5662 DROP SCHEMA `statements_digest_temp` 2 0 0 0
statements_digest 5315d33e7ef87b104b73912d484af6a3 SELECT ? FROM `no_such_table` 1 0 0 1 statements_digest 52ec0213cba551f38d069c94a50cd2c7 SELECT ? FROM `no_such_table` 1 0 0 1
statements_digest dcde8f720a419aa5d52246207268cf6c CREATE TABLE `dup_table` ( `c` CHARACTER (?) ) 2 0 0 1 statements_digest 27d4298be49de7a7606fcc8122ce7cd6 CREATE TABLE `dup_table` ( `c` CHARACTER (?) ) 2 0 0 1
statements_digest b4b4abab3f030642444fb32c44f28058 DROP TABLE `dup_table` 1 0 0 0 statements_digest 8a9b185842f12475c7ffa350ade45408 DROP TABLE `dup_table` 1 0 0 0
statements_digest a34ed519fdeb4fe4460038db92ea0c20 INSERT INTO `t11` VALUES (?) 1 1 1 0 statements_digest bda68c0a1eca7b625a5158da41ebbcf9 INSERT INTO `t11` VALUES (?) 1 1 1 0
statements_digest d3eda26b379bd56340ce84fe395dfff7 SHOW WARNINGS 1 0 0 0 statements_digest 196c9f451360b5e24e03aa82f86006ae SHOW WARNINGS 1 0 0 0
statements_digest e6aa634cf5a630087fefe9868b018329 PREPARE `stmt` FROM ? 1 0 0 0 statements_digest 3413dd64a34c2148e669e3283ca41ff5 PREPARE `stmt` FROM ? 1 0 0 0
statements_digest 4de34527c0dfef6ad8387d4359f78c78 EXECUTE `stmt` 2 0 0 0 statements_digest fcec9dcf45c26dabade2c7a4ab818543 EXECUTE `stmt` 2 0 0 0
statements_digest 54592849b6cf7386568c88e7fb20f61e DEALLOCATE PREPARE `stmt` 1 0 0 0 statements_digest 9e5e4f78f8226cc853fa1ce62ae61f9d DEALLOCATE PREPARE `stmt` 1 0 0 0
statements_digest ee90db91a06cedfbcccf80f951dc58cd CREATE PROCEDURE `p1` ( ) BEGIN SELECT * FROM `t12` ; END 1 0 0 0 statements_digest c92f30dceb52f470a6c36400bdb372c6 CREATE PROCEDURE `p1` ( ) BEGIN SELECT * FROM `t12` ; END 1 0 0 0
statements_digest f964655a0037d2f194030bd024eab748 CALL `p1` ( ) 2 0 0 0 statements_digest db338b4f4a13d74acda7a7b9dae2b0b4 CALL `p1` ( ) 2 0 0 0
statements_digest 788d8223f67ba10d1b97fcaa42fec081 DROP PROCEDURE `p1` 1 0 0 0 statements_digest c2c92e9e7ac73741622d1f264e08c384 DROP PROCEDURE `p1` 1 0 0 0
statements_digest 5146273ef7d98ee1954d23fd98a35d68 CREATE FUNCTION `func` ( `a` INTEGER , `b` INTEGER ) RETURNS INTEGER (?) RETURN `a` + `b` 1 0 0 0 statements_digest c99aad5579088b31cdd53be4bfbc2b6e CREATE FUNCTION `func` ( `a` INTEGER , `b` INTEGER ) RETURNS INTEGER (?) RETURN `a` + `b` 1 0 0 0
statements_digest 2c9b8e1e7f2ad3ca3c49abb2ea30e871 SELECT `func` (...) 2 0 0 0 statements_digest 1f4ce8758787f5aa5f51f1ee7f3b8119 SELECT `func` (...) 2 0 0 0
statements_digest f48e30910f8e7758b818c088916424cd DROP FUNCTION `func` 1 0 0 0 statements_digest ab76a0821015fa000a1df9c684072e37 DROP FUNCTION `func` 1 0 0 0
statements_digest 53ccf1d241eeb749f1e1b7becc65006f CREATE TRIGGER `trg` BEFORE INSERT ON `t12` FOR EACH ROW SET @? := ? 1 0 0 0 statements_digest ce5db6554a357045978a5572c84a7655 CREATE TRIGGER `trg` BEFORE INSERT ON `t12` FOR EACH ROW SET @? := ? 1 0 0 0
statements_digest a9722a0717a57275431575c7204d71c1 INSERT INTO `t12` VALUES (?) 2 2 0 0 statements_digest 801f02819c67e56fe3f22cc7dda99707 INSERT INTO `t12` VALUES (?) 2 2 0 0
statements_digest 2d48809e6899f63ec304776466a63eef DROP TRIGGER `trg` 1 0 0 0 statements_digest dc3b07fe8e4d5fa91b383605f18512b0 DROP TRIGGER `trg` 1 0 0 0
#################################### ####################################
# CLEANUP # CLEANUP
#################################### ####################################

View File

@ -125,41 +125,41 @@ DROP TRIGGER trg;
#################################### ####################################
SELECT schema_name, digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest; SELECT schema_name, digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
schema_name digest digest_text count_star schema_name digest digest_text count_star
statements_digest b12e7d0f2ac88c8fad9ac8dabb347b09 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 statements_digest 52e3729216b72a67a671ac3b93a1f1d3 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
statements_digest 390f3ff3444c4de44fcbd052b11caf4e SELECT ? FROM `t1` 2 statements_digest a76073841b59a83de0fcdb6a0158b94a SELECT ? FROM `t1` 2
statements_digest 8726524372f6e4924bbe1393b772498e SELECT ?, ... FROM `t1` 2 statements_digest d91813c4d7a128822624a55b43bab7b2 SELECT ?, ... FROM `t1` 2
statements_digest 5b06fb13fa9af5e8a4ec26bac8f994cd SELECT ? FROM `t2` 1 statements_digest 8d1d0319e2ce41e1c41455a06b8905f8 SELECT ? FROM `t2` 1
statements_digest 82201946968b4baca616292f96e933a7 SELECT ?, ... FROM `t2` 2 statements_digest 704f1e85525022d18028b3493bf61e65 SELECT ?, ... FROM `t2` 2
statements_digest 35d365779571257e8837f01b39dd9df5 INSERT INTO `t1` VALUES (?) 2 statements_digest 7f60599ab03830f5571b306d71e47ba3 INSERT INTO `t1` VALUES (?) 2
statements_digest eaaf6c26e98130ec21cfae1389e3eb94 INSERT INTO `t2` VALUES (?) 1 statements_digest 103d388f122df6a6a2c9f7fa01d90d7d INSERT INTO `t2` VALUES (?) 1
statements_digest 28f3cfdcfffeff3219bdd255ed15e6ac INSERT INTO `t3` VALUES (...) 4 statements_digest f1f56fda9303c1e2555bd67d431398ab INSERT INTO `t3` VALUES (...) 4
statements_digest 166a9591b81371a6ea389f27cfc1e5fd INSERT INTO `t4` VALUES (...) 1 statements_digest 08fc8813613c3cd44736a4abbb0cd095 INSERT INTO `t4` VALUES (...) 1
statements_digest fb25b9f9146120fb72c3c732e79dcc82 INSERT INTO `t5` VALUES (...) 1 statements_digest ab209b79451b94d03d8e20374ec18795 INSERT INTO `t5` VALUES (...) 1
statements_digest 58bb7798d974224ff08742502eed1aae INSERT INTO `t1` VALUES (?) /* , ... */ 2 statements_digest 4729eb58cad3b77435bcd17864cfe322 INSERT INTO `t1` VALUES (?) /* , ... */ 2
statements_digest 3352b44dcaf21f59141ea76b5cace5c0 INSERT INTO `t3` VALUES (...) /* , ... */ 1 statements_digest 8e543c7785feeeb3e9a1957397a1033f INSERT INTO `t3` VALUES (...) /* , ... */ 1
statements_digest 1905c012e5d6a3a12e39b0b3ce13b22a INSERT INTO `t5` VALUES (...) /* , ... */ 1 statements_digest 3dd587a1c42991bb323cbaa4c6fb61d0 INSERT INTO `t5` VALUES (...) /* , ... */ 1
statements_digest 981d682c1e63b437c33230eb558d0f64 INSERT INTO `t6` VALUES (...) 5 statements_digest 6f2f9f471f739d16b4ff4faf256e839e INSERT INTO `t6` VALUES (...) 5
statements_digest aeb185ab9b6e9d5a49e47c8741b8acdf SELECT ? + ? 3 statements_digest 9701bfa1fb64563334f1a52953e065f3 SELECT ? + ? 3
statements_digest d3804664eeee11407f3fcbd5c29a1f73 SELECT ? 1 statements_digest b0785a540ffc1743c4e0879d193a4b10 SELECT ? 1
statements_digest 6382c1dfc79755af2dd46113acea142b CREATE SCHEMA `statements_digest_temp` 2 statements_digest bee0eebfc340dbd233ee8c86270ac6ea CREATE SCHEMA `statements_digest_temp` 2
statements_digest 256f8dfc97d90a79103ebd6616b8d7aa DROP SCHEMA `statements_digest_temp` 2 statements_digest a35fd3ac67e64b9ac41a53781a7f5662 DROP SCHEMA `statements_digest_temp` 2
statements_digest 5315d33e7ef87b104b73912d484af6a3 SELECT ? FROM `no_such_table` 1 statements_digest 52ec0213cba551f38d069c94a50cd2c7 SELECT ? FROM `no_such_table` 1
statements_digest dcde8f720a419aa5d52246207268cf6c CREATE TABLE `dup_table` ( `c` CHARACTER (?) ) 2 statements_digest 27d4298be49de7a7606fcc8122ce7cd6 CREATE TABLE `dup_table` ( `c` CHARACTER (?) ) 2
statements_digest b4b4abab3f030642444fb32c44f28058 DROP TABLE `dup_table` 1 statements_digest 8a9b185842f12475c7ffa350ade45408 DROP TABLE `dup_table` 1
statements_digest a34ed519fdeb4fe4460038db92ea0c20 INSERT INTO `t11` VALUES (?) 1 statements_digest bda68c0a1eca7b625a5158da41ebbcf9 INSERT INTO `t11` VALUES (?) 1
statements_digest d3eda26b379bd56340ce84fe395dfff7 SHOW WARNINGS 1 statements_digest 196c9f451360b5e24e03aa82f86006ae SHOW WARNINGS 1
statements_digest e6aa634cf5a630087fefe9868b018329 PREPARE `stmt` FROM ? 1 statements_digest 3413dd64a34c2148e669e3283ca41ff5 PREPARE `stmt` FROM ? 1
statements_digest 4de34527c0dfef6ad8387d4359f78c78 EXECUTE `stmt` 2 statements_digest fcec9dcf45c26dabade2c7a4ab818543 EXECUTE `stmt` 2
statements_digest 54592849b6cf7386568c88e7fb20f61e DEALLOCATE PREPARE `stmt` 1 statements_digest 9e5e4f78f8226cc853fa1ce62ae61f9d DEALLOCATE PREPARE `stmt` 1
statements_digest ee90db91a06cedfbcccf80f951dc58cd CREATE PROCEDURE `p1` ( ) BEGIN SELECT * FROM `t12` ; END 1 statements_digest c92f30dceb52f470a6c36400bdb372c6 CREATE PROCEDURE `p1` ( ) BEGIN SELECT * FROM `t12` ; END 1
statements_digest f964655a0037d2f194030bd024eab748 CALL `p1` ( ) 2 statements_digest db338b4f4a13d74acda7a7b9dae2b0b4 CALL `p1` ( ) 2
statements_digest 788d8223f67ba10d1b97fcaa42fec081 DROP PROCEDURE `p1` 1 statements_digest c2c92e9e7ac73741622d1f264e08c384 DROP PROCEDURE `p1` 1
statements_digest 5146273ef7d98ee1954d23fd98a35d68 CREATE FUNCTION `func` ( `a` INTEGER , `b` INTEGER ) RETURNS INTEGER (?) RETURN `a` + `b` 1 statements_digest c99aad5579088b31cdd53be4bfbc2b6e CREATE FUNCTION `func` ( `a` INTEGER , `b` INTEGER ) RETURNS INTEGER (?) RETURN `a` + `b` 1
statements_digest 2c9b8e1e7f2ad3ca3c49abb2ea30e871 SELECT `func` (...) 2 statements_digest 1f4ce8758787f5aa5f51f1ee7f3b8119 SELECT `func` (...) 2
statements_digest f48e30910f8e7758b818c088916424cd DROP FUNCTION `func` 1 statements_digest ab76a0821015fa000a1df9c684072e37 DROP FUNCTION `func` 1
statements_digest 53ccf1d241eeb749f1e1b7becc65006f CREATE TRIGGER `trg` BEFORE INSERT ON `t12` FOR EACH ROW SET @? := ? 1 statements_digest ce5db6554a357045978a5572c84a7655 CREATE TRIGGER `trg` BEFORE INSERT ON `t12` FOR EACH ROW SET @? := ? 1
statements_digest a9722a0717a57275431575c7204d71c1 INSERT INTO `t12` VALUES (?) 2 statements_digest 801f02819c67e56fe3f22cc7dda99707 INSERT INTO `t12` VALUES (?) 2
statements_digest 2d48809e6899f63ec304776466a63eef DROP TRIGGER `trg` 1 statements_digest dc3b07fe8e4d5fa91b383605f18512b0 DROP TRIGGER `trg` 1
SELECT digest, digest_text FROM performance_schema.events_statements_current; SELECT digest, digest_text FROM performance_schema.events_statements_current;
digest digest_text digest digest_text
#################################### ####################################

View File

@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
#################################### ####################################
SELECT schema_name, digest, digest_text, count_star FROM events_statements_summary_by_digest; SELECT schema_name, digest, digest_text, count_star FROM events_statements_summary_by_digest;
schema_name digest digest_text count_star schema_name digest digest_text count_star
performance_schema b6650e3f746acc31ef465aede8087e93 TRUNCATE TABLE `events_statements_summary_by_digest` 1 performance_schema 2f6bc98e6ca82311b17aac2f1e7cd85d TRUNCATE TABLE `events_statements_summary_by_digest` 1
performance_schema 63f9aaeed7859671c6a42c75fcd43785 SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? 1 performance_schema 6c4b347800e3aa6bd3e41e3b97b3828a SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? 1

View File

@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1 = PASSWORD('pwd 098');
SET PASSWORD FOR u1=<secret>; SET PASSWORD FOR u1=<secret>;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=<secret>' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<secret>' at line 1
CREATE USER u3 IDENTIFIED BY ''; CREATE USER u3 IDENTIFIED BY '';
drop user u1, u2, u3; drop user u1, u2, u3;
select 2; select 2;

View File

@ -165,7 +165,7 @@ CREATE USER u1 IDENTIFIED BY 'pwd-123';
GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321"; GRANT ALL ON sa_db TO u2 IDENTIFIED BY "pwd-321";
SET PASSWORD FOR u1 = PASSWORD('pwd 098'); SET PASSWORD FOR u1 = PASSWORD('pwd 098');
SET PASSWORD FOR u1=<secret>; SET PASSWORD FOR u1=<secret>;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=<secret>' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '<secret>' at line 1
CREATE USER u3 IDENTIFIED BY ''; CREATE USER u3 IDENTIFIED BY '';
drop user u1, u2, u3; drop user u1, u2, u3;
select 2; select 2;

View File

@ -220,7 +220,6 @@ SET character_set_connection = utf8;
CREATE TABLE t1 ( a VARCHAR(1) ); CREATE TABLE t1 ( a VARCHAR(1) );
INSERT INTO t1 VALUES ('m'),('n'); INSERT INTO t1 VALUES ('m'),('n');
CREATE VIEW v1 AS SELECT 'w' ; CREATE VIEW v1 AS SELECT 'w' ;
--error ER_CANT_AGGREGATE_2COLLATIONS
SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 ); SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
drop view v1; drop view v1;
drop table t1; drop table t1;
@ -228,3 +227,30 @@ SET character_set_connection = default;
SET optimizer_switch= default; SET optimizer_switch= default;
--echo #End of 5.3 tests --echo #End of 5.3 tests
--echo #
--echo # Start of 5.5 tests
--echo #
--echo #
--echo # MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
--echo #
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('A'),('a'),('B'),('b');
CREATE VIEW v1 AS SELECT 'a';
SELECT * FROM v1,t1 where t1.a=v1.a;
DROP VIEW v1;
DROP TABLE t1;
SET NAMES utf8;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
INSERT INTO t1 VALUES ('a'),('b'),('c');
CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b';
SELECT * FROM v1,t1 WHERE t1.a=v1.a;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #

View File

@ -1677,6 +1677,29 @@ ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8;
SELECT OCTET_LENGTH(a),a FROM t1; SELECT OCTET_LENGTH(a),a FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
--echo #
--echo #
SET NAMES utf8;
SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data;
SELECT length(data) AS len FROM (
SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data
) AS sub;
SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data;
SELECT length(data) AS len FROM (
SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data
) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub;
SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #

View File

@ -1821,6 +1821,26 @@ SELECT OCTET_LENGTH(a),a FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
--echo #
--echo #
SET NAMES utf8mb4;
SELECT length(repeat(_utf8mb4 0xE29883, 21844)) AS data;
SELECT length(data) AS len
FROM ( SELECT repeat(_utf8mb4 0xE29883, 21844) AS data ) AS sub;
SELECT length(repeat(_utf8mb4 0xE29883, 21846)) AS data;
SELECT length(data) AS len
FROM ( SELECT repeat(_utf8mb4 0xE29883, 21846) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21844) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21845) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #

View File

@ -41,3 +41,24 @@ UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3;
UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3; UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3;
DROP TABLE t2, t1; DROP TABLE t2, t1;
--echo #
--echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN
--echo # KEY CONSTRAINT
CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB;
CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL,
CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB;
--echo # Without patch, reports incorrect error.
--error ER_NO_REFERENCED_ROW_2
INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
--error ER_NO_REFERENCED_ROW_2
REPLACE INTO t2 VALUES('abc', 2);
--enable_warnings
INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
--disable_warnings
DROP TABLE t2, t1;

View File

@ -64,6 +64,25 @@ SELECT monthname('2001-01-01');
SELECT monthname('2001-02-01'); SELECT monthname('2001-02-01');
SELECT monthname('2001-03-01'); SELECT monthname('2001-03-01');
--echo #
--echo # MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
--echo #
SET NAMES utf8;
CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
INSERT INTO t1 VALUES ('test',now());
SET lc_time_names=ru_RU;
--error ER_CANT_AGGREGATE_2COLLATIONS
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
--error ER_CANT_AGGREGATE_2COLLATIONS
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
SET lc_time_names=en_US;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
SET NAMES latin1;
SELECT c FROM t1 WHERE DAYNAME(d)<>c;
SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
DROP TABLE t1;
--echo # --echo #
--echo # Start of 5.6 tests --echo # Start of 5.6 tests
--echo # --echo #

View File

@ -350,6 +350,11 @@ create table t1(a int);
drop view v1; drop view v1;
drop table t1; drop table t1;
create table `#mysql50#t1``1` (a int) engine=myisam;
--exec $MYSQL_CHECK --fix-table-names --databases test
show tables;
drop table `t1``1`;
--echo # --echo #
--echo #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck --echo #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck
--echo # --echo #

View File

@ -758,3 +758,15 @@ CREATE TABLE t1 (s VARCHAR(100));
CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
SET default_storage_engine = NEW.INNODB; SET default_storage_engine = NEW.INNODB;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-8328 Evaluation of two "!" operators depends on space in beetween
#
--error ER_PARSE_ERROR
select 0==0;
select 1=!0, 1 = ! 0;
select !!0, ! ! 0;
select 2>!0, 2 > ! 0;
select 0<=!0, 0 <= !0;
select 1<<!0, 1 << !0;
select 0<!0, 0 < ! 0;

36
mysql-test/t/ssl_ca.test Normal file
View File

@ -0,0 +1,36 @@
--source include/have_ssl_communication.inc
--source include/not_embedded.inc
--echo #
--echo # Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND
--echo #
--echo # try to connect with wrong '--ssl-ca' path : should fail
--error 1
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
--echo # try to connect with correct '--ssl-ca' path : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
--echo #
--echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
--echo # PATH SUBSTITUTION
--echo #
--let $mysql_test_dir_path= `SELECT IF(LENGTH('$HOME'), REPLACE('=$MYSQL_TEST_DIR', '=$HOME', '=~'), '=$MYSQL_TEST_DIR')`
--echo # try to connect with '--ssl-ca' option using tilde home directoy
--echo # path substitution : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
--echo # try to connect with '--ssl-key' option using tilde home directoy
--echo # path substitution : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"
--echo # try to connect with '--ssl-cert' option using tilde home directoy
--echo # path substitution : should connect
--replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'"

View File

@ -387,6 +387,7 @@ drop table t1;
--echo # --echo #
--echo # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null --echo # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
--echo # MDEV-9972 Least function retuns date in date time format
--echo # --echo #
CREATE TABLE t1 ( CREATE TABLE t1 (
id BIGINT NOT NULL, id BIGINT NOT NULL,

View File

@ -19,36 +19,6 @@
# Suppress some common (not fatal) errors in system libraries found by valgrind # Suppress some common (not fatal) errors in system libraries found by valgrind
# #
#
# Pthread doesn't free all thread specific memory before program exists
#
{
pthread allocate_tls memory loss
Memcheck:Leak
fun:calloc
fun:_dl_allocate_tls
fun:allocate_stack
fun:pthread_create*
}
{
pthread allocate_tls memory loss
Memcheck:Leak
fun:calloc
fun:_dl_allocate_tls
fun:pthread_create*
}
{
pthread allocate_tls memory loss
Memcheck:Leak
fun:calloc
obj:/lib*/ld*.so
fun:_dl_allocate_tls
fun:pthread_create*
}
{ {
pthead_exit memory loss 1 pthead_exit memory loss 1
Memcheck:Leak Memcheck:Leak
@ -89,43 +59,6 @@
fun:_dl_map_object_from_fd fun:_dl_map_object_from_fd
} }
{
pthread allocate_dtv memory loss
Memcheck:Leak
fun:calloc
fun:allocate_dtv
fun:_dl_allocate_tls_storage
fun:__GI__dl_allocate_tls
fun:pthread_create
}
{
pthread allocate_dtv memory loss second
Memcheck:Leak
fun:calloc
fun:allocate_dtv
fun:_dl_allocate_tls
fun:pthread_create*
}
{
pthread memalign memory loss
Memcheck:Leak
fun:memalign
fun:_dl_allocate_tls_storage
fun:__GI__dl_allocate_tls
fun:pthread_create
}
{
pthread memalign memory loss2
Memcheck:Leak
fun:memalign
fun:tls_get_addr_tail
...
fun:*ha_initialize_handlerton*
}
{ {
pthread pthread_key_create pthread pthread_key_create
Memcheck:Leak Memcheck:Leak
@ -1012,18 +945,6 @@
fun:nptl_pthread_exit_hack_handler fun:nptl_pthread_exit_hack_handler
} }
#
# Pthread doesn't free all thread specific memory before program exists
#
{
pthread allocate_tls memory loss in 2.6.1.
Memcheck:Leak
fun:calloc
obj:*/ld-*.so
fun:_dl_allocate_tls
fun:pthread_create*
}
{ {
memory "leak" in backtrace() of glibc 2.9 (not present in 2.13) memory "leak" in backtrace() of glibc 2.9 (not present in 2.13)
Memcheck:Leak Memcheck:Leak
@ -1176,6 +1097,23 @@
fun:gethostbyaddr_r fun:gethostbyaddr_r
} }
#
# Detached threads may not complete deiniitialization by the time shutdown
# thread calls exit. This is unfortunate property of detached threads, which
# we currently can only ignore. Unfortunately there is no way to distinguish
# between false positives generated by detached threads and real memory leaks
# generated by not joined joinable threads. So we hide both cases.
#
# To avoid enumeration of the whole variety of possible traces we ignore all
# "possibly lost" blocks allocated by pthread_create (and it's callees).
#
{
Detached threads memory loss
Memcheck:Leak
match-leak-kinds:possible
...
fun:pthread_create*
}
{ {
ConnectSE: unixODBC SQLAllocEnv leaves some "still reachable" pointers ConnectSE: unixODBC SQLAllocEnv leaves some "still reachable" pointers
@ -1289,3 +1227,4 @@
fun:_dlerror_run fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5 fun:dlopen@@GLIBC_2.2.5
} }

View File

@ -1,6 +1,5 @@
/* /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2000, 2013, Oracle and/or its affiliates Copyright (c) 2009, 2016, MariaDB
Copyright (c) 1995, 2013, Monty Program Ab
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -1873,6 +1873,7 @@ void die(const char* fmt, ...)
fprintf(stderr,"Error:"); fprintf(stderr,"Error:");
vfprintf(stderr, fmt,va_args); vfprintf(stderr, fmt,va_args);
fprintf(stderr,", errno=%d\n", errno); fprintf(stderr,", errno=%d\n", errno);
va_end(va_args);
exit(1); exit(1);
} }

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -169,7 +169,9 @@ static int do_test()
for (j=0 ; j < 1000 ; j++) for (j=0 ; j < 1000 ; j++)
if (key1[j] > 1) if (key1[j] > 1)
break; break;
if (key1[j] > 1) // j will be 1000 only if we have no keys in the hash. This only happens
// when the parameter recant is set to 0 via command line argument.
if (j < 1000 && key1[j] > 1)
{ {
HASH_SEARCH_STATE state; HASH_SEARCH_STATE state;
printf("- Testing identical read\n"); printf("- Testing identical read\n");

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -190,6 +190,7 @@ int Url_http::send(const char* data, size_t data_length)
break; break;
closesocket(fd); closesocket(fd);
fd= INVALID_SOCKET;
} }
freeaddrinfo(addrs); freeaddrinfo(addrs);

View File

@ -17,7 +17,7 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301, USA # MA 02110-1301, USA
# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public
@ -621,7 +621,11 @@ sub my_which
my ($command) = @_; my ($command) = @_;
my (@paths, $path); my (@paths, $path);
return $command if (-f $command && -x $command); # If the argument is not 'my_print_defaults' then it would be of the format
# <absolute_path>/<program>
return $command if ($command ne 'my_print_defaults' && -f $command &&
-x $command);
@paths = split(':', $ENV{'PATH'}); @paths = split(':', $ENV{'PATH'});
foreach $path (@paths) foreach $path (@paths)
{ {

View File

@ -1045,28 +1045,44 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
} while (0) } while (0)
#define EXTENSION_SET_STRING(OPTS, X, STR) \ #define EXTENSION_SET_STRING_X(OPTS, X, STR, dup) \
do { \ do { \
if ((OPTS)->extension) \ if ((OPTS)->extension) \
my_free((OPTS)->extension->X); \ my_free((OPTS)->extension->X); \
else \ else \
ALLOCATE_EXTENSIONS(OPTS); \ ALLOCATE_EXTENSIONS(OPTS); \
(OPTS)->extension->X= ((STR) != NULL) ? \ (OPTS)->extension->X= ((STR) != NULL) ? \
my_strdup((STR), MYF(MY_WME)) : NULL; \ dup((STR), MYF(MY_WME)) : NULL; \
} while (0) } while (0)
#define EXTENSION_SET_STRING(OPTS, X, STR) \
EXTENSION_SET_STRING_X(OPTS, X, STR, my_strdup)
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
#define SET_SSL_OPTION(OPTS, opt_var, arg) \ #define SET_SSL_OPTION_X(OPTS, opt_var, arg, dup) \
my_free((OPTS)->opt_var); \ my_free((OPTS)->opt_var); \
(OPTS)->opt_var= arg ? my_strdup(arg, MYF(MY_WME)) : NULL; (OPTS)->opt_var= arg ? dup(arg, MYF(MY_WME)) : NULL;
#define EXTENSION_SET_SSL_STRING(OPTS, X, STR) \ #define EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, dup) \
EXTENSION_SET_STRING((OPTS), X, (STR)); EXTENSION_SET_STRING_X((OPTS), X, (STR), dup);
static char *set_ssl_option_unpack_path(const char *arg, myf flags)
{
char buff[FN_REFLEN + 1];
unpack_filename(buff, (char *)arg);
return my_strdup(buff, flags);
}
#else #else
#define SET_SSL_OPTION(OPTS, opt_var,arg) do { } while(0) #define SET_SSL_OPTION_X(OPTS, opt_var,arg, dup) do { } while(0)
#define EXTENSION_SET_SSL_STRING(OPTS, X, STR) do { } while(0) #define EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, dup) do { } while(0)
#endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */ #endif /* defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) */
#define SET_SSL_OPTION(OPTS, opt_var,arg) SET_SSL_OPTION_X(OPTS, opt_var, arg, my_strdup)
#define EXTENSION_SET_SSL_STRING(OPTS, X, STR) EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, my_strdup)
#define SET_SSL_PATH_OPTION(OPTS, opt_var,arg) SET_SSL_OPTION_X(OPTS, opt_var, arg, set_ssl_option_unpack_path)
#define EXTENSION_SET_SSL_PATH_STRING(OPTS, X, STR) EXTENSION_SET_SSL_STRING_X(OPTS, X, STR, set_ssl_option_unpack_path)
void mysql_read_default_options(struct st_mysql_options *options, void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group) const char *filename,const char *group)
{ {
@ -4373,25 +4389,25 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
mysql->net.vio->async_context= ctxt; mysql->net.vio->async_context= ctxt;
break; break;
case MYSQL_OPT_SSL_KEY: case MYSQL_OPT_SSL_KEY:
SET_SSL_OPTION(&mysql->options,ssl_key, arg); SET_SSL_PATH_OPTION(&mysql->options,ssl_key, arg);
break; break;
case MYSQL_OPT_SSL_CERT: case MYSQL_OPT_SSL_CERT:
SET_SSL_OPTION(&mysql->options, ssl_cert, arg); SET_SSL_PATH_OPTION(&mysql->options, ssl_cert, arg);
break; break;
case MYSQL_OPT_SSL_CA: case MYSQL_OPT_SSL_CA:
SET_SSL_OPTION(&mysql->options,ssl_ca, arg); SET_SSL_PATH_OPTION(&mysql->options,ssl_ca, arg);
break; break;
case MYSQL_OPT_SSL_CAPATH: case MYSQL_OPT_SSL_CAPATH:
SET_SSL_OPTION(&mysql->options,ssl_capath, arg); SET_SSL_PATH_OPTION(&mysql->options,ssl_capath, arg);
break; break;
case MYSQL_OPT_SSL_CIPHER: case MYSQL_OPT_SSL_CIPHER:
SET_SSL_OPTION(&mysql->options,ssl_cipher, arg); SET_SSL_OPTION(&mysql->options,ssl_cipher, arg);
break; break;
case MYSQL_OPT_SSL_CRL: case MYSQL_OPT_SSL_CRL:
EXTENSION_SET_SSL_STRING(&mysql->options, ssl_crl, arg); EXTENSION_SET_SSL_PATH_STRING(&mysql->options, ssl_crl, arg);
break; break;
case MYSQL_OPT_SSL_CRLPATH: case MYSQL_OPT_SSL_CRLPATH:
EXTENSION_SET_SSL_STRING(&mysql->options, ssl_crlpath, arg); EXTENSION_SET_SSL_PATH_STRING(&mysql->options, ssl_crlpath, arg);
break; break;
case MYSQL_OPT_CONNECT_ATTR_RESET: case MYSQL_OPT_CONNECT_ATTR_RESET:
ENSURE_EXTENSIONS_PRESENT(&mysql->options); ENSURE_EXTENSIONS_PRESENT(&mysql->options);

View File

@ -1816,6 +1816,7 @@ Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
if (charset_arg->state & MY_CS_BINSORT) if (charset_arg->state & MY_CS_BINSORT)
flags|=BINARY_FLAG; flags|=BINARY_FLAG;
field_derivation= DERIVATION_IMPLICIT; field_derivation= DERIVATION_IMPLICIT;
field_repertoire= my_charset_repertoire(charset_arg);
} }

View File

@ -884,11 +884,12 @@ public:
matches collation of the field (needed only for real string types). matches collation of the field (needed only for real string types).
*/ */
virtual bool match_collation_to_optimize_range() const { return false; } virtual bool match_collation_to_optimize_range() const { return false; }
virtual void set_charset(CHARSET_INFO *charset_arg) { }
virtual enum Derivation derivation(void) const virtual enum Derivation derivation(void) const
{ return DERIVATION_IMPLICIT; } { return DERIVATION_IMPLICIT; }
virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; } virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; }
virtual void set_derivation(enum Derivation derivation_arg) { } virtual void set_derivation(enum Derivation derivation_arg,
uint repertoire_arg)
{ }
virtual int set_time() { return 1; } virtual int set_time() { return 1; }
bool set_warning(Sql_condition::enum_warning_level, unsigned int code, bool set_warning(Sql_condition::enum_warning_level, unsigned int code,
int cuted_increment) const; int cuted_increment) const;
@ -1132,8 +1133,10 @@ public:
class Field_str :public Field { class Field_str :public Field {
protected: protected:
// TODO-10.2: Reuse DTCollation instead of these three members
CHARSET_INFO *field_charset; CHARSET_INFO *field_charset;
enum Derivation field_derivation; enum Derivation field_derivation;
uint field_repertoire;
public: public:
Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
@ -1144,15 +1147,15 @@ public:
int store(longlong nr, bool unsigned_val)=0; int store(longlong nr, bool unsigned_val)=0;
int store_decimal(const my_decimal *); int store_decimal(const my_decimal *);
int store(const char *to,uint length,CHARSET_INFO *cs)=0; int store(const char *to,uint length,CHARSET_INFO *cs)=0;
uint repertoire(void) const uint repertoire(void) const { return field_repertoire; }
{
return my_charset_repertoire(field_charset);
}
CHARSET_INFO *charset(void) const { return field_charset; } CHARSET_INFO *charset(void) const { return field_charset; }
void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
enum Derivation derivation(void) const { return field_derivation; } enum Derivation derivation(void) const { return field_derivation; }
virtual void set_derivation(enum Derivation derivation_arg) void set_derivation(enum Derivation derivation_arg,
{ field_derivation= derivation_arg; } uint repertoire_arg)
{
field_derivation= derivation_arg;
field_repertoire= repertoire_arg;
}
bool binary() const { return field_charset == &my_charset_bin; } bool binary() const { return field_charset == &my_charset_bin; }
uint32 max_display_length() { return field_length; } uint32 max_display_length() { return field_length; }
friend class Create_field; friend class Create_field;
@ -2468,10 +2471,9 @@ public:
packlength= 4; packlength= 4;
if (set_packlength) if (set_packlength)
{ {
uint32 l_char_length= len_arg/cs->mbmaxlen; packlength= len_arg <= 255 ? 1 :
packlength= l_char_length <= 255 ? 1 : len_arg <= 65535 ? 2 :
l_char_length <= 65535 ? 2 : len_arg <= 16777215 ? 3 : 4;
l_char_length <= 16777215 ? 3 : 4;
} }
} }
Field_blob(uint32 packlength_arg) Field_blob(uint32 packlength_arg)

View File

@ -272,9 +272,6 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
*/ */
String *Item::val_str_ascii(String *str) String *Item::val_str_ascii(String *str)
{ {
if (!(collation.collation->state & MY_CS_NONASCII))
return val_str(str);
DBUG_ASSERT(str != &str_value); DBUG_ASSERT(str != &str_value);
uint errors; uint errors;
@ -282,11 +279,15 @@ String *Item::val_str_ascii(String *str)
if (!res) if (!res)
return 0; return 0;
if ((null_value= str->copy(res->ptr(), res->length(), if (!(res->charset()->state & MY_CS_NONASCII))
collation.collation, &my_charset_latin1, str= res;
&errors))) else
return 0; {
if ((null_value= str->copy(res->ptr(), res->length(), collation.collation,
&my_charset_latin1, &errors)))
return 0;
}
return str; return str;
} }

View File

@ -2939,12 +2939,13 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
} }
unpack_time(min_max, ltime); unpack_time(min_max, ltime);
if (compare_as_dates->field_type() == MYSQL_TYPE_DATE) enum_field_types ftype= compare_as_dates->field_type();
if (ftype == MYSQL_TYPE_DATE || ftype == MYSQL_TYPE_NEWDATE)
{ {
ltime->time_type= MYSQL_TIMESTAMP_DATE; ltime->time_type= MYSQL_TIMESTAMP_DATE;
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0; ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
} }
else if (compare_as_dates->field_type() == MYSQL_TYPE_TIME) else if (ftype == MYSQL_TYPE_TIME)
{ {
ltime->time_type= MYSQL_TIMESTAMP_TIME; ltime->time_type= MYSQL_TIMESTAMP_TIME;
ltime->hour+= (ltime->month * 32 + ltime->day) * 24; ltime->hour+= (ltime->month * 32 + ltime->day) * 24;

View File

@ -1,6 +1,5 @@
/* /* Copyright (c) 2003, 2016, Oracle and/or its affiliates.
Copyright (c) 2003-2007 MySQL AB, 2009, 2010 Sun Microsystems, Inc. Copyright (c) 2011, 2016, MariaDB
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -936,9 +936,8 @@ void Item_func_monthname::fix_length_and_dec()
{ {
THD* thd= current_thd; THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
uint32 repertoire= my_charset_repertoire(cs);
locale= thd->variables.lc_time_names; locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, repertoire); collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
decimals=0; decimals=0;
max_length= locale->max_month_name_length * collation.collation->mbmaxlen; max_length= locale->max_month_name_length * collation.collation->mbmaxlen;
maybe_null=1; maybe_null=1;
@ -1083,9 +1082,8 @@ void Item_func_dayname::fix_length_and_dec()
{ {
THD* thd= current_thd; THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
uint32 repertoire= my_charset_repertoire(cs);
locale= thd->variables.lc_time_names; locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, repertoire); collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
decimals=0; decimals=0;
max_length= locale->max_day_name_length * collation.collation->mbmaxlen; max_length= locale->max_day_name_length * collation.collation->mbmaxlen;
maybe_null=1; maybe_null=1;

View File

@ -47,12 +47,9 @@ SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
static SYMBOL symbols[] = { static SYMBOL symbols[] = {
{ "&&", SYM(AND_AND_SYM)}, { "&&", SYM(AND_AND_SYM)},
{ "<", SYM(LT)},
{ "<=", SYM(LE)}, { "<=", SYM(LE)},
{ "<>", SYM(NE)}, { "<>", SYM(NE)},
{ "!=", SYM(NE)}, { "!=", SYM(NE)},
{ "=", SYM(EQ)},
{ ">", SYM(GT_SYM)},
{ ">=", SYM(GE)}, { ">=", SYM(GE)},
{ "<<", SYM(SHIFT_LEFT)}, { "<<", SYM(SHIFT_LEFT)},
{ ">>", SYM(SHIFT_RIGHT)}, { ">>", SYM(SHIFT_RIGHT)},

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2012, Oracle and/or its affiliates. /* Copyright (c) 2005, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2012, Monty Program Ab Copyright (c) 2009, 2016, Monty Program Ab
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -9738,9 +9738,6 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
/* /*
When the open and locking succeeded, we check all tables to When the open and locking succeeded, we check all tables to
ensure that they still have the correct type. ensure that they still have the correct type.
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST.
*/ */
{ {
@ -9759,10 +9756,37 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
NOTE: The base tables are added here are removed when NOTE: The base tables are added here are removed when
close_thread_tables is called. close_thread_tables is called.
*/ */
RPL_TABLE_LIST *ptr= rgi->tables_to_lock; TABLE_LIST *table_list_ptr= rgi->tables_to_lock;
for (uint i= 0 ; ptr && (i < rgi->tables_to_lock_count); for (uint i=0 ; table_list_ptr && (i < rgi->tables_to_lock_count);
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++) table_list_ptr= table_list_ptr->next_global, i++)
{ {
/*
Below if condition takes care of skipping base tables that
make up the MERGE table (which are added by open_tables()
call). They are added next to the merge table in the list.
For eg: If RPL_TABLE_LIST is t3->t1->t2 (where t1 and t2
are base tables for merge table 't3'), open_tables will modify
the list by adding t1 and t2 again immediately after t3 in the
list (*not at the end of the list*). New table_to_lock list will
look like t3->t1'->t2'->t1->t2 (where t1' and t2' are TABLE_LIST
objects added by open_tables() call). There is no flag(or logic) in
open_tables() that can skip adding these base tables to the list.
So the logic here should take care of skipping them.
tables_to_lock_count logic will take care of skipping base tables
that are added at the end of the list.
For eg: If RPL_TABLE_LIST is t1->t2->t3, open_tables will modify
the list into t1->t2->t3->t1'->t2'. t1' and t2' will be skipped
because tables_to_lock_count logic in this for loop.
*/
if (table_list_ptr->parent_l)
continue;
/*
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST (or child table which is
skipped above).
*/
RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(table_list_ptr);
DBUG_ASSERT(ptr->m_tabledef_valid); DBUG_ASSERT(ptr->m_tabledef_valid);
TABLE *conv_table; TABLE *conv_table;
if (!ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table)) if (!ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table))
@ -9804,6 +9828,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
TABLE_LIST *ptr= rgi->tables_to_lock; TABLE_LIST *ptr= rgi->tables_to_lock;
for (uint i=0 ; ptr && (i < rgi->tables_to_lock_count); ptr= ptr->next_global, i++) for (uint i=0 ; ptr && (i < rgi->tables_to_lock_count); ptr= ptr->next_global, i++)
{ {
/*
Please see comment in above 'for' loop to know the reason
for this if condition
*/
if (ptr->parent_l)
continue;
rgi->m_table_map.set_table(ptr->table_id, ptr->table); rgi->m_table_map.set_table(ptr->table_id, ptr->table);
/* /*
Following is passing flag about triggers on the server. The problem was Following is passing flag about triggers on the server. The problem was

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2007, 2013, Oracle and/or its affiliates. /* Copyright (c) 2007, 2016, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -121,16 +121,25 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi)
/* /*
When the open and locking succeeded, we check all tables to When the open and locking succeeded, we check all tables to
ensure that they still have the correct type. ensure that they still have the correct type.
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST.
*/ */
{ {
RPL_TABLE_LIST *ptr= rgi->tables_to_lock; TABLE_LIST *table_list_ptr= rgi->tables_to_lock;
for (uint i= 0 ; ptr&& (i< rgi->tables_to_lock_count); for (uint i=0 ; table_list_ptr&& (i< rgi->tables_to_lock_count);
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++) table_list_ptr= table_list_ptr->next_global, i++)
{ {
/*
Please see comment in log_event.cc-Rows_log_event::do_apply_event()
function for the explanation of the below if condition
*/
if (table_list_ptr->parent_l)
continue;
/*
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST(or child table which is
skipped above).
*/
RPL_TABLE_LIST *ptr=static_cast<RPL_TABLE_LIST*>(table_list_ptr);
DBUG_ASSERT(ptr->m_tabledef_valid); DBUG_ASSERT(ptr->m_tabledef_valid);
TABLE *conv_table; TABLE *conv_table;
if (!ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table)) if (!ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table))
@ -163,7 +172,15 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi)
*/ */
TABLE_LIST *ptr= rgi->tables_to_lock; TABLE_LIST *ptr= rgi->tables_to_lock;
for (uint i=0; ptr && (i < rgi->tables_to_lock_count); ptr= ptr->next_global, i++) for (uint i=0; ptr && (i < rgi->tables_to_lock_count); ptr= ptr->next_global, i++)
{
/*
Please see comment in log_event.cc-Rows_log_event::do_apply_event()
function for the explanation of the below if condition
*/
if (ptr->parent_l)
continue;
rgi->m_table_map.set_table(ptr->table_id, ptr->table); rgi->m_table_map.set_table(ptr->table_id, ptr->table);
}
#ifdef HAVE_QUERY_CACHE #ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock); query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
#endif #endif
@ -1518,16 +1535,25 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
/* /*
When the open and locking succeeded, we check all tables to When the open and locking succeeded, we check all tables to
ensure that they still have the correct type. ensure that they still have the correct type.
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST.
*/ */
{ {
RPL_TABLE_LIST *ptr= rgi->tables_to_lock; TABLE_LIST *table_list_ptr= rgi->tables_to_lock;
for (uint i= 0 ; ptr&& (i< rgi->tables_to_lock_count); for (uint i=0; table_list_ptr&& (i< rgi->tables_to_lock_count);
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_global), i++) table_list_ptr= static_cast<RPL_TABLE_LIST*>(table_list_ptr->next_global), i++)
{ {
/*
Please see comment in log_event.cc-Rows_log_event::do_apply_event()
function for the explanation of the below if condition
*/
if (table_list_ptr->parent_l)
continue;
/*
We can use a down cast here since we know that every table added
to the tables_to_lock is a RPL_TABLE_LIST (or child table which is
skipped above).
*/
RPL_TABLE_LIST *ptr=static_cast<RPL_TABLE_LIST*>(table_list_ptr);
TABLE *conv_table; TABLE *conv_table;
if (ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table)) if (ptr->m_tabledef.compatible_with(thd, rgi, ptr->table, &conv_table))
{ {

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2000, 2010, Oracle and/or its affiliates. Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2002, 2013, Oracle and/or its affiliates. Copyright (c) 2002, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2013, Monty Program Ab Copyright (c) 2011, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -514,8 +514,10 @@ sp_name::init_qname(THD *thd)
bool bool
check_routine_name(LEX_STRING *ident) check_routine_name(LEX_STRING *ident)
{ {
if (!ident || !ident->str || !ident->str[0] || DBUG_ASSERT(ident);
ident->str[ident->length-1] == ' ') DBUG_ASSERT(ident->str);
if (!ident->str[0] || ident->str[ident->length-1] == ' ')
{ {
my_error(ER_SP_WRONG_NAME, MYF(0), ident->str); my_error(ER_SP_WRONG_NAME, MYF(0), ident->str);
return TRUE; return TRUE;

View File

@ -1479,32 +1479,35 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
return (BIN_NUM); return (BIN_NUM);
case MY_LEX_CMP_OP: // Incomplete comparison operator case MY_LEX_CMP_OP: // Incomplete comparison operator
lip->next_state= MY_LEX_START; // Allow signed numbers
if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP || if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP ||
state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP) state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP)
lip->yySkip();
if ((tokval = find_keyword(lip, lip->yyLength() + 1, 0)))
{ {
lip->next_state= MY_LEX_START; // Allow signed numbers lip->yySkip();
return(tokval); if ((tokval= find_keyword(lip, 2, 0)))
return(tokval);
lip->yyUnget();
} }
state = MY_LEX_CHAR; // Something fishy found return(c);
break;
case MY_LEX_LONG_CMP_OP: // Incomplete comparison operator case MY_LEX_LONG_CMP_OP: // Incomplete comparison operator
lip->next_state= MY_LEX_START;
if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP || if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP ||
state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP) state_map[(uchar) lip->yyPeek()] == MY_LEX_LONG_CMP_OP)
{ {
lip->yySkip(); lip->yySkip();
if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP) if (state_map[(uchar) lip->yyPeek()] == MY_LEX_CMP_OP)
{
lip->yySkip(); lip->yySkip();
if ((tokval= find_keyword(lip, 3, 0)))
return(tokval);
lip->yyUnget();
}
if ((tokval= find_keyword(lip, 2, 0)))
return(tokval);
lip->yyUnget();
} }
if ((tokval = find_keyword(lip, lip->yyLength() + 1, 0))) return(c);
{
lip->next_state= MY_LEX_START; // Found long op
return(tokval);
}
state = MY_LEX_CHAR; // Something fishy found
break;
case MY_LEX_BOOL: case MY_LEX_BOOL:
if (c != lip->yyPeek()) if (c != lip->yyPeek())

View File

@ -61,6 +61,8 @@ public:
grouping(grouping_par), grouping(grouping_par),
errmsgs(errmsgs_par) errmsgs(errmsgs_par)
{} {}
uint repertoire() const
{ return is_ascii ? MY_REPERTOIRE_ASCII : MY_REPERTOIRE_EXTENDED; }
}; };
/* Exported variables */ /* Exported variables */

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2010, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@ -15479,7 +15479,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
item->collation.collation); item->collation.collation);
else else
new_field= item->make_string_field(table); new_field= item->make_string_field(table);
new_field->set_derivation(item->collation.derivation); new_field->set_derivation(item->collation.derivation,
item->collation.repertoire);
break; break;
case DECIMAL_RESULT: case DECIMAL_RESULT:
new_field= Field_new_decimal::create_from_item(item); new_field= Field_new_decimal::create_from_item(item);
@ -15719,7 +15720,8 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
modify_item, convert_blob_length); modify_item, convert_blob_length);
case Item::TYPE_HOLDER: case Item::TYPE_HOLDER:
result= ((Item_type_holder *)item)->make_field_by_type(table); result= ((Item_type_holder *)item)->make_field_by_type(table);
result->set_derivation(item->collation.derivation); result->set_derivation(item->collation.derivation,
item->collation.repertoire);
return result; return result;
default: // Dosen't have to be stored default: // Dosen't have to be stored
return 0; return 0;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2015, Oracle and/or its affiliates. Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2015, MariaDB Copyright (c) 2010, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -1148,7 +1148,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ENGINES_SYM %token ENGINES_SYM
%token ENGINE_SYM %token ENGINE_SYM
%token ENUM %token ENUM
%token EQ /* OPERATOR */
%token EQUAL_SYM /* OPERATOR */ %token EQUAL_SYM /* OPERATOR */
%token ERROR_SYM %token ERROR_SYM
%token ERRORS %token ERRORS
@ -1197,7 +1196,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token GRANTS %token GRANTS
%token GROUP_SYM /* SQL-2003-R */ %token GROUP_SYM /* SQL-2003-R */
%token GROUP_CONCAT_SYM %token GROUP_CONCAT_SYM
%token GT_SYM /* OPERATOR */
%token HANDLER_SYM %token HANDLER_SYM
%token HARD_SYM %token HARD_SYM
%token HASH_SYM %token HASH_SYM
@ -1277,7 +1275,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token LONG_SYM %token LONG_SYM
%token LOOP_SYM %token LOOP_SYM
%token LOW_PRIORITY %token LOW_PRIORITY
%token LT /* OPERATOR */
%token MASTER_CONNECT_RETRY_SYM %token MASTER_CONNECT_RETRY_SYM
%token MASTER_GTID_POS_SYM %token MASTER_GTID_POS_SYM
%token MASTER_HOST_SYM %token MASTER_HOST_SYM
@ -1637,7 +1634,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%left XOR %left XOR
%left AND_SYM AND_AND_SYM %left AND_SYM AND_AND_SYM
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE %left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
%left EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM %left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE REGEXP IN_SYM
%left '|' %left '|'
%left '&' %left '&'
%left SHIFT_LEFT SHIFT_RIGHT %left SHIFT_LEFT SHIFT_RIGHT
@ -2154,66 +2151,66 @@ master_defs:
; ;
master_def: master_def:
MASTER_HOST_SYM EQ TEXT_STRING_sys MASTER_HOST_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.host = $3.str; Lex->mi.host = $3.str;
} }
| MASTER_USER_SYM EQ TEXT_STRING_sys | MASTER_USER_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.user = $3.str; Lex->mi.user = $3.str;
} }
| MASTER_PASSWORD_SYM EQ TEXT_STRING_sys | MASTER_PASSWORD_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.password = $3.str; Lex->mi.password = $3.str;
} }
| MASTER_PORT_SYM EQ ulong_num | MASTER_PORT_SYM '=' ulong_num
{ {
Lex->mi.port = $3; Lex->mi.port = $3;
} }
| MASTER_CONNECT_RETRY_SYM EQ ulong_num | MASTER_CONNECT_RETRY_SYM '=' ulong_num
{ {
Lex->mi.connect_retry = $3; Lex->mi.connect_retry = $3;
} }
| MASTER_SSL_SYM EQ ulong_num | MASTER_SSL_SYM '=' ulong_num
{ {
Lex->mi.ssl= $3 ? Lex->mi.ssl= $3 ?
LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
} }
| MASTER_SSL_CA_SYM EQ TEXT_STRING_sys | MASTER_SSL_CA_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_ca= $3.str; Lex->mi.ssl_ca= $3.str;
} }
| MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys | MASTER_SSL_CAPATH_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_capath= $3.str; Lex->mi.ssl_capath= $3.str;
} }
| MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys | MASTER_SSL_CERT_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_cert= $3.str; Lex->mi.ssl_cert= $3.str;
} }
| MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys | MASTER_SSL_CIPHER_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_cipher= $3.str; Lex->mi.ssl_cipher= $3.str;
} }
| MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys | MASTER_SSL_KEY_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_key= $3.str; Lex->mi.ssl_key= $3.str;
} }
| MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num | MASTER_SSL_VERIFY_SERVER_CERT_SYM '=' ulong_num
{ {
Lex->mi.ssl_verify_server_cert= $3 ? Lex->mi.ssl_verify_server_cert= $3 ?
LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
} }
| MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys | MASTER_SSL_CRL_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_crl= $3.str; Lex->mi.ssl_crl= $3.str;
} }
| MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys | MASTER_SSL_CRLPATH_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.ssl_crlpath= $3.str; Lex->mi.ssl_crlpath= $3.str;
} }
| MASTER_HEARTBEAT_PERIOD_SYM EQ NUM_literal | MASTER_HEARTBEAT_PERIOD_SYM '=' NUM_literal
{ {
Lex->mi.heartbeat_period= (float) $3->val_real(); Lex->mi.heartbeat_period= (float) $3->val_real();
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD || if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
@ -2244,7 +2241,7 @@ master_def:
} }
Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
} }
| IGNORE_SERVER_IDS_SYM EQ '(' ignore_server_id_list ')' | IGNORE_SERVER_IDS_SYM '=' '(' ignore_server_id_list ')'
{ {
Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE;
} }
@ -2265,11 +2262,11 @@ ignore_server_id:
} }
master_file_def: master_file_def:
MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys MASTER_LOG_FILE_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.log_file_name = $3.str; Lex->mi.log_file_name = $3.str;
} }
| MASTER_LOG_POS_SYM EQ ulonglong_num | MASTER_LOG_POS_SYM '=' ulonglong_num
{ {
Lex->mi.pos = $3; Lex->mi.pos = $3;
/* /*
@ -2285,17 +2282,17 @@ master_file_def:
*/ */
Lex->mi.pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.pos); Lex->mi.pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
} }
| RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys | RELAY_LOG_FILE_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.relay_log_name = $3.str; Lex->mi.relay_log_name = $3.str;
} }
| RELAY_LOG_POS_SYM EQ ulong_num | RELAY_LOG_POS_SYM '=' ulong_num
{ {
Lex->mi.relay_log_pos = $3; Lex->mi.relay_log_pos = $3;
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */ /* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
Lex->mi.relay_log_pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos); Lex->mi.relay_log_pos= MY_MAX(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
} }
| MASTER_USE_GTID_SYM EQ CURRENT_POS_SYM | MASTER_USE_GTID_SYM '=' CURRENT_POS_SYM
{ {
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
{ {
@ -2305,7 +2302,7 @@ master_file_def:
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS; Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS;
} }
; ;
| MASTER_USE_GTID_SYM EQ SLAVE_POS_SYM | MASTER_USE_GTID_SYM '=' SLAVE_POS_SYM
{ {
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
{ {
@ -2315,7 +2312,7 @@ master_file_def:
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS; Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS;
} }
; ;
| MASTER_USE_GTID_SYM EQ NO_SYM | MASTER_USE_GTID_SYM '=' NO_SYM
{ {
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
{ {
@ -3346,7 +3343,7 @@ opt_set_signal_information:
; ;
signal_information_item_list: signal_information_item_list:
signal_condition_information_item_name EQ signal_allowed_expr signal_condition_information_item_name '=' signal_allowed_expr
{ {
Set_signal_information *info; Set_signal_information *info;
info= &thd->m_parser_state->m_yacc.m_set_signal_info; info= &thd->m_parser_state->m_yacc.m_set_signal_info;
@ -3355,7 +3352,7 @@ signal_information_item_list:
info->m_item[index]= $3; info->m_item[index]= $3;
} }
| signal_information_item_list ',' | signal_information_item_list ','
signal_condition_information_item_name EQ signal_allowed_expr signal_condition_information_item_name '=' signal_allowed_expr
{ {
Set_signal_information *info; Set_signal_information *info;
info= &thd->m_parser_state->m_yacc.m_set_signal_info; info= &thd->m_parser_state->m_yacc.m_set_signal_info;
@ -3494,7 +3491,7 @@ statement_information:
; ;
statement_information_item: statement_information_item:
simple_target_specification EQ statement_information_item_name simple_target_specification '=' statement_information_item_name
{ {
$$= new (thd->mem_root) Statement_information_item($3, $1); $$= new (thd->mem_root) Statement_information_item($3, $1);
if ($$ == NULL) if ($$ == NULL)
@ -3551,7 +3548,7 @@ condition_information:
; ;
condition_information_item: condition_information_item:
simple_target_specification EQ condition_information_item_name simple_target_specification '=' condition_information_item_name
{ {
$$= new (thd->mem_root) Condition_information_item($3, $1); $$= new (thd->mem_root) Condition_information_item($3, $1);
if ($$ == NULL) if ($$ == NULL)
@ -4886,7 +4883,7 @@ opt_linear:
opt_key_algo: opt_key_algo:
/* empty */ /* empty */
{ Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_NONE;} { Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_NONE;}
| ALGORITHM_SYM EQ real_ulong_num | ALGORITHM_SYM '=' real_ulong_num
{ {
switch ($3) { switch ($3) {
case 1: case 1:
@ -7760,7 +7757,7 @@ opt_place:
opt_to: opt_to:
/* empty */ {} /* empty */ {}
| TO_SYM {} | TO_SYM {}
| EQ {} | '=' {}
| AS {} | AS {}
; ;
@ -7882,7 +7879,7 @@ slave_until:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
| UNTIL_SYM MASTER_GTID_POS_SYM EQ TEXT_STRING_sys | UNTIL_SYM MASTER_GTID_POS_SYM '=' TEXT_STRING_sys
{ {
Lex->mi.gtid_pos_str = $4; Lex->mi.gtid_pos_str = $4;
} }
@ -8756,13 +8753,13 @@ bool_pri:
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| bool_pri comp_op predicate %prec EQ | bool_pri comp_op predicate %prec '='
{ {
$$= (*$2)(0)->create($1,$3); $$= (*$2)(0)->create($1,$3);
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| bool_pri comp_op all_or_any '(' subselect ')' %prec EQ | bool_pri comp_op all_or_any '(' subselect ')' %prec '='
{ {
$$= all_any_subquery_creator($1, $2, $3, $5); $$= all_any_subquery_creator($1, $2, $3, $5);
if ($$ == NULL) if ($$ == NULL)
@ -8985,11 +8982,11 @@ not2:
; ;
comp_op: comp_op:
EQ { $$ = &comp_eq_creator; } '=' { $$ = &comp_eq_creator; }
| GE { $$ = &comp_ge_creator; } | GE { $$ = &comp_ge_creator; }
| GT_SYM { $$ = &comp_gt_creator; } | '>' { $$ = &comp_gt_creator; }
| LE { $$ = &comp_le_creator; } | LE { $$ = &comp_le_creator; }
| LT { $$ = &comp_lt_creator; } | '<' { $$ = &comp_lt_creator; }
| NE { $$ = &comp_ne_creator; } | NE { $$ = &comp_ne_creator; }
; ;
@ -11088,7 +11085,7 @@ date_time_type:
table_alias: table_alias:
/* empty */ /* empty */
| AS | AS
| EQ | '='
; ;
opt_table_alias: opt_table_alias:
@ -12019,7 +12016,7 @@ ident_eq_value:
; ;
equal: equal:
EQ {} '=' {}
| SET_VAR {} | SET_VAR {}
; ;
@ -15019,11 +15016,11 @@ handler_rkey_function:
; ;
handler_rkey_mode: handler_rkey_mode:
EQ { $$=HA_READ_KEY_EXACT; } '=' { $$=HA_READ_KEY_EXACT; }
| GE { $$=HA_READ_KEY_OR_NEXT; } | GE { $$=HA_READ_KEY_OR_NEXT; }
| LE { $$=HA_READ_KEY_OR_PREV; } | LE { $$=HA_READ_KEY_OR_PREV; }
| GT_SYM { $$=HA_READ_AFTER_KEY; } | '>' { $$=HA_READ_AFTER_KEY; }
| LT { $$=HA_READ_BEFORE_KEY; } | '<' { $$=HA_READ_BEFORE_KEY; }
; ;
/* GRANT / REVOKE */ /* GRANT / REVOKE */
@ -15890,7 +15887,7 @@ no_definer:
; ;
definer: definer:
DEFINER_SYM EQ user_or_role DEFINER_SYM '=' user_or_role
{ {
thd->lex->definer= $3; thd->lex->definer= $3;
} }
@ -15903,11 +15900,11 @@ definer:
**************************************************************************/ **************************************************************************/
view_algorithm: view_algorithm:
ALGORITHM_SYM EQ UNDEFINED_SYM ALGORITHM_SYM '=' UNDEFINED_SYM
{ Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; } { Lex->create_view_algorithm= DTYPE_ALGORITHM_UNDEFINED; }
| ALGORITHM_SYM EQ MERGE_SYM | ALGORITHM_SYM '=' MERGE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; } { Lex->create_view_algorithm= VIEW_ALGORITHM_MERGE; }
| ALGORITHM_SYM EQ TEMPTABLE_SYM | ALGORITHM_SYM '=' TEMPTABLE_SYM
{ Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; } { Lex->create_view_algorithm= VIEW_ALGORITHM_TMPTABLE; }
; ;

View File

@ -169,6 +169,7 @@ struct pool_timer_t
volatile uint64 next_timeout_check; volatile uint64 next_timeout_check;
int tick_interval; int tick_interval;
bool shutdown; bool shutdown;
pthread_t timer_thread_id;
}; };
static pool_timer_t pool_timer; static pool_timer_t pool_timer;
@ -606,12 +607,12 @@ void check_stall(thread_group_t *thread_group)
static void start_timer(pool_timer_t* timer) static void start_timer(pool_timer_t* timer)
{ {
pthread_t thread_id;
DBUG_ENTER("start_timer"); DBUG_ENTER("start_timer");
mysql_mutex_init(key_timer_mutex,&timer->mutex, NULL); mysql_mutex_init(key_timer_mutex,&timer->mutex, NULL);
mysql_cond_init(key_timer_cond, &timer->cond, NULL); mysql_cond_init(key_timer_cond, &timer->cond, NULL);
timer->shutdown = false; timer->shutdown = false;
mysql_thread_create(key_timer_thread,&thread_id, NULL, timer_thread, timer); mysql_thread_create(key_timer_thread, &timer->timer_thread_id, NULL,
timer_thread, timer);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -623,6 +624,7 @@ static void stop_timer(pool_timer_t *timer)
timer->shutdown = true; timer->shutdown = true;
mysql_cond_signal(&timer->cond); mysql_cond_signal(&timer->cond);
mysql_mutex_unlock(&timer->mutex); mysql_mutex_unlock(&timer->mutex);
pthread_join(timer->timer_thread_id, NULL);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -11936,6 +11936,35 @@ ha_innobase::check(
DBUG_RETURN(HA_ADMIN_CORRUPT); DBUG_RETURN(HA_ADMIN_CORRUPT);
} }
if (prebuilt->table->corrupted) {
char index_name[MAX_FULL_NAME_LEN + 1];
/* If some previous operation has marked the table as
corrupted in memory, and has not propagated such to
clustered index, we will do so here */
index = dict_table_get_first_index(prebuilt->table);
if (!dict_index_is_corrupted(index)) {
row_mysql_lock_data_dictionary(prebuilt->trx);
dict_set_corrupted(index, prebuilt->trx, "CHECK TABLE");
row_mysql_unlock_data_dictionary(prebuilt->trx);
}
innobase_format_name(index_name, sizeof index_name,
index->name, TRUE);
push_warning_printf(thd,
Sql_condition::WARN_LEVEL_WARN,
HA_ERR_INDEX_CORRUPT,
"InnoDB: Index %s is marked as"
" corrupted", index_name);
/* Now that the table is already marked as corrupted,
there is no need to check any index of this table */
prebuilt->trx->op_info = "";
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
prebuilt->trx->op_info = "checking table"; prebuilt->trx->op_info = "checking table";
old_isolation_level = prebuilt->trx->isolation_level; old_isolation_level = prebuilt->trx->isolation_level;
@ -12006,6 +12035,15 @@ ha_innobase::check(
prebuilt->index_usable = row_merge_is_index_usable( prebuilt->index_usable = row_merge_is_index_usable(
prebuilt->trx, prebuilt->index); prebuilt->trx, prebuilt->index);
DBUG_EXECUTE_IF(
"dict_set_index_corrupted",
if (!dict_index_is_clust(index)) {
prebuilt->index_usable = FALSE;
row_mysql_lock_data_dictionary(prebuilt->trx);
dict_set_corrupted(index, prebuilt->trx, "dict_set_index_corrupted");;
row_mysql_unlock_data_dictionary(prebuilt->trx);
});
if (UNIV_UNLIKELY(!prebuilt->index_usable)) { if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
innobase_format_name( innobase_format_name(
index_name, sizeof index_name, index_name, sizeof index_name,

View File

@ -3874,6 +3874,24 @@ check_if_can_drop_indexes:
drop_index = NULL; drop_index = NULL;
} }
/* Check if any of the existing indexes are marked as corruption
and if they are, refuse adding more indexes. */
if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_INDEX) {
for (dict_index_t* index = dict_table_get_first_index(indexed_table);
index != NULL; index = dict_table_get_next_index(index)) {
if (!index->to_be_dropped && dict_index_is_corrupted(index)) {
char index_name[MAX_FULL_NAME_LEN + 1];
innobase_format_name(index_name, sizeof index_name,
index->name, TRUE);
my_error(ER_INDEX_CORRUPT, MYF(0), index_name);
DBUG_RETURN(true);
}
}
}
n_add_fk = 0; n_add_fk = 0;
if (ha_alter_info->handler_flags if (ha_alter_info->handler_flags

View File

@ -46,7 +46,7 @@ static mysql_mutex_t LOCK_checkpoint;
static mysql_cond_t COND_checkpoint; static mysql_cond_t COND_checkpoint;
/** @brief control structure for checkpoint background thread */ /** @brief control structure for checkpoint background thread */
static MA_SERVICE_THREAD_CONTROL checkpoint_control= static MA_SERVICE_THREAD_CONTROL checkpoint_control=
{THREAD_DEAD, FALSE, &LOCK_checkpoint, &COND_checkpoint}; {0, FALSE, FALSE, &LOCK_checkpoint, &COND_checkpoint};
/* is ulong like pagecache->blocks_changed */ /* is ulong like pagecache->blocks_changed */
static ulong pages_to_flush_before_next_checkpoint; static ulong pages_to_flush_before_next_checkpoint;
static PAGECACHE_FILE *dfiles, /**< data files to flush in background */ static PAGECACHE_FILE *dfiles, /**< data files to flush in background */
@ -326,7 +326,6 @@ end:
int ma_checkpoint_init(ulong interval) int ma_checkpoint_init(ulong interval)
{ {
pthread_t th;
int res= 0; int res= 0;
DBUG_ENTER("ma_checkpoint_init"); DBUG_ENTER("ma_checkpoint_init");
if (ma_service_thread_control_init(&checkpoint_control)) if (ma_service_thread_control_init(&checkpoint_control))
@ -334,14 +333,14 @@ int ma_checkpoint_init(ulong interval)
else if (interval > 0) else if (interval > 0)
{ {
compile_time_assert(sizeof(void *) >= sizeof(ulong)); compile_time_assert(sizeof(void *) >= sizeof(ulong));
if (!(res= mysql_thread_create(key_thread_checkpoint, if ((res= mysql_thread_create(key_thread_checkpoint,
&th, NULL, ma_checkpoint_background, &checkpoint_control.thread, NULL,
(void *)interval))) ma_checkpoint_background,
{ (void*) interval)))
/* thread lives, will have to be killed */ checkpoint_control.killed= TRUE;
checkpoint_control.status= THREAD_RUNNING;
}
} }
else
checkpoint_control.killed= TRUE;
DBUG_RETURN(res); DBUG_RETURN(res);
} }
@ -721,7 +720,6 @@ pthread_handler_t ma_checkpoint_background(void *arg)
DBUG_EXECUTE_IF("maria_checkpoint_indirect", level= CHECKPOINT_INDIRECT;); DBUG_EXECUTE_IF("maria_checkpoint_indirect", level= CHECKPOINT_INDIRECT;);
ma_checkpoint_execute(level, FALSE); ma_checkpoint_execute(level, FALSE);
} }
my_service_thread_signal_end(&checkpoint_control);
my_thread_end(); my_thread_end();
return 0; return 0;
} }

View File

@ -54,7 +54,7 @@ static mysql_mutex_t LOCK_soft_sync;
static mysql_cond_t COND_soft_sync; static mysql_cond_t COND_soft_sync;
/** @brief control structure for checkpoint background thread */ /** @brief control structure for checkpoint background thread */
static MA_SERVICE_THREAD_CONTROL soft_sync_control= static MA_SERVICE_THREAD_CONTROL soft_sync_control=
{THREAD_DEAD, FALSE, &LOCK_soft_sync, &COND_soft_sync}; {0, FALSE, FALSE, &LOCK_soft_sync, &COND_soft_sync};
/* transaction log file descriptor */ /* transaction log file descriptor */
@ -8819,7 +8819,6 @@ ma_soft_sync_background( void *arg __attribute__((unused)))
if (my_service_thread_sleep(&soft_sync_control, sleep)) if (my_service_thread_sleep(&soft_sync_control, sleep))
break; break;
} }
my_service_thread_signal_end(&soft_sync_control);
my_thread_end(); my_thread_end();
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -8832,7 +8831,6 @@ ma_soft_sync_background( void *arg __attribute__((unused)))
int translog_soft_sync_start(void) int translog_soft_sync_start(void)
{ {
pthread_t th;
int res= 0; int res= 0;
uint32 min, max; uint32 min, max;
DBUG_ENTER("translog_soft_sync_start"); DBUG_ENTER("translog_soft_sync_start");
@ -8847,9 +8845,10 @@ int translog_soft_sync_start(void)
soft_need_sync= 1; soft_need_sync= 1;
if (!(res= ma_service_thread_control_init(&soft_sync_control))) if (!(res= ma_service_thread_control_init(&soft_sync_control)))
if (!(res= mysql_thread_create(key_thread_soft_sync, if ((res= mysql_thread_create(key_thread_soft_sync,
&th, NULL, ma_soft_sync_background, NULL))) &soft_sync_control.thread, NULL,
soft_sync_control.status= THREAD_RUNNING; ma_soft_sync_background, NULL)))
soft_sync_control.killed= TRUE;
DBUG_RETURN(res); DBUG_RETURN(res);
} }

View File

@ -500,8 +500,8 @@ static void test_key_cache(PAGECACHE *pagecache,
const char *where, my_bool lock); const char *where, my_bool lock);
#endif #endif
#define PAGECACHE_HASH(p, f, pos) (((ulong) (pos) + \ #define PAGECACHE_HASH(p, f, pos) (((size_t) (pos) + \
(ulong) (f).file) & (p->hash_entries-1)) (size_t) (f).file) & (p->hash_entries-1))
#define FILE_HASH(f,cache) ((uint) (f).file & (cache->changed_blocks_hash_size-1)) #define FILE_HASH(f,cache) ((uint) (f).file & (cache->changed_blocks_hash_size-1))
#define DEFAULT_PAGECACHE_DEBUG_LOG "pagecache_debug.log" #define DEFAULT_PAGECACHE_DEBUG_LOG "pagecache_debug.log"
@ -639,10 +639,10 @@ static my_bool pagecache_fwrite(PAGECACHE *pagecache,
{ {
char buff[80]; char buff[80];
uint len= my_sprintf(buff, uint len= my_sprintf(buff,
(buff, "fwrite: fd: %d id: %u page: %lu", (buff, "fwrite: fd: %d id: %u page: %llu",
filedesc->file, filedesc->file,
_ma_file_callback_to_id(filedesc->callback_data), _ma_file_callback_to_id(filedesc->callback_data),
(ulong) pageno)); pageno));
(void) translog_log_debug_info(0, LOGREC_DEBUG_INFO_QUERY, (void) translog_log_debug_info(0, LOGREC_DEBUG_INFO_QUERY,
(uchar*) buff, len); (uchar*) buff, len);
} }
@ -741,12 +741,12 @@ static inline uint next_power(uint value)
*/ */
ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
uint division_limit, uint age_threshold, uint division_limit, uint age_threshold,
uint block_size, uint changed_blocks_hash_size, uint block_size, uint changed_blocks_hash_size,
myf my_readwrite_flags) myf my_readwrite_flags)
{ {
ulong blocks, hash_links, length; size_t blocks, hash_links, length;
int error; int error;
DBUG_ENTER("init_pagecache"); DBUG_ENTER("init_pagecache");
DBUG_ASSERT(block_size >= 512); DBUG_ASSERT(block_size >= 512);
@ -783,10 +783,10 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
DBUG_PRINT("info", ("block_size: %u", block_size)); DBUG_PRINT("info", ("block_size: %u", block_size));
DBUG_ASSERT(((uint)(1 << pagecache->shift)) == block_size); DBUG_ASSERT(((uint)(1 << pagecache->shift)) == block_size);
blocks= (ulong) (use_mem / (sizeof(PAGECACHE_BLOCK_LINK) + blocks= use_mem / (sizeof(PAGECACHE_BLOCK_LINK) +
2 * sizeof(PAGECACHE_HASH_LINK) + 2 * sizeof(PAGECACHE_HASH_LINK) +
sizeof(PAGECACHE_HASH_LINK*) * sizeof(PAGECACHE_HASH_LINK*) *
5/4 + block_size)); 5/4 + block_size);
/* Changed blocks hash needs to be a power of 2 */ /* Changed blocks hash needs to be a power of 2 */
changed_blocks_hash_size= my_round_up_to_next_power(MY_MAX(changed_blocks_hash_size, changed_blocks_hash_size= my_round_up_to_next_power(MY_MAX(changed_blocks_hash_size,
MIN_PAGECACHE_CHANGED_BLOCKS_HASH_SIZE)); MIN_PAGECACHE_CHANGED_BLOCKS_HASH_SIZE));
@ -822,7 +822,7 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
blocks--; blocks--;
/* Allocate memory for cache page buffers */ /* Allocate memory for cache page buffers */
if ((pagecache->block_mem= if ((pagecache->block_mem=
my_large_malloc((ulong) blocks * pagecache->block_size, my_large_malloc(blocks * pagecache->block_size,
MYF(MY_WME)))) MYF(MY_WME))))
{ {
/* /*
@ -853,7 +853,7 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
blocks= blocks / 4*3; blocks= blocks / 4*3;
} }
pagecache->blocks_unused= blocks; pagecache->blocks_unused= blocks;
pagecache->disk_blocks= (long) blocks; pagecache->disk_blocks= blocks;
pagecache->hash_links= hash_links; pagecache->hash_links= hash_links;
pagecache->hash_links_used= 0; pagecache->hash_links_used= 0;
pagecache->free_hash_list= NULL; pagecache->free_hash_list= NULL;
@ -890,7 +890,7 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
pagecache->hash_links, (long) pagecache->hash_link_root)); pagecache->hash_links, (long) pagecache->hash_link_root));
pagecache->blocks= pagecache->disk_blocks > 0 ? pagecache->disk_blocks : 0; pagecache->blocks= pagecache->disk_blocks > 0 ? pagecache->disk_blocks : 0;
DBUG_RETURN((ulong) pagecache->disk_blocks); DBUG_RETURN((size_t)pagecache->disk_blocks);
err: err:
error= my_errno; error= my_errno;
@ -981,11 +981,11 @@ static int flush_all_key_blocks(PAGECACHE *pagecache)
So we disable it for now. So we disable it for now.
*/ */
#if NOT_USED /* keep disabled until code is fixed see above !! */ #if NOT_USED /* keep disabled until code is fixed see above !! */
ulong resize_pagecache(PAGECACHE *pagecache, size_t resize_pagecache(PAGECACHE *pagecache,
size_t use_mem, uint division_limit, size_t use_mem, uint division_limit,
uint age_threshold, uint changed_blocks_hash_size) uint age_threshold, uint changed_blocks_hash_size)
{ {
ulong blocks; size_t blocks;
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
WQUEUE *wqueue; WQUEUE *wqueue;
DBUG_ENTER("resize_pagecache"); DBUG_ENTER("resize_pagecache");
@ -1381,7 +1381,7 @@ static void link_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
("linked block: %u:%1u status: %x #requests: %u #available: %u", ("linked block: %u:%1u status: %x #requests: %u #available: %u",
PCBLOCK_NUMBER(pagecache, block), at_end, block->status, PCBLOCK_NUMBER(pagecache, block), at_end, block->status,
block->requests, pagecache->blocks_available)); block->requests, pagecache->blocks_available));
KEYCACHE_DBUG_ASSERT((ulong) pagecache->blocks_available <= KEYCACHE_DBUG_ASSERT(pagecache->blocks_available <=
pagecache->blocks_used); pagecache->blocks_used);
#endif #endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -2020,7 +2020,7 @@ restart:
/* There are some never used blocks, take first of them */ /* There are some never used blocks, take first of them */
block= &pagecache->block_root[pagecache->blocks_used]; block= &pagecache->block_root[pagecache->blocks_used];
block->buffer= ADD_TO_PTR(pagecache->block_mem, block->buffer= ADD_TO_PTR(pagecache->block_mem,
((ulong) pagecache->blocks_used* (pagecache->blocks_used*
pagecache->block_size), pagecache->block_size),
uchar*); uchar*);
pagecache->blocks_used++; pagecache->blocks_used++;
@ -4872,7 +4872,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
LSN *min_rec_lsn) LSN *min_rec_lsn)
{ {
my_bool error= 0; my_bool error= 0;
ulong stored_list_size= 0; size_t stored_list_size= 0;
uint file_hash; uint file_hash;
char *ptr; char *ptr;
LSN minimum_rec_lsn= LSN_MAX; LSN minimum_rec_lsn= LSN_MAX;

View File

@ -119,21 +119,21 @@ typedef struct st_pagecache_hash_link PAGECACHE_HASH_LINK;
typedef struct st_pagecache typedef struct st_pagecache
{ {
size_t mem_size; /* specified size of the cache memory */ size_t mem_size; /* specified size of the cache memory */
ulong min_warm_blocks; /* min number of warm blocks; */ size_t min_warm_blocks; /* min number of warm blocks; */
ulong age_threshold; /* age threshold for hot blocks */ size_t age_threshold; /* age threshold for hot blocks */
ulonglong time; /* total number of block link operations */ ulonglong time; /* total number of block link operations */
ulong hash_entries; /* max number of entries in the hash table */ size_t hash_entries; /* max number of entries in the hash table */
ulong changed_blocks_hash_size; /* Number of hash buckets for file blocks */ size_t changed_blocks_hash_size;/* Number of hash buckets for file blocks */
long hash_links; /* max number of hash links */ ssize_t hash_links; /* max number of hash links */
long hash_links_used; /* number of hash links taken from free links pool */ ssize_t hash_links_used; /* number of hash links taken from free links pool */
long disk_blocks; /* max number of blocks in the cache */ ssize_t disk_blocks; /* max number of blocks in the cache */
ulong blocks_used; /* maximum number of concurrently used blocks */ size_t blocks_used; /* maximum number of concurrently used blocks */
ulong blocks_unused; /* number of currently unused blocks */ size_t blocks_unused; /* number of currently unused blocks */
ulong blocks_changed; /* number of currently dirty blocks */ size_t blocks_changed; /* number of currently dirty blocks */
ulong warm_blocks; /* number of blocks in warm sub-chain */ size_t warm_blocks; /* number of blocks in warm sub-chain */
ulong cnt_for_resize_op; /* counter to block resize operation */ size_t cnt_for_resize_op; /* counter to block resize operation */
ulong blocks_available; /* number of blocks available in the LRU chain */ size_t blocks_available; /* number of blocks available in the LRU chain */
long blocks; /* max number of blocks in the cache */ ssize_t blocks; /* max number of blocks in the cache */
uint32 block_size; /* size of the page buffer of a cache block */ uint32 block_size; /* size of the page buffer of a cache block */
PAGECACHE_HASH_LINK **hash_root;/* arr. of entries into hash table buckets */ PAGECACHE_HASH_LINK **hash_root;/* arr. of entries into hash table buckets */
PAGECACHE_HASH_LINK *hash_link_root;/* memory for hash table links */ PAGECACHE_HASH_LINK *hash_link_root;/* memory for hash table links */
@ -158,12 +158,12 @@ typedef struct st_pagecache
*/ */
ulonglong param_buff_size; /* size the memory allocated for the cache */ ulonglong param_buff_size; /* size the memory allocated for the cache */
ulong param_block_size; /* size of the blocks in the key cache */ size_t param_block_size; /* size of the blocks in the key cache */
ulong param_division_limit; /* min. percentage of warm blocks */ size_t param_division_limit; /* min. percentage of warm blocks */
ulong param_age_threshold; /* determines when hot block is downgraded */ size_t param_age_threshold; /* determines when hot block is downgraded */
/* Statistics variables. These are reset in reset_pagecache_counters(). */ /* Statistics variables. These are reset in reset_pagecache_counters(). */
ulong global_blocks_changed; /* number of currently dirty blocks */ size_t global_blocks_changed; /* number of currently dirty blocks */
ulonglong global_cache_w_requests;/* number of write requests (write hits) */ ulonglong global_cache_w_requests;/* number of write requests (write hits) */
ulonglong global_cache_write; /* number of writes from cache to files */ ulonglong global_cache_write; /* number of writes from cache to files */
ulonglong global_cache_r_requests;/* number of read requests (read hits) */ ulonglong global_cache_r_requests;/* number of read requests (read hits) */
@ -196,11 +196,11 @@ typedef enum pagecache_flush_filter_result
/* The default key cache */ /* The default key cache */
extern PAGECACHE dflt_pagecache_var, *dflt_pagecache; extern PAGECACHE dflt_pagecache_var, *dflt_pagecache;
extern ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem, extern size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
uint division_limit, uint age_threshold, uint division_limit, uint age_threshold,
uint block_size, uint changed_blocks_hash_size, uint block_size, uint changed_blocks_hash_size,
myf my_read_flags); myf my_read_flags);
extern ulong resize_pagecache(PAGECACHE *pagecache, extern size_t resize_pagecache(PAGECACHE *pagecache,
size_t use_mem, uint division_limit, size_t use_mem, uint division_limit,
uint age_threshold, uint changed_blocks_hash_size); uint age_threshold, uint changed_blocks_hash_size);
extern void change_pagecache_param(PAGECACHE *pagecache, uint division_limit, extern void change_pagecache_param(PAGECACHE *pagecache, uint division_limit,

View File

@ -33,7 +33,7 @@ int ma_service_thread_control_init(MA_SERVICE_THREAD_CONTROL *control)
DBUG_ENTER("ma_service_thread_control_init"); DBUG_ENTER("ma_service_thread_control_init");
DBUG_PRINT("init", ("control 0x%lx", (ulong) control)); DBUG_PRINT("init", ("control 0x%lx", (ulong) control));
control->inited= TRUE; control->inited= TRUE;
control->status= THREAD_DEAD; /* not yet born == dead */ control->killed= FALSE;
res= (mysql_mutex_init(key_SERVICE_THREAD_CONTROL_lock, res= (mysql_mutex_init(key_SERVICE_THREAD_CONTROL_lock,
control->LOCK_control, MY_MUTEX_INIT_SLOW) || control->LOCK_control, MY_MUTEX_INIT_SLOW) ||
mysql_cond_init(key_SERVICE_THREAD_CONTROL_cond, mysql_cond_init(key_SERVICE_THREAD_CONTROL_cond,
@ -60,20 +60,17 @@ void ma_service_thread_control_end(MA_SERVICE_THREAD_CONTROL *control)
DBUG_PRINT("init", ("control 0x%lx", (ulong) control)); DBUG_PRINT("init", ("control 0x%lx", (ulong) control));
DBUG_ASSERT(control->inited); DBUG_ASSERT(control->inited);
mysql_mutex_lock(control->LOCK_control); mysql_mutex_lock(control->LOCK_control);
if (control->status != THREAD_DEAD) /* thread was started OK */ if (!control->killed)
{ {
DBUG_PRINT("info",("killing Maria background thread")); DBUG_PRINT("info",("killing Maria background thread"));
control->status= THREAD_DYING; /* kill it */ control->killed= TRUE; /* kill it */
do /* and wait for it to be dead */ mysql_cond_broadcast(control->COND_control);
{ mysql_mutex_unlock(control->LOCK_control);
/* wake it up if it was in a sleep */ DBUG_PRINT("info", ("waiting for Maria background thread to die"));
mysql_cond_broadcast(control->COND_control); pthread_join(control->thread, NULL);
DBUG_PRINT("info",("waiting for Maria background thread to die"));
mysql_cond_wait(control->COND_control, control->LOCK_control);
}
while (control->status != THREAD_DEAD);
} }
mysql_mutex_unlock(control->LOCK_control); else
mysql_mutex_unlock(control->LOCK_control);
mysql_mutex_destroy(control->LOCK_control); mysql_mutex_destroy(control->LOCK_control);
mysql_cond_destroy(control->COND_control); mysql_cond_destroy(control->COND_control);
control->inited= FALSE; control->inited= FALSE;
@ -100,7 +97,7 @@ my_bool my_service_thread_sleep(MA_SERVICE_THREAD_CONTROL *control,
DBUG_ENTER("my_service_thread_sleep"); DBUG_ENTER("my_service_thread_sleep");
DBUG_PRINT("init", ("control 0x%lx", (ulong) control)); DBUG_PRINT("init", ("control 0x%lx", (ulong) control));
mysql_mutex_lock(control->LOCK_control); mysql_mutex_lock(control->LOCK_control);
if (control->status == THREAD_DYING) if (control->killed)
{ {
mysql_mutex_unlock(control->LOCK_control); mysql_mutex_unlock(control->LOCK_control);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
@ -119,34 +116,8 @@ my_bool my_service_thread_sleep(MA_SERVICE_THREAD_CONTROL *control,
control->LOCK_control, &abstime); control->LOCK_control, &abstime);
} }
#endif #endif
if (control->status == THREAD_DYING) if (control->killed)
res= TRUE; res= TRUE;
mysql_mutex_unlock(control->LOCK_control); mysql_mutex_unlock(control->LOCK_control);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
/**
inform about thread exiting
@param control control block
*/
void my_service_thread_signal_end(MA_SERVICE_THREAD_CONTROL *control)
{
DBUG_ENTER("my_service_thread_signal_end");
DBUG_PRINT("init", ("control 0x%lx", (ulong) control));
mysql_mutex_lock(control->LOCK_control);
control->status = THREAD_DEAD; /* indicate that we are dead */
/*
wake up ma_service_thread_control_end which may be waiting for
our death
*/
mysql_cond_broadcast(control->COND_control);
/*
broadcast was inside unlock because ma_service_thread_control_end
destroys mutex
*/
mysql_mutex_unlock(control->LOCK_control);
DBUG_VOID_RETURN;
}

View File

@ -16,12 +16,10 @@
#include <my_pthread.h> #include <my_pthread.h>
enum ma_service_thread_state {THREAD_RUNNING, THREAD_DYING, THREAD_DEAD};
typedef struct st_ma_service_thread_control typedef struct st_ma_service_thread_control
{ {
/** 'kill' flag for the background thread */ pthread_t thread;
enum ma_service_thread_state status; my_bool killed;
/** if thread module was inited or not */ /** if thread module was inited or not */
my_bool inited; my_bool inited;
/** for killing the background thread */ /** for killing the background thread */
@ -35,4 +33,3 @@ int ma_service_thread_control_init(MA_SERVICE_THREAD_CONTROL *control);
void ma_service_thread_control_end(MA_SERVICE_THREAD_CONTROL *control); void ma_service_thread_control_end(MA_SERVICE_THREAD_CONTROL *control);
my_bool my_service_thread_sleep(MA_SERVICE_THREAD_CONTROL *control, my_bool my_service_thread_sleep(MA_SERVICE_THREAD_CONTROL *control,
ulonglong sleep_time); ulonglong sleep_time);
void my_service_thread_signal_end(MA_SERVICE_THREAD_CONTROL *control);

View File

@ -89,6 +89,27 @@ static int write_merge_key_varlen(MARIA_SORT_PARAM *info,
static inline int static inline int
my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); my_var_write(MARIA_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
/*
Sets the appropriate read and write methods for the MARIA_SORT_PARAM
based on the variable length key flag.
*/
static void set_sort_param_read_write(MARIA_SORT_PARAM *sort_param)
{
if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY)
{
sort_param->write_keys= write_keys_varlen;
sort_param->read_to_buffer= read_to_buffer_varlen;
sort_param->write_key= write_merge_key_varlen;
}
else
{
sort_param->write_keys= write_keys;
sort_param->read_to_buffer= read_to_buffer;
sort_param->write_key= write_merge_key;
}
}
/* /*
Creates a index of sorted keys Creates a index of sorted keys
@ -118,18 +139,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
(ulong) sortbuff_size, info->key_length, (ulong) sortbuff_size, info->key_length,
(ulong) info->sort_info->max_records)); (ulong) info->sort_info->max_records));
if (info->keyinfo->flag & HA_VAR_LENGTH_KEY) set_sort_param_read_write(info);
{
info->write_keys= write_keys_varlen;
info->read_to_buffer= read_to_buffer_varlen;
info->write_key=write_merge_key_varlen;
}
else
{
info->write_keys= write_keys;
info->read_to_buffer=read_to_buffer;
info->write_key=write_merge_key;
}
my_b_clear(&tempfile); my_b_clear(&tempfile);
my_b_clear(&tempfile_for_exceptions); my_b_clear(&tempfile_for_exceptions);
@ -355,205 +365,196 @@ err:
} /* find_all_keys */ } /* find_all_keys */
static my_bool _ma_thr_find_all_keys_exec(MARIA_SORT_PARAM* sort_param)
{
int error= 0;
ulonglong memavl, old_memavl;
longlong sortbuff_size;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
uint maxbuffer;
uchar **sort_keys= NULL;
DBUG_ENTER("_ma_thr_find_all_keys");
DBUG_PRINT("enter", ("master: %d", sort_param->master));
if (sort_param->sort_info->got_error)
DBUG_RETURN(TRUE);
set_sort_param_read_write(sort_param);
my_b_clear(&sort_param->tempfile);
my_b_clear(&sort_param->tempfile_for_exceptions);
bzero((char*) &sort_param->buffpek, sizeof(sort_param->buffpek));
bzero((char*) &sort_param->unique, sizeof(sort_param->unique));
sortbuff_size= sort_param->sortbuff_size;
memavl= MY_MAX(sortbuff_size, MIN_SORT_MEMORY);
idx= (ha_keys) sort_param->sort_info->max_records;
sort_length= sort_param->key_length;
maxbuffer= 1;
while (memavl >= MIN_SORT_MEMORY)
{
if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <= (my_off_t) memavl)
keys= idx+1;
else if ((sort_param->sort_info->param->testflag &
(T_FORCE_SORT_MEMORY | T_CREATE_MISSING_KEYS)) ==
T_FORCE_SORT_MEMORY)
{
/*
Use all of the given sort buffer for key data.
Allocate 1000 buffers at a start for new data. More buffers
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
uint maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
if (memavl < sizeof(BUFFPEK)*maxbuffer ||
(keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
(sort_length+sizeof(char*))) <= 1 ||
keys < maxbuffer)
{
_ma_check_print_error(sort_param->sort_info->param,
"aria_sort_buffer_size is too small. Current aria_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
goto err;
}
}
while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= (uchar **)
my_malloc(keys*(sort_length+sizeof(char*))+
((sort_param->keyinfo->flag & HA_FULLTEXT) ?
HA_FT_MAXBYTELEN : 0), MYF(0))))
{
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, MY_MIN(maxbuffer / 2, 1000), MYF(0)))
{
my_free(sort_keys);
sort_keys= NULL; /* Safety against double free on error. */
}
else
break;
}
old_memavl= memavl;
if ((memavl= memavl/4*3) < MIN_SORT_MEMORY &&
old_memavl > MIN_SORT_MEMORY)
memavl= MIN_SORT_MEMORY;
}
if (memavl < MIN_SORT_MEMORY)
{
/* purecov: begin inspected */
_ma_check_print_error(sort_param->sort_info->param,
"aria_sort_buffer_size is too small. Current aria_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
my_errno= ENOMEM;
goto err;
/* purecov: end inspected */
}
if (sort_param->sort_info->param->testflag & T_VERBOSE)
my_fprintf(stdout,
"Key %d - Allocating buffer for %llu keys\n",
sort_param->key + 1, (ulonglong) keys);
sort_param->sort_keys= sort_keys;
idx= error= 0;
sort_keys[0]= (uchar*) (sort_keys+keys);
DBUG_PRINT("info", ("reading keys"));
while (!(error= sort_param->sort_info->got_error) &&
!(error= (*sort_param->key_read)(sort_param, sort_keys[idx])))
{
if (sort_param->real_key_length > sort_param->key_length)
{
if (write_key(sort_param, sort_keys[idx],
&sort_param->tempfile_for_exceptions))
goto err;
continue;
}
if (++idx == keys)
{
if (sort_param->write_keys(sort_param, sort_keys, idx - 1,
(BUFFPEK *)alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
sort_keys[0]= (uchar*) (sort_keys+keys);
memcpy(sort_keys[0], sort_keys[idx - 1], (size_t) sort_param->key_length);
idx= 1;
}
sort_keys[idx]= sort_keys[idx - 1] + sort_param->key_length;
}
if (error > 0)
goto err;
if (sort_param->buffpek.elements)
{
if (sort_param->write_keys(sort_param,sort_keys, idx,
(BUFFPEK *) alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
sort_param->keys= (sort_param->buffpek.elements - 1) * (keys - 1) + idx;
}
else
sort_param->keys= idx;
DBUG_RETURN(FALSE);
err:
DBUG_PRINT("error", ("got some error"));
my_free(sort_keys);
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
close_cached_file(&sort_param->tempfile_for_exceptions);
DBUG_RETURN(TRUE);
}
/* Search after all keys and place them in a temp. file */ /* Search after all keys and place them in a temp. file */
pthread_handler_t _ma_thr_find_all_keys(void *arg) pthread_handler_t _ma_thr_find_all_keys(void *arg)
{ {
MARIA_SORT_PARAM *sort_param= (MARIA_SORT_PARAM*) arg; MARIA_SORT_PARAM *sort_param= (MARIA_SORT_PARAM*) arg;
int error; my_bool error= FALSE;
size_t memavl, old_memavl; /* If my_thread_init fails */
longlong sortbuff_size; if (my_thread_init() || _ma_thr_find_all_keys_exec(sort_param))
ha_keys keys, idx; error= TRUE;
uint sort_length;
uint maxbuffer;
uchar **sort_keys=0;
LINT_INIT(keys); /*
Thread must clean up after itself.
*/
free_root(&sort_param->wordroot, MYF(0));
/*
Detach from the share if the writer is involved. Avoid others to
be blocked. This includes a flush of the write buffer. This will
also indicate EOF to the readers.
That means that a writer always gets here first and readers -
only when they see EOF. But if a reader finishes prematurely
because of an error it may reach this earlier - don't allow it
to detach the writer thread.
*/
if (sort_param->master && sort_param->sort_info->info->rec_cache.share)
remove_io_thread(&sort_param->sort_info->info->rec_cache);
error=1; /* Readers detach from the share if any. Avoid others to be blocked. */
if (sort_param->read_cache.share)
remove_io_thread(&sort_param->read_cache);
if (my_thread_init()) mysql_mutex_lock(&sort_param->sort_info->mutex);
goto err; if (error)
sort_param->sort_info->got_error= 1;
{ /* Add extra block since DBUG_ENTER declare variables */ if (!--sort_param->sort_info->threads_running)
DBUG_ENTER("_ma_thr_find_all_keys"); mysql_cond_signal(&sort_param->sort_info->cond);
DBUG_PRINT("enter", ("master: %d", sort_param->master)); mysql_mutex_unlock(&sort_param->sort_info->mutex);
if (sort_param->sort_info->got_error)
goto err;
if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY)
{
sort_param->write_keys= write_keys_varlen;
sort_param->read_to_buffer= read_to_buffer_varlen;
sort_param->write_key= write_merge_key_varlen;
}
else
{
sort_param->write_keys= write_keys;
sort_param->read_to_buffer= read_to_buffer;
sort_param->write_key= write_merge_key;
}
my_b_clear(&sort_param->tempfile);
my_b_clear(&sort_param->tempfile_for_exceptions);
bzero((char*) &sort_param->buffpek,sizeof(sort_param->buffpek));
bzero((char*) &sort_param->unique, sizeof(sort_param->unique));
sortbuff_size= sort_param->sortbuff_size;
memavl= MY_MAX(sortbuff_size, MIN_SORT_MEMORY);
idx= (ha_keys) sort_param->sort_info->max_records;
sort_length= sort_param->key_length;
maxbuffer= 1;
while (memavl >= MIN_SORT_MEMORY)
{
if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <= (my_off_t) memavl)
keys= idx+1;
else if ((sort_param->sort_info->param->testflag &
(T_FORCE_SORT_MEMORY | T_CREATE_MISSING_KEYS)) ==
T_FORCE_SORT_MEMORY)
{
/*
Use all of the given sort buffer for key data.
Allocate 1000 buffers at a start for new data. More buffers
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
uint maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
if (memavl < sizeof(BUFFPEK)*maxbuffer ||
(keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
(sort_length+sizeof(char*))) <= 1 ||
keys < maxbuffer)
{
_ma_check_print_error(sort_param->sort_info->param,
"aria_sort_buffer_size is too small. Current aria_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
goto err;
}
}
while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= (uchar **)
my_malloc(keys*(sort_length+sizeof(char*))+
((sort_param->keyinfo->flag & HA_FULLTEXT) ?
HA_FT_MAXBYTELEN : 0), MYF(0))))
{
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, MY_MIN(maxbuffer/2, 1000), MYF(0)))
{
my_free(sort_keys);
sort_keys= (uchar **) NULL; /* for err: label */
}
else
break;
}
old_memavl= memavl;
if ((memavl= memavl/4*3) < MIN_SORT_MEMORY &&
old_memavl > MIN_SORT_MEMORY)
memavl= MIN_SORT_MEMORY;
}
if (memavl < MIN_SORT_MEMORY)
{
/* purecov: begin inspected */
_ma_check_print_error(sort_param->sort_info->param,
"aria_sort_buffer_size is too small. Current aria_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
my_errno= ENOMEM;
goto err;
/* purecov: end inspected */
}
if (sort_param->sort_info->param->testflag & T_VERBOSE)
my_fprintf(stdout,
"Key %d - Allocating buffer for %llu keys\n",
sort_param->key + 1, (ulonglong) keys);
sort_param->sort_keys= sort_keys;
idx= error= 0;
sort_keys[0]= (uchar*) (sort_keys+keys);
DBUG_PRINT("info", ("reading keys"));
while (!(error= sort_param->sort_info->got_error) &&
!(error= (*sort_param->key_read)(sort_param, sort_keys[idx])))
{
if (sort_param->real_key_length > sort_param->key_length)
{
if (write_key(sort_param, sort_keys[idx],
&sort_param->tempfile_for_exceptions))
goto err;
continue;
}
if (++idx == keys)
{
if (sort_param->write_keys(sort_param, sort_keys, idx - 1,
(BUFFPEK *)alloc_dynamic(&sort_param->
buffpek),
&sort_param->tempfile))
goto err;
sort_keys[0]= (uchar*) (sort_keys+keys);
memcpy(sort_keys[0], sort_keys[idx - 1],
(size_t) sort_param->key_length);
idx= 1;
}
sort_keys[idx]= sort_keys[idx - 1] + sort_param->key_length;
}
if (error > 0)
goto err;
if (sort_param->buffpek.elements)
{
if (sort_param->write_keys(sort_param,sort_keys, idx,
(BUFFPEK *) alloc_dynamic(&sort_param->
buffpek),
&sort_param->tempfile))
goto err;
sort_param->keys= (sort_param->buffpek.elements - 1) * (keys - 1) + idx;
}
else
sort_param->keys= idx;
goto ok;
err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
my_free(sort_keys);
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
close_cached_file(&sort_param->tempfile_for_exceptions);
ok:
free_root(&sort_param->wordroot, MYF(0));
/*
Detach from the share if the writer is involved. Avoid others to
be blocked. This includes a flush of the write buffer. This will
also indicate EOF to the readers.
That means that a writer always gets here first and readers -
only when they see EOF. But if a reader finishes prematurely
because of an error it may reach this earlier - don't allow it
to detach the writer thread.
*/
if (sort_param->master && sort_param->sort_info->info->rec_cache.share)
remove_io_thread(&sort_param->sort_info->info->rec_cache);
/* Readers detach from the share if any. Avoid others to be blocked. */
if (sort_param->read_cache.share)
remove_io_thread(&sort_param->read_cache);
mysql_mutex_lock(&sort_param->sort_info->mutex);
if (!--sort_param->sort_info->threads_running)
mysql_cond_signal(&sort_param->sort_info->cond);
mysql_mutex_unlock(&sort_param->sort_info->mutex);
DBUG_PRINT("exit", ("======== ending thread ========"));
}
my_thread_end(); my_thread_end();
return NULL; return NULL;
} }
@ -563,7 +564,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
{ {
MARIA_SORT_INFO *sort_info=sort_param->sort_info; MARIA_SORT_INFO *sort_info=sort_param->sort_info;
HA_CHECK *param=sort_info->param; HA_CHECK *param=sort_info->param;
ulong UNINIT_VAR(length), keys; size_t UNINIT_VAR(length), keys;
double *rec_per_key_part= param->new_rec_per_key_part; double *rec_per_key_part= param->new_rec_per_key_part;
int got_error=sort_info->got_error; int got_error=sort_info->got_error;
uint i; uint i;
@ -617,18 +618,9 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
{ {
if (got_error) if (got_error)
continue; continue;
if (sinfo->keyinfo->flag & HA_VAR_LENGTH_KEY)
{ set_sort_param_read_write(sinfo);
sinfo->write_keys=write_keys_varlen;
sinfo->read_to_buffer=read_to_buffer_varlen;
sinfo->write_key=write_merge_key_varlen;
}
else
{
sinfo->write_keys=write_keys;
sinfo->read_to_buffer=read_to_buffer;
sinfo->write_key=write_merge_key;
}
if (sinfo->buffpek.elements) if (sinfo->buffpek.elements)
{ {
uint maxbuffer=sinfo->buffpek.elements-1; uint maxbuffer=sinfo->buffpek.elements-1;

View File

@ -67,7 +67,8 @@ typedef struct st_maria_sort_info
pgcache_page_no_t page; pgcache_page_no_t page;
ha_rows max_records; ha_rows max_records;
uint current_key, total_keys; uint current_key, total_keys;
uint got_error, threads_running; volatile uint got_error;
uint threads_running;
myf myf_rw; myf myf_rw;
enum data_file_type new_data_file_type, org_data_file_type; enum data_file_type new_data_file_type, org_data_file_type;
} MARIA_SORT_INFO; } MARIA_SORT_INFO;

View File

@ -86,6 +86,28 @@ static int write_merge_key_varlen(MI_SORT_PARAM *info,
static inline int static inline int
my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs);
/*
Sets the appropriate read and write methods for the MI_SORT_PARAM
based on the variable length key flag.
*/
static void set_sort_param_read_write(MI_SORT_PARAM *sort_param)
{
if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY)
{
sort_param->write_keys= write_keys_varlen;
sort_param->read_to_buffer= read_to_buffer_varlen;
sort_param->write_key= write_merge_key_varlen;
}
else
{
sort_param->write_keys= write_keys;
sort_param->read_to_buffer= read_to_buffer;
sort_param->write_key= write_merge_key;
}
}
/* /*
Creates a index of sorted keys Creates a index of sorted keys
@ -113,18 +135,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
DBUG_ENTER("_create_index_by_sort"); DBUG_ENTER("_create_index_by_sort");
DBUG_PRINT("enter",("sort_length: %u", info->key_length)); DBUG_PRINT("enter",("sort_length: %u", info->key_length));
if (info->keyinfo->flag & HA_VAR_LENGTH_KEY) set_sort_param_read_write(info);
{
info->write_keys=write_keys_varlen;
info->read_to_buffer=read_to_buffer_varlen;
info->write_key= write_merge_key_varlen;
}
else
{
info->write_keys=write_keys;
info->read_to_buffer=read_to_buffer;
info->write_key=write_merge_key;
}
my_b_clear(&tempfile); my_b_clear(&tempfile);
my_b_clear(&tempfile_for_exceptions); my_b_clear(&tempfile_for_exceptions);
@ -334,205 +345,197 @@ static ha_rows find_all_keys(MI_SORT_PARAM *info, ha_rows keys,
DBUG_RETURN((*maxbuffer)*(keys-1)+idx); DBUG_RETURN((*maxbuffer)*(keys-1)+idx);
} /* find_all_keys */ } /* find_all_keys */
static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
{
ulonglong memavl, old_memavl, sortbuff_size;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
uint maxbuffer;
uchar **sort_keys= NULL;
int error= 0;
DBUG_ENTER("thr_find_all_keys");
DBUG_PRINT("enter", ("master: %d", sort_param->master));
if (sort_param->sort_info->got_error)
DBUG_RETURN(TRUE);
set_sort_param_read_write(sort_param);
my_b_clear(&sort_param->tempfile);
my_b_clear(&sort_param->tempfile_for_exceptions);
bzero((char*) &sort_param->buffpek, sizeof(sort_param->buffpek));
bzero((char*) &sort_param->unique, sizeof(sort_param->unique));
sortbuff_size= sort_param->sortbuff_size;
memavl= MY_MAX(sortbuff_size, MIN_SORT_BUFFER);
idx= (ha_keys) sort_param->sort_info->max_records;
sort_length= sort_param->key_length;
maxbuffer= 1;
while (memavl >= MIN_SORT_BUFFER)
{
if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <=
(my_off_t) memavl)
keys= idx+1;
else if ((sort_param->sort_info->param->testflag &
(T_FORCE_SORT_MEMORY | T_CREATE_MISSING_KEYS)) ==
T_FORCE_SORT_MEMORY)
{
/*
Use all of the given sort buffer for key data.
Allocate 1000 buffers at a start for new data. More buffers
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
uint maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
if (memavl < sizeof(BUFFPEK)*maxbuffer ||
(keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
(sort_length+sizeof(char*))) <= 1 ||
keys < (uint) maxbuffer)
{
mi_check_print_error(sort_param->sort_info->param,
"myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
DBUG_RETURN(TRUE);
}
}
while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= (uchar**) my_malloc(keys * (sort_length + sizeof(char*)) +
((sort_param->keyinfo->flag & HA_FULLTEXT) ?
HA_FT_MAXBYTELEN : 0), MYF(0))))
{
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, MY_MIN(maxbuffer / 2, 1000), MYF(0)))
{
my_free(sort_keys);
sort_keys= NULL; /* Safety against double free on error. */
}
else
break;
}
old_memavl= memavl;
if ((memavl= memavl / 4 * 3) < MIN_SORT_BUFFER &&
old_memavl > MIN_SORT_BUFFER)
memavl= MIN_SORT_BUFFER;
}
if (memavl < MIN_SORT_BUFFER)
{
/* purecov: begin inspected */
mi_check_print_error(sort_param->sort_info->param,
"myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
my_errno= ENOMEM;
goto err;
/* purecov: end inspected */
}
if (sort_param->sort_info->param->testflag & T_VERBOSE)
my_fprintf(stdout,
"Key %d - Allocating buffer for %llu keys\n",
sort_param->key + 1, (ulonglong) keys);
sort_param->sort_keys= sort_keys;
idx= error= 0;
sort_keys[0]= (uchar*) (sort_keys+keys);
DBUG_PRINT("info", ("reading keys"));
while (!(error= sort_param->sort_info->got_error) &&
!(error= (*sort_param->key_read)(sort_param, sort_keys[idx])))
{
if (sort_param->real_key_length > sort_param->key_length)
{
if (write_key(sort_param, sort_keys[idx],
&sort_param->tempfile_for_exceptions))
goto err;
continue;
}
if (++idx == keys)
{
if (sort_param->write_keys(sort_param, sort_keys, idx - 1,
(BUFFPEK*) alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
sort_keys[0]= (uchar*) (sort_keys+keys);
memcpy(sort_keys[0], sort_keys[idx - 1], (size_t) sort_param->key_length);
idx= 1;
}
sort_keys[idx]= sort_keys[idx - 1] + sort_param->key_length;
}
if (error > 0)
goto err;
if (sort_param->buffpek.elements)
{
if (sort_param->write_keys(sort_param, sort_keys, idx,
(BUFFPEK*) alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
sort_param->keys= (sort_param->buffpek.elements - 1) * (keys - 1) + idx;
}
else
sort_param->keys= idx;
DBUG_RETURN(FALSE);
err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
my_free(sort_keys);
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
close_cached_file(&sort_param->tempfile_for_exceptions);
DBUG_RETURN(TRUE);
}
/* Search after all keys and place them in a temp. file */ /* Search after all keys and place them in a temp. file */
pthread_handler_t thr_find_all_keys(void *arg) pthread_handler_t thr_find_all_keys(void *arg)
{ {
MI_SORT_PARAM *sort_param= (MI_SORT_PARAM*) arg; MI_SORT_PARAM *sort_param= (MI_SORT_PARAM*) arg;
int error; my_bool error= FALSE;
ulonglong memavl, old_memavl, sortbuff_size; /* If my_thread_init fails */
ha_keys keys, idx; if (my_thread_init() || thr_find_all_keys_exec(sort_param))
uint sort_length; error= TRUE;
uint maxbuffer;
uchar **sort_keys=0;
LINT_INIT(keys); /*
Thread must clean up after itself.
*/
free_root(&sort_param->wordroot, MYF(0));
/*
Detach from the share if the writer is involved. Avoid others to
be blocked. This includes a flush of the write buffer. This will
also indicate EOF to the readers.
That means that a writer always gets here first and readers -
only when they see EOF. But if a reader finishes prematurely
because of an error it may reach this earlier - don't allow it
to detach the writer thread.
*/
if (sort_param->master && sort_param->sort_info->info->rec_cache.share)
remove_io_thread(&sort_param->sort_info->info->rec_cache);
error=1; /* Readers detach from the share if any. Avoid others to be blocked. */
if (sort_param->read_cache.share)
remove_io_thread(&sort_param->read_cache);
if (my_thread_init()) mysql_mutex_lock(&sort_param->sort_info->mutex);
goto err; if (error)
sort_param->sort_info->got_error= 1;
{ /* Add extra block since DBUG_ENTER declare variables */ if (!--sort_param->sort_info->threads_running)
DBUG_ENTER("thr_find_all_keys"); mysql_cond_signal(&sort_param->sort_info->cond);
DBUG_PRINT("enter", ("master: %d", sort_param->master)); mysql_mutex_unlock(&sort_param->sort_info->mutex);
if (sort_param->sort_info->got_error)
goto err;
if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY)
{
sort_param->write_keys= write_keys_varlen;
sort_param->read_to_buffer= read_to_buffer_varlen;
sort_param->write_key= write_merge_key_varlen;
}
else
{
sort_param->write_keys= write_keys;
sort_param->read_to_buffer= read_to_buffer;
sort_param->write_key= write_merge_key;
}
my_b_clear(&sort_param->tempfile);
my_b_clear(&sort_param->tempfile_for_exceptions);
bzero((char*) &sort_param->buffpek, sizeof(sort_param->buffpek));
bzero((char*) &sort_param->unique, sizeof(sort_param->unique));
sort_keys= (uchar **) NULL;
sortbuff_size= sort_param->sortbuff_size;
memavl= MY_MAX(sortbuff_size, MIN_SORT_BUFFER);
idx= (ha_keys) sort_param->sort_info->max_records;
sort_length= sort_param->key_length;
maxbuffer= 1;
while (memavl >= MIN_SORT_BUFFER)
{
if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <=
(my_off_t) memavl)
keys= idx+1;
else if ((sort_param->sort_info->param->testflag &
(T_FORCE_SORT_MEMORY | T_CREATE_MISSING_KEYS)) ==
T_FORCE_SORT_MEMORY)
{
/*
Use all of the given sort buffer for key data.
Allocate 1000 buffers at a start for new data. More buffers
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
uint maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
if (memavl < sizeof(BUFFPEK)*maxbuffer ||
(keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
(sort_length+sizeof(char*))) <= 1 ||
keys < (uint) maxbuffer)
{
mi_check_print_error(sort_param->sort_info->param,
"myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
goto err;
}
}
while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= (uchar**)
my_malloc(keys*(sort_length+sizeof(char*))+
((sort_param->keyinfo->flag & HA_FULLTEXT) ?
HA_FT_MAXBYTELEN : 0), MYF(0))))
{
if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK),
maxbuffer, MY_MIN(maxbuffer/2, 1000), MYF(0)))
{
my_free(sort_keys);
sort_keys= (uchar **) NULL; /* for err: label */
}
else
break;
}
old_memavl= memavl;
if ((memavl= memavl / 4 * 3) < MIN_SORT_BUFFER &&
old_memavl > MIN_SORT_BUFFER)
memavl= MIN_SORT_BUFFER;
}
if (memavl < MIN_SORT_BUFFER)
{
/* purecov: begin inspected */
mi_check_print_error(sort_param->sort_info->param,
"myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: %llu rows: %llu sort_length: %u",
sortbuff_size, (ulonglong) idx, sort_length);
my_errno= ENOMEM;
goto err;
/* purecov: end inspected */
}
if (sort_param->sort_info->param->testflag & T_VERBOSE)
my_fprintf(stdout,
"Key %d - Allocating buffer for %llu keys\n",
sort_param->key + 1, (ulonglong) keys);
sort_param->sort_keys= sort_keys;
idx= error= 0;
sort_keys[0]= (uchar*) (sort_keys+keys);
DBUG_PRINT("info", ("reading keys"));
while (!(error= sort_param->sort_info->got_error) &&
!(error= (*sort_param->key_read)(sort_param, sort_keys[idx])))
{
if (sort_param->real_key_length > sort_param->key_length)
{
if (write_key(sort_param, sort_keys[idx],
&sort_param->tempfile_for_exceptions))
goto err;
continue;
}
if (++idx == keys)
{
if (sort_param->write_keys(sort_param, sort_keys, idx - 1,
(BUFFPEK*) alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
sort_keys[0]= (uchar*) (sort_keys+keys);
memcpy(sort_keys[0], sort_keys[idx - 1],
(size_t) sort_param->key_length);
idx= 1;
}
sort_keys[idx]= sort_keys[idx - 1] + sort_param->key_length;
}
if (error > 0)
goto err;
if (sort_param->buffpek.elements)
{
if (sort_param->write_keys(sort_param, sort_keys, idx,
(BUFFPEK*) alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
sort_param->keys= (sort_param->buffpek.elements - 1) * (keys - 1) + idx;
}
else
sort_param->keys= idx;
goto ok;
err:
DBUG_PRINT("error", ("got some error"));
sort_param->sort_info->got_error= 1; /* no need to protect with a mutex */
my_free(sort_keys);
sort_param->sort_keys= 0;
delete_dynamic(& sort_param->buffpek);
close_cached_file(&sort_param->tempfile);
close_cached_file(&sort_param->tempfile_for_exceptions);
ok:
free_root(&sort_param->wordroot, MYF(0));
/*
Detach from the share if the writer is involved. Avoid others to
be blocked. This includes a flush of the write buffer. This will
also indicate EOF to the readers.
That means that a writer always gets here first and readers -
only when they see EOF. But if a reader finishes prematurely
because of an error it may reach this earlier - don't allow it
to detach the writer thread.
*/
if (sort_param->master && sort_param->sort_info->info->rec_cache.share)
remove_io_thread(&sort_param->sort_info->info->rec_cache);
/* Readers detach from the share if any. Avoid others to be blocked. */
if (sort_param->read_cache.share)
remove_io_thread(&sort_param->read_cache);
mysql_mutex_lock(&sort_param->sort_info->mutex);
if (!--sort_param->sort_info->threads_running)
mysql_cond_signal(&sort_param->sort_info->cond);
mysql_mutex_unlock(&sort_param->sort_info->mutex);
DBUG_PRINT("exit", ("======== ending thread ========"));
}
my_thread_end(); my_thread_end();
return NULL; return NULL;
} }
@ -596,18 +599,9 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
{ {
if (got_error) if (got_error)
continue; continue;
if (sinfo->keyinfo->flag & HA_VAR_LENGTH_KEY)
{ set_sort_param_read_write(sinfo);
sinfo->write_keys=write_keys_varlen;
sinfo->read_to_buffer=read_to_buffer_varlen;
sinfo->write_key=write_merge_key_varlen;
}
else
{
sinfo->write_keys=write_keys;
sinfo->read_to_buffer=read_to_buffer;
sinfo->write_key=write_merge_key;
}
if (sinfo->buffpek.elements) if (sinfo->buffpek.elements)
{ {
uint maxbuffer=sinfo->buffpek.elements-1; uint maxbuffer=sinfo->buffpek.elements-1;

View File

@ -12762,6 +12762,34 @@ ha_innobase::check(
DBUG_RETURN(HA_ADMIN_CORRUPT); DBUG_RETURN(HA_ADMIN_CORRUPT);
} }
if (prebuilt->table->corrupted) {
char index_name[MAX_FULL_NAME_LEN + 1];
/* If some previous operation has marked the table as
corrupted in memory, and has not propagated such to
clustered index, we will do so here */
index = dict_table_get_first_index(prebuilt->table);
if (!dict_index_is_corrupted(index)) {
row_mysql_lock_data_dictionary(prebuilt->trx);
dict_set_corrupted(index, prebuilt->trx, "CHECK TABLE");
row_mysql_unlock_data_dictionary(prebuilt->trx);
}
innobase_format_name(index_name, sizeof index_name,
index->name, TRUE);
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_INDEX_CORRUPT,
"InnoDB: Index %s is marked as"
" corrupted", index_name);
/* Now that the table is already marked as corrupted,
there is no need to check any index of this table */
prebuilt->trx->op_info = "";
DBUG_RETURN(HA_ADMIN_CORRUPT);
}
prebuilt->trx->op_info = "checking table"; prebuilt->trx->op_info = "checking table";
old_isolation_level = prebuilt->trx->isolation_level; old_isolation_level = prebuilt->trx->isolation_level;
@ -12832,6 +12860,15 @@ ha_innobase::check(
prebuilt->index_usable = row_merge_is_index_usable( prebuilt->index_usable = row_merge_is_index_usable(
prebuilt->trx, prebuilt->index); prebuilt->trx, prebuilt->index);
DBUG_EXECUTE_IF(
"dict_set_index_corrupted",
if (!dict_index_is_clust(index)) {
prebuilt->index_usable = FALSE;
row_mysql_lock_data_dictionary(prebuilt->trx);
dict_set_corrupted(index, prebuilt->trx, "dict_set_index_corrupted");;
row_mysql_unlock_data_dictionary(prebuilt->trx);
});
if (UNIV_UNLIKELY(!prebuilt->index_usable)) { if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
innobase_format_name( innobase_format_name(
index_name, sizeof index_name, index_name, sizeof index_name,

View File

@ -3884,6 +3884,24 @@ check_if_can_drop_indexes:
drop_index = NULL; drop_index = NULL;
} }
/* Check if any of the existing indexes are marked as corruption
and if they are, refuse adding more indexes. */
if (ha_alter_info->handler_flags & Alter_inplace_info::ADD_INDEX) {
for (dict_index_t* index = dict_table_get_first_index(indexed_table);
index != NULL; index = dict_table_get_next_index(index)) {
if (!index->to_be_dropped && dict_index_is_corrupted(index)) {
char index_name[MAX_FULL_NAME_LEN + 1];
innobase_format_name(index_name, sizeof index_name,
index->name, TRUE);
my_error(ER_INDEX_CORRUPT, MYF(0), index_name);
DBUG_RETURN(true);
}
}
}
n_add_fk = 0; n_add_fk = 0;
if (ha_alter_info->handler_flags if (ha_alter_info->handler_flags

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2011, 2015, MariaDB Copyright (c) 2011, 2016, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -213,7 +213,7 @@ new_VioSSLFd(const char *key_file, const char *cert_file,
} }
/* Load certs from the trusted ca */ /* Load certs from the trusted ca */
if (SSL_CTX_load_verify_locations(ssl_fd->ssl_context, ca_file, ca_path) == 0) if (SSL_CTX_load_verify_locations(ssl_fd->ssl_context, ca_file, ca_path) <= 0)
{ {
DBUG_PRINT("warning", ("SSL_CTX_load_verify_locations failed")); DBUG_PRINT("warning", ("SSL_CTX_load_verify_locations failed"));
if (ca_file || ca_path) if (ca_file || ca_path)

View File

@ -66,6 +66,7 @@
<CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" /> <CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />
<!-- <!--
User interface dialogs User interface dialogs
--> -->
@ -463,7 +464,7 @@
Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@' Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/> Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/>
<CreateFolder> <CreateFolder>
<util:PermissionEx User="[LogonUser]" GenericAll="yes" /> <util:PermissionEx User="[LogonUser]" Domain="[USER_DOMAIN]" GenericAll="yes" />
<util:PermissionEx User="NetworkService" GenericAll="yes" /> <util:PermissionEx User="NetworkService" GenericAll="yes" />
</CreateFolder> </CreateFolder>
</Component> </Component>
@ -542,17 +543,6 @@
Value="utf8" /> Value="utf8" />
</Component> </Component>
<!--- Grant service account permission to the database folder (Windows 7 and later) -->
<Component Id="C.serviceaccount.permission" Guid="*" Directory='DATADIR' Transitive='yes'>
<Condition><![CDATA[SERVICENAME AND (VersionNT > 600)]]></Condition>
<RegistryValue Root='HKLM'
Key='SOFTWARE\Monty Program AB\@CPACK_WIX_PACKAGE_NAME@'
Name='servicepermission' Value='1' Type='string' KeyPath='yes'/>
<CreateFolder>
<util:PermissionEx User="NT SERVICE\[SERVICENAME]" GenericAll="yes" />
</CreateFolder>
</Component>
<!-- Shortcuts in program menu (mysql client etc) --> <!-- Shortcuts in program menu (mysql client etc) -->
<Component Id="c.shortcuts" Guid="*" Directory="ShortcutFolder"> <Component Id="c.shortcuts" Guid="*" Directory="ShortcutFolder">
<!-- shortcut to my.ini--> <!-- shortcut to my.ini-->
@ -862,6 +852,7 @@
<Property Id="ARPSYSTEMCOMPONENT" Value="1" Secure="yes" /> <Property Id="ARPSYSTEMCOMPONENT" Value="1" Secure="yes" />
<Property Id="ARPINSTALLLOCATION" Secure="yes"/> <Property Id="ARPINSTALLLOCATION" Secure="yes"/>
<SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="InstallValidate" Sequence="execute"/> <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="InstallValidate" Sequence="execute"/>
<SetProperty Id="USER_DOMAIN" Value="[%USERDOMAIN]" After="LaunchConditions" Sequence="first" />
<Feature Id='ARPRegistryEntries' <Feature Id='ARPRegistryEntries'
Title='Add or remove program entries' Title='Add or remove program entries'
Description='Add or remove program entries' Description='Add or remove program entries'
@ -908,6 +899,9 @@
<Condition Message= <Condition Message=
'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'> 'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'>
<![CDATA[ALLUSERS = "1"]]> <![CDATA[ALLUSERS = "1"]]>
</Condition>
<Condition Message='This application is only supported on Windows Vista, Windows Server 2008, or higher.'>
<![CDATA[Installed OR (VersionNT >= 600)]]>
</Condition> </Condition>
</Fragment> </Fragment>
</Wix> </Wix>

View File

@ -1,4 +1,4 @@
SET(HEIDISQL_BASE_NAME "HeidiSQL_9.1_Portable") SET(HEIDISQL_BASE_NAME "HeidiSQL_9.3_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME}) SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})