mysql-5.5.33 merge

This commit is contained in:
Sergei Golubchik 2013-09-06 22:31:30 +02:00
commit b838d081ad
315 changed files with 2012 additions and 1282 deletions

View File

@ -282,6 +282,7 @@ IF(WITH_UNIT_TESTS)
ADD_SUBDIRECTORY(unittest/strings) ADD_SUBDIRECTORY(unittest/strings)
ADD_SUBDIRECTORY(unittest/examples) ADD_SUBDIRECTORY(unittest/examples)
ADD_SUBDIRECTORY(unittest/mysys) ADD_SUBDIRECTORY(unittest/mysys)
ADD_SUBDIRECTORY(unittest/my_decimal)
ENDIF() ENDIF()
IF(NOT WITHOUT_SERVER) IF(NOT WITHOUT_SERVER)

View File

@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=32 MYSQL_VERSION_PATCH=33
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=

View File

@ -2546,6 +2546,7 @@ void *sql_alloc(size_t size)
the server the server
*/ */
#include "rpl_tblmap.cc"
#undef TABLE #undef TABLE
#include "my_decimal.h" #include "my_decimal.h"
#include "decimal.c" #include "decimal.c"

View File

@ -87,15 +87,6 @@
/* Chars needed to store LONGLONG, excluding trailing '\0'. */ /* Chars needed to store LONGLONG, excluding trailing '\0'. */
#define LONGLONG_LEN 20 #define LONGLONG_LEN 20
/* general_log or slow_log tables under mysql database */
static inline my_bool general_log_or_slow_log_tables(const char *db,
const char *table)
{
return (strcmp(db, "mysql") == 0) &&
((strcmp(table, "general_log") == 0) ||
(strcmp(table, "slow_log") == 0));
}
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, uint length,
@ -2466,6 +2457,15 @@ static uint dump_routines_for_db(char *db)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* general_log or slow_log tables under mysql database */
static inline my_bool general_log_or_slow_log_tables(const char *db,
const char *table)
{
return (!my_strcasecmp(charset_info, db, "mysql")) &&
(!my_strcasecmp(charset_info, table, "general_log") ||
!my_strcasecmp(charset_info, table, "slow_log"));
}
/* /*
get_table_structure -- retrievs database structure, prints out corresponding get_table_structure -- retrievs database structure, prints out corresponding
CREATE statement and fills out insert_pat if the table is the type we will CREATE statement and fills out insert_pat if the table is the type we will
@ -4340,7 +4340,8 @@ static int dump_all_tables_in_db(char *database)
char table_buff[NAME_LEN*2+3]; char table_buff[NAME_LEN*2+3];
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */ char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
char *afterdot; char *afterdot;
int using_mysql_db= my_strcasecmp(&my_charset_latin1, database, "mysql"); my_bool general_log_table_exists= 0, slow_log_table_exists=0;
int using_mysql_db= !my_strcasecmp(charset_info, database, "mysql");
DBUG_ENTER("dump_all_tables_in_db"); DBUG_ENTER("dump_all_tables_in_db");
afterdot= strmov(hash_key, database); afterdot= strmov(hash_key, database);
@ -4351,22 +4352,6 @@ static int dump_all_tables_in_db(char *database)
if (opt_xml) if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (strcmp(database, "mysql") == 0)
{
char table_type[NAME_LEN];
char ignore_flag;
uint num_fields;
num_fields= get_table_structure((char *) "general_log",
database, table_type, &ignore_flag);
if (num_fields == 0)
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'general_log' table\n");
num_fields= get_table_structure((char *) "slow_log",
database, table_type, &ignore_flag);
if (num_fields == 0)
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'slow_log' table\n");
}
if (lock_tables) if (lock_tables)
{ {
DYNAMIC_STRING query; DYNAMIC_STRING query;
@ -4412,6 +4397,26 @@ static int dump_all_tables_in_db(char *database)
} }
} }
} }
else
{
/*
If general_log and slow_log exists in the 'mysql' database,
we should dump the table structure. But we cannot
call get_table_structure() here as 'LOCK TABLES' query got executed
above on the session and that 'LOCK TABLES' query does not contain
'general_log' and 'slow_log' tables. (you cannot acquire lock
on log tables). Hence mark the existence of these log tables here and
after 'UNLOCK TABLES' query is executed on the session, get the table
structure from server and dump it in the file.
*/
if (using_mysql_db)
{
if (!my_strcasecmp(charset_info, table, "general_log"))
general_log_table_exists= 1;
else if (!my_strcasecmp(charset_info, table, "slow_log"))
slow_log_table_exists= 1;
}
}
} }
if (opt_events && mysql_get_server_version(mysql) >= 50106) if (opt_events && mysql_get_server_version(mysql) >= 50106)
{ {
@ -4430,7 +4435,26 @@ static int dump_all_tables_in_db(char *database)
} }
if (lock_tables) if (lock_tables)
(void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"); (void) mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES");
if (flush_privileges && using_mysql_db == 0) if (using_mysql_db)
{
char table_type[NAME_LEN];
char ignore_flag;
if (general_log_table_exists)
{
if (!get_table_structure((char *) "general_log",
database, table_type, &ignore_flag) )
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'general_log' table\n");
}
if (slow_log_table_exists)
{
if (!get_table_structure((char *) "slow_log",
database, table_type, &ignore_flag) )
verbose_msg("-- Warning: get_table_structure() failed with some internal "
"error for 'slow_log' table\n");
}
}
if (flush_privileges && using_mysql_db)
{ {
fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n"); fprintf(md_result_file,"\n--\n-- Flush Grant Tables \n--\n");
fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n"); fprintf(md_result_file,"\n/*! FLUSH PRIVILEGES */;\n");

View File

@ -1,4 +1,4 @@
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2013, 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
@ -164,7 +164,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE)
FOREACH(lib ${libs}) FOREACH(lib ${libs})
GET_TARGET_PROPERTY(libtype ${lib} TYPE) GET_TARGET_PROPERTY(libtype ${lib} TYPE)
IF(libtype MATCHES STATIC_LIBRARY) IF(libtype MATCHES STATIC_LIBRARY)
SET(static_libs ${static_lics} ${lib}) SET(static_libs ${static_libs} ${lib})
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2011, Oracle and/or its affiliates & Anjuta Widenius Copyright (c) 2000, 2013, Oracle and/or its affiliates
Copyright (c) 2008-2011 Monty Program Ab Copyright (c) 2008, 2011, 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

@ -120,6 +120,9 @@ double getopt_double_limit_value(double num, const struct my_option *optp,
my_bool *fix); my_bool *fix);
my_bool getopt_compare_strings(const char *s, const char *t, uint length); my_bool getopt_compare_strings(const char *s, const char *t, uint length);
ulonglong getopt_double2ulonglong(double);
double getopt_ulonglong2double(ulonglong);
C_MODE_END C_MODE_END
#endif /* _my_getopt_h */ #endif /* _my_getopt_h */

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2001, 2012, Oracle and/or its affiliates. Copyright (c) 2001, 2013, 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
@ -390,8 +390,7 @@ C_MODE_END
#define compile_time_assert(X) \ #define compile_time_assert(X) \
do \ do \
{ \ { \
typedef char compile_time_assert[(X) ? 1 : -1] \ typedef char compile_time_assert[(X) ? 1 : -1] __attribute__((unused)); \
__attribute__((unused)); \
} while(0) } while(0)
#endif #endif

View File

@ -206,6 +206,7 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *)
#define PLUGIN_VAR_STR 0x0005 #define PLUGIN_VAR_STR 0x0005
#define PLUGIN_VAR_ENUM 0x0006 #define PLUGIN_VAR_ENUM 0x0006
#define PLUGIN_VAR_SET 0x0007 #define PLUGIN_VAR_SET 0x0007
#define PLUGIN_VAR_DOUBLE 0x0008
#define PLUGIN_VAR_UNSIGNED 0x0080 #define PLUGIN_VAR_UNSIGNED 0x0080
#define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */ #define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */
#define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */ #define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */
@ -388,6 +389,11 @@ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \
PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib } #name, comment, check, update, &varname, def, typelib }
#define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \
PLUGIN_VAR_DOUBLE | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, min, max, blk }
#define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ #define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \
DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \
PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
@ -438,6 +444,11 @@ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \
PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, NULL, typelib } #name, comment, check, update, -1, def, NULL, typelib }
#define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, blk) \
DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \
PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, -1, def, min, max, blk, NULL }
/* accessor macros */ /* accessor macros */
#define SYSVAR(name) \ #define SYSVAR(name) \

View File

@ -1,4 +1,4 @@
# Copyright (c) 2007, 2010, Oracle and/or its affiliates # Copyright (c) 2007, 2013, 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
@ -33,7 +33,7 @@ port-open-timeout=10
log-bin-trust-function-creators=1 log-bin-trust-function-creators=1
key_buffer_size= 1M key_buffer_size= 1M
sort_buffer= 256K sort_buffer_size= 256K
max_heap_table_size= 1M max_heap_table_size= 1M
loose-aria-pagecache-buffer-size=8M loose-aria-pagecache-buffer-size=8M

View File

@ -2067,9 +2067,19 @@ sub executable_setup () {
"$path_client_bindir/mysqltest_embedded"); "$path_client_bindir/mysqltest_embedded");
} }
else else
{
if ( defined $ENV{'MYSQL_TEST'} )
{
$exe_mysqltest=$ENV{'MYSQL_TEST'};
print "===========================================================\n";
print "WARNING:The mysqltest binary is fetched from $exe_mysqltest\n";
print "===========================================================\n";
}
else
{ {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest"); $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
} }
}
} }

View File

@ -2623,13 +2623,13 @@ Warning 1292 Truncated incorrect DECIMAL value: ''
# and other crashes # and other crashes
# #
CREATE TABLE t1 ( a TEXT ); CREATE TABLE t1 ( a TEXT );
SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'bug58165.txt'; SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug58165.txt';;
SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ) insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' )
x x
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'b' Warning 1292 Truncated incorrect INTEGER value: 'b'
LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1;;
SELECT * FROM t1; SELECT * FROM t1;
a a
aaaaaaaaaaaaaa aaaaaaaaaaaaaa

View File

@ -3363,9 +3363,10 @@ COUNT(DISTINCT a, b + 0)
16 16
EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10; EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL a 10 NULL 9 Using index for group-by 1 SIMPLE t1 index NULL a 10 NULL 16 Using index
SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10; SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10;
COUNT(DISTINCT a) COUNT(DISTINCT a)
2
EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT c) < 10; EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT c) < 10;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 1 SIMPLE t1 ALL NULL NULL NULL NULL 16
@ -3499,7 +3500,7 @@ WHERE b = 13 AND c = 42 GROUP BY a;
a COUNT(DISTINCT a) SUM(DISTINCT a) a COUNT(DISTINCT a) SUM(DISTINCT a)
EXPLAIN SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42; EXPLAIN SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL a 10 NULL 9 Using where; Using index for group-by 1 SIMPLE t2 index NULL a 15 NULL 16 Using where; Using index
SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42; SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42;
COUNT(DISTINCT a, b) SUM(DISTINCT a) COUNT(DISTINCT a, b) SUM(DISTINCT a)
0 NULL 0 NULL

View File

@ -5196,7 +5196,7 @@ CREATE TABLE b12809202_db.t1 (c1 INT);
CREATE TABLE b12809202_db.t2 (c1 INT); CREATE TABLE b12809202_db.t2 (c1 INT);
INSERT INTO b12809202_db.t1 VALUES (1), (2), (3); INSERT INTO b12809202_db.t1 VALUES (1), (2), (3);
INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); INSERT INTO b12809202_db.t2 VALUES (1), (2), (3);
# Starting mysqldump with --single-transaction & --flush-log options.. # Starting mysqldump with --single-transaction & --flush-logs options..
# Note : In the following dump the transaction # Note : In the following dump the transaction
# should start only after the logs are # should start only after the logs are
# flushed, as 'flush logs' causes implicit # flushed, as 'flush logs' causes implicit

View File

@ -106,8 +106,8 @@ test.t1 check Error Incorrect information in file: './test/t1.frm'
test.t1 check error Corrupt test.t1 check error Corrupt
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Failed to read from the .par file ERROR HY000: Failed to read from the .par file
# Note that it is currently impossible to drop a partitioned table # Note that we will remove the frm file when we detect that
# without the .par file # .par file has been deleted.
DROP TABLE t1; DROP TABLE t1;
ERROR 42S02: Unknown table 't1' ERROR 42S02: Unknown table 't1'
# #

View File

@ -42,9 +42,11 @@ set global example_ulong_var=500;
set global example_enum_var= e1; set global example_enum_var= e1;
show status like 'example%'; show status like 'example%';
Variable_name Value Variable_name Value
example_func_example enum_var is 0, ulong_var is 500, really example_func_example enum_var is 0, ulong_var is 500, double_var is 8.500000, really
show variables like 'example%'; show variables like 'example%';
Variable_name Value Variable_name Value
example_double_thdvar 8.500000
example_double_var 8.500000
example_enum_var e1 example_enum_var e1
example_ulong_var 500 example_ulong_var 500
UNINSTALL SONAME 'ha_example'; UNINSTALL SONAME 'ha_example';
@ -171,6 +173,84 @@ select 1;
1 1
1 1
UNINSTALL PLUGIN example; UNINSTALL PLUGIN example;
#
# Bug #16194302 SUPPORT FOR FLOATING-POINT SYSTEM
# VARIABLES USING THE PLUGIN INTERFACE.
#
INSTALL PLUGIN example SONAME 'ha_example';
SET GLOBAL example_double_var = -0.1;
Warnings:
Warning 1292 Truncated incorrect example_double_var value: '-0.1'
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
0.500000
SET GLOBAL example_double_var = 0.000001;
Warnings:
Warning 1292 Truncated incorrect example_double_var value: '0.000001'
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
0.500000
SET GLOBAL example_double_var = 0.4;
Warnings:
Warning 1292 Truncated incorrect example_double_var value: '0.4'
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
0.500000
SET GLOBAL example_double_var = 123.456789;
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
123.456789
SET GLOBAL example_double_var = 500;
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
500.000000
SET GLOBAL example_double_var = 999.999999;
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
999.999999
SET GLOBAL example_double_var = 1000.51;
Warnings:
Warning 1292 Truncated incorrect example_double_var value: '1000.51'
SELECT @@GLOBAL.example_double_var;
@@GLOBAL.example_double_var
1000.500000
SET SESSION example_double_thdvar = -0.1;
Warnings:
Warning 1292 Truncated incorrect example_double_thdvar value: '-0.1'
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
0.500000
SET SESSION example_double_thdvar = 0.000001;
Warnings:
Warning 1292 Truncated incorrect example_double_thdvar value: '0.000001'
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
0.500000
SET SESSION example_double_thdvar = 0.4;
Warnings:
Warning 1292 Truncated incorrect example_double_thdvar value: '0.4'
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
0.500000
SET SESSION example_double_thdvar = 123.456789;
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
123.456789
SET SESSION example_double_thdvar = 500;
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
500.000000
SET SESSION example_double_thdvar = 999.999999;
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
999.999999
SET SESSION example_double_thdvar = 1000.51;
Warnings:
Warning 1292 Truncated incorrect example_double_thdvar value: '1000.51'
SELECT @@SESSION.example_double_thdvar;
@@SESSION.example_double_thdvar
1000.500000
UNINSTALL PLUGIN example;
UNINSTALL PLUGIN MyISAM; UNINSTALL PLUGIN MyISAM;
ERROR HY000: Built-in plugins cannot be deleted ERROR HY000: Built-in plugins cannot be deleted
select plugin_name from information_schema.plugins where plugin_library like 'ha_example%'; select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';

View File

@ -21,9 +21,6 @@ reset master;
update t1 set a=2 /* will be "killed" after work has been done */; update t1 set a=2 /* will be "killed" after work has been done */;
# a proof the query is binlogged with no error # a proof the query is binlogged with no error
#todo: introduce a suite private macro that provides numeric values
# for some constants like the offset of the first real event
# that is different between severs versions.
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@ -48,14 +45,14 @@ reset master;
--error ER_QUERY_INTERRUPTED --error ER_QUERY_INTERRUPTED
load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
# a proof the query is binlogged with an error # a proof the query is binlogged with an error
--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3) --let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3)
--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4) --let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
source include/show_binlog_events.inc; source include/show_binlog_events.inc;
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--mkdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select eval select
@ -68,6 +65,8 @@ eval select $error_code /* must return 0 to mean the killed query is in */;
# cleanup for the sub-case # cleanup for the sub-case
remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog; remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571 *
--rmdir $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571
drop table t1,t2; drop table t1,t2;

View File

@ -23,7 +23,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
--source include/count_sessions.inc --source include/count_sessions.inc
--exec $MYSQL --xml test -e "select * from t1" --exec $MYSQL --xml test -e "select * from t1"
--exec $MYSQL_DUMP --xml --skip-create test --exec $MYSQL_DUMP --xml --skip-create-options test
--exec $MYSQL --xml test -e "select count(*) from t1" --exec $MYSQL --xml test -e "select count(*) from t1"
--exec $MYSQL --xml test -e "select 1 < 2 from dual" --exec $MYSQL --xml test -e "select 1 < 2 from dual"

View File

@ -1381,14 +1381,14 @@ SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3));
--echo # and other crashes --echo # and other crashes
--echo # --echo #
CREATE TABLE t1 ( a TEXT ); CREATE TABLE t1 ( a TEXT );
SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE 'bug58165.txt'; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt';
SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $mysqld_datadir/test/bug58165.txt
# #
# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1)) # MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1))
# #

View File

@ -1367,6 +1367,8 @@ EXPLAIN SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2
SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2 SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2
WHERE b = 13 AND c = 42 GROUP BY a; WHERE b = 13 AND c = 42 GROUP BY a;
# This query could have been resolved using loose index scan since the second
# part of count(..) is defined by a constant predicate
EXPLAIN SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42; EXPLAIN SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42;
SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42; SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42;

View File

@ -36,7 +36,7 @@ drop view if exists v1, v2, v3;
CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024; CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1 --exec $MYSQL_DUMP --skip-create-options --skip-comments -X test t1
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
@ -79,14 +79,14 @@ SET SQL_MODE=@OLD_SQL_MODE;
# check how mysqldump make quoting # check how mysqldump make quoting
--exec $MYSQL_DUMP --compact test t1 --exec $MYSQL_DUMP --compact test t1
--exec $MYSQL_DUMP --compact --skip-create test t1 --exec $MYSQL_DUMP --compact --skip-create-options test t1
--exec $MYSQL_DUMP --skip-create --skip-comments test t1 --exec $MYSQL_DUMP --skip-create-options --skip-comments test t1
--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1 --exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3)); CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES"); INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
--exec $MYSQL_DUMP --skip-create --compact -X test t1 --exec $MYSQL_DUMP --skip-create-options --compact -X test t1
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
@ -95,7 +95,7 @@ DROP TABLE t1;
CREATE TABLE t1 (`a"b"` char(2)); CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2"); INSERT INTO t1 VALUES ("1\""), ("\"2");
--exec $MYSQL_DUMP --compact --skip-create -X test t1 --exec $MYSQL_DUMP --compact --skip-create-options -X test t1
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
@ -582,8 +582,8 @@ INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1), (2); INSERT INTO t2 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db --exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db
--exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db t1 t2 --exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db t1 t2
--exec $MYSQL_DUMP --skip-comments --skip-create --xml --no-data mysqldump_test_db --exec $MYSQL_DUMP --skip-comments --skip-create-options --xml --no-data mysqldump_test_db
--exec $MYSQL_DUMP --skip-comments --skip-create --xml --no-data mysqldump_test_db t1 t2 --exec $MYSQL_DUMP --skip-comments --skip-create-options --xml --no-data mysqldump_test_db t1 t2
DROP TABLE t1, t2; DROP TABLE t1, t2;
DROP DATABASE mysqldump_test_db; DROP DATABASE mysqldump_test_db;
@ -1634,7 +1634,7 @@ drop database mysqldump_test_db;
CREATE TABLE t1 (c1 INT, c2 LONGBLOB); CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509); INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
--exec $MYSQL_DUMP --skip-create --compact --hex-blob test t1 --exec $MYSQL_DUMP --skip-create-options --compact --hex-blob test t1
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
@ -2216,7 +2216,7 @@ DROP TABLE t1, t2;
--echo # --echo #
CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT'; CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT';
--exec $MYSQL_DUMP --compact --skip-create --xml test --exec $MYSQL_DUMP --compact --skip-create-options --xml test
DROP TABLE `comment_table`; DROP TABLE `comment_table`;
--echo # --echo #
@ -2385,7 +2385,7 @@ CREATE TABLE b12809202_db.t2 (c1 INT);
INSERT INTO b12809202_db.t1 VALUES (1), (2), (3); INSERT INTO b12809202_db.t1 VALUES (1), (2), (3);
INSERT INTO b12809202_db.t2 VALUES (1), (2), (3); INSERT INTO b12809202_db.t2 VALUES (1), (2), (3);
--echo # Starting mysqldump with --single-transaction & --flush-log options.. --echo # Starting mysqldump with --single-transaction & --flush-logs options..
--echo # Note : In the following dump the transaction --echo # Note : In the following dump the transaction
--echo # should start only after the logs are --echo # should start only after the logs are
--echo # flushed, as 'flush logs' causes implicit --echo # flushed, as 'flush logs' causes implicit
@ -2397,7 +2397,7 @@ INSERT INTO b12809202_db.t2 VALUES (1), (2), (3);
# mixing of normal (stdout) and --verbose (stderr) output will happen in random # mixing of normal (stdout) and --verbose (stderr) output will happen in random
# order depending on stdio internal buffer size. # order depending on stdio internal buffer size.
--replace_regex /-- Server version.*// /-- MySQL dump .*// /-- Dump completed on .*/-- Dump completed/ --replace_regex /-- Server version.*// /-- MySQL dump .*// /-- Dump completed on .*/-- Dump completed/
--exec $MYSQL_DUMP --verbose --single-transaction --flush-log b12809202_db 2>&1 > $MYSQLTEST_VARDIR/tmp/bug61854.sql --exec $MYSQL_DUMP --verbose --single-transaction --flush-logs b12809202_db 2>&1 > $MYSQLTEST_VARDIR/tmp/bug61854.sql
--echo --echo
--echo #### Dump ends here #### --echo #### Dump ends here ####

View File

@ -196,16 +196,16 @@ CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
# Run mysqldump # Run mysqldump
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test t1 --exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test t1
--exec $MYSQL_DUMP --skip-create --skip-comments --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 --exec $MYSQL_DUMP --skip-create-options --skip-comments --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
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl --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 --exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --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
# With wrong parameters # With wrong parameters
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump
--error 2 --error 2
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1 --exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/test.sql --remove_file $MYSQLTEST_VARDIR/tmp/test.sql

View File

@ -87,11 +87,10 @@ FLUSH TABLES;
CHECK TABLE t1; CHECK TABLE t1;
--error ER_FAILED_READ_FROM_PAR_FILE --error ER_FAILED_READ_FROM_PAR_FILE
SELECT * FROM t1; SELECT * FROM t1;
--echo # Note that it is currently impossible to drop a partitioned table --echo # Note that we will remove the frm file when we detect that
--echo # without the .par file --echo # .par file has been deleted.
--error ER_BAD_TABLE_ERROR --error ER_BAD_TABLE_ERROR
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.frm
--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI --remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI
--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD --remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD

View File

@ -149,6 +149,58 @@ SET @@SQL_MODE=@OLD_SQL_MODE;
select 1; select 1;
UNINSTALL PLUGIN example; UNINSTALL PLUGIN example;
--echo #
--echo # Bug #16194302 SUPPORT FOR FLOATING-POINT SYSTEM
--echo # VARIABLES USING THE PLUGIN INTERFACE.
--echo #
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN example SONAME 'ha_example';
SET GLOBAL example_double_var = -0.1;
SELECT @@GLOBAL.example_double_var;
SET GLOBAL example_double_var = 0.000001;
SELECT @@GLOBAL.example_double_var;
SET GLOBAL example_double_var = 0.4;
SELECT @@GLOBAL.example_double_var;
SET GLOBAL example_double_var = 123.456789;
SELECT @@GLOBAL.example_double_var;
SET GLOBAL example_double_var = 500;
SELECT @@GLOBAL.example_double_var;
SET GLOBAL example_double_var = 999.999999;
SELECT @@GLOBAL.example_double_var;
SET GLOBAL example_double_var = 1000.51;
SELECT @@GLOBAL.example_double_var;
SET SESSION example_double_thdvar = -0.1;
SELECT @@SESSION.example_double_thdvar;
SET SESSION example_double_thdvar = 0.000001;
SELECT @@SESSION.example_double_thdvar;
SET SESSION example_double_thdvar = 0.4;
SELECT @@SESSION.example_double_thdvar;
SET SESSION example_double_thdvar = 123.456789;
SELECT @@SESSION.example_double_thdvar;
SET SESSION example_double_thdvar = 500;
SELECT @@SESSION.example_double_thdvar;
SET SESSION example_double_thdvar = 999.999999;
SELECT @@SESSION.example_double_thdvar;
SET SESSION example_double_thdvar = 1000.51;
SELECT @@SESSION.example_double_thdvar;
UNINSTALL PLUGIN example;
# #
# MDEV-4573 UNINSTALL PLUGIN misleading error message for non-dynamic plugins # MDEV-4573 UNINSTALL PLUGIN misleading error message for non-dynamic plugins
# #

View File

@ -1,4 +1,4 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates # Copyright (c) 2006, 2013, 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
@ -78,6 +78,11 @@ IF (WIN32)
TARGET_LINK_LIBRARIES(mysys IPHLPAPI) TARGET_LINK_LIBRARIES(mysys IPHLPAPI)
ENDIF(WIN32) ENDIF(WIN32)
# Need explicit pthread for gcc -fsanitize=address
IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
TARGET_LINK_LIBRARIES(mysys pthread)
ENDIF()
ADD_EXECUTABLE(thr_lock thr_lock.c) ADD_EXECUTABLE(thr_lock thr_lock.c)
TARGET_LINK_LIBRARIES(thr_lock mysys) TARGET_LINK_LIBRARIES(thr_lock mysys)
SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN") SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2002, 2011, Oracle and/or its affiliates Copyright (c) 2002, 2013, Oracle and/or its affiliates
Copyright (c) 2009, 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
@ -94,6 +95,35 @@ void my_getopt_register_get_addr(my_getopt_value func_addr)
getopt_get_addr= func_addr; getopt_get_addr= func_addr;
} }
union ull_dbl
{
ulonglong ull;
double dbl;
};
/**
Returns an ulonglong value containing a raw
representation of the given double value.
*/
ulonglong getopt_double2ulonglong(double v)
{
union ull_dbl u;
u.dbl= v;
compile_time_assert(sizeof(ulonglong) >= sizeof(double));
return u.ull;
}
/**
Returns the double value which corresponds to
the given raw representation.
*/
double getopt_ulonglong2double(ulonglong v)
{
union ull_dbl u;
u.ull= v;
return u.dbl;
}
/** /**
Handle command line options. Handle command line options.
Sort options. Sort options.
@ -810,6 +840,7 @@ static int findopt(char *optpat, uint length,
{ {
uint count; uint count;
const struct my_option *opt= *opt_res; const struct my_option *opt= *opt_res;
my_bool is_prefix= FALSE;
DBUG_ENTER("findopt"); DBUG_ENTER("findopt");
for (count= 0; opt->name; opt++) for (count= 0; opt->name; opt++)
@ -819,11 +850,14 @@ static int findopt(char *optpat, uint length,
(*opt_res)= opt; (*opt_res)= opt;
if (!opt->name[length]) /* Exact match */ if (!opt->name[length]) /* Exact match */
DBUG_RETURN(1); DBUG_RETURN(1);
if (!count) if (!count)
{ {
/* We only need to know one prev */ /* We only need to know one prev */
count= 1; count= 1;
*ffname= opt->name; *ffname= opt->name;
if (opt->name[length])
is_prefix= TRUE;
} }
else if (strcmp(*ffname, opt->name)) else if (strcmp(*ffname, opt->name))
{ {
@ -835,6 +869,12 @@ static int findopt(char *optpat, uint length,
} }
} }
} }
if (is_prefix && count == 1)
my_getopt_error_reporter(WARNING_LEVEL,
"Using unique option prefix %.*s instead of %s "
"is deprecated and will be removed in a future "
"release. Please use the full name instead.",
length, optpat, *ffname);
DBUG_RETURN(count); DBUG_RETURN(count);
} }
@ -1061,16 +1101,19 @@ double getopt_double_limit_value(double num, const struct my_option *optp,
{ {
my_bool adjusted= FALSE; my_bool adjusted= FALSE;
double old= num; double old= num;
double min, max;
DBUG_ENTER("getopt_double_limit_value"); DBUG_ENTER("getopt_double_limit_value");
if (optp->max_value && num > (double) optp->max_value) max= getopt_ulonglong2double(optp->max_value);
min= getopt_ulonglong2double(optp->min_value);
if (max && num > max)
{ {
num= (double) optp->max_value; num= max;
adjusted= TRUE; adjusted= TRUE;
} }
if (num < (double) optp->min_value) if (num < min)
{ {
num= (double) optp->min_value; num= min;
adjusted= TRUE; adjusted= TRUE;
} }
if (fix) if (fix)
@ -1153,7 +1196,7 @@ static void init_one_value(const struct my_option *option, void *variable,
*((ulonglong*) variable)= (ulonglong) value; *((ulonglong*) variable)= (ulonglong) value;
break; break;
case GET_DOUBLE: case GET_DOUBLE:
*((double*) variable)= ulonglong2double(value); *((double*) variable)= getopt_ulonglong2double(value);
break; break;
case GET_STR: case GET_STR:
/* /*

View File

@ -23,7 +23,7 @@ IF(ESSENTIALS)
ENDIF() ENDIF()
ELSE() ELSE()
SET(CPACK_COMPONENTS_USED SET(CPACK_COMPONENTS_USED
"Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries") "Server;Client;DataFiles;Development;SharedLibraries;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
ENDIF() ENDIF()

View File

@ -662,9 +662,9 @@ rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/postinstall
rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-*.spec rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-*.spec
rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate
rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ChangeLog rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ChangeLog
rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/solaris/postinstall-solaris
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-stress-test.pl.1* rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-stress-test.pl.1*
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1* rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1*
rm -rf ${RPM_BUILD_ROOT}%{_datadir}/mysql/solaris
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf
@ -981,6 +981,10 @@ fi
%{_mandir}/man1/mysql_client_test.1* %{_mandir}/man1/mysql_client_test.1*
%changelog %changelog
* Wed Jul 10 2013 Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com>
- Removed directory /usr/share/mysql/solaris/postinstall-solaris to resolve build
error
* Thu Dec 7 2012 Joerg Bruehe <joerg.bruehe@oracle.com> * Thu Dec 7 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
- Change the way in which "libmysqld.so" is created: Using all object modules - Change the way in which "libmysqld.so" is created: Using all object modules
was wrong, gcc / ld can resolve the dependencies from "libmysqld.a". was wrong, gcc / ld can resolve the dependencies from "libmysqld.a".

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2008, 2013, 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
@ -75,10 +75,6 @@ if [ -n "$TMPDIR" ] ; then
chown $myuser:$mygroup "$TMPDIR" chown $myuser:$mygroup "$TMPDIR"
fi fi
# BUG# 16812255: Removing the option --random-passwords
# as this is supported only for MYSQL releases 5.6 and above.
if [ -n "$INSTALL" ] ; then if [ -n "$INSTALL" ] ; then
# We install/update the system tables # We install/update the system tables
( (

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. /* Copyright (c) 2009, 2013, 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
@ -1397,7 +1397,7 @@ static void debug_sync_execute(THD *thd, st_debug_sync_action *action)
if (action->wait_for.length()) if (action->wait_for.length())
{ {
mysql_mutex_t *old_mutex; mysql_mutex_t *old_mutex;
mysql_cond_t *UNINIT_VAR(old_cond); mysql_cond_t *old_cond= NULL;
int error= 0; int error= 0;
struct timespec abstime; struct timespec abstime;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2000, 2012, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2008, 2011, Monty Program Ab Copyright (c) 2008, 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
@ -7077,7 +7077,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
if (!String::needs_conversion(length, cs, field_charset, &dummy_offset)) if (!String::needs_conversion(length, cs, field_charset, &dummy_offset))
{ {
Field_blob::store_length(length); Field_blob::store_length(length);
bmove(ptr+packlength,(char*) &from,sizeof(char*)); bmove(ptr+packlength, &from, sizeof(char*));
return 0; return 0;
} }
if (tmpstr.copy(from, length, cs)) if (tmpstr.copy(from, length, cs))
@ -7595,7 +7595,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
value.copy(from, length, cs); value.copy(from, length, cs);
from= value.ptr(); from= value.ptr();
} }
bmove(ptr + packlength, (char*) &from, sizeof(char*)); bmove(ptr + packlength, &from, sizeof(char*));
} }
return 0; return 0;

View File

@ -69,7 +69,7 @@
#include "debug_sync.h" #include "debug_sync.h"
static const char *ha_par_ext= ".par"; static const char *ha_par_ext= ".par";
#define MI_MAX_MSG_BUF MYSQL_ERRMSG_SIZE
/**************************************************************************** /****************************************************************************
MODULE create/delete handler object MODULE create/delete handler object
****************************************************************************/ ****************************************************************************/
@ -1099,30 +1099,38 @@ int ha_partition::handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
(modelled after mi_check_print_msg) (modelled after mi_check_print_msg)
TODO: move this into the handler, or rewrite mysql_admin_table. TODO: move this into the handler, or rewrite mysql_admin_table.
*/ */
static bool print_admin_msg(THD* thd, const char* msg_type, static bool print_admin_msg(THD* thd, uint len,
const char* msg_type,
const char* db_name, String &table_name, const char* db_name, String &table_name,
const char* op_name, const char *fmt, ...) const char* op_name, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 6, 7); ATTRIBUTE_FORMAT(printf, 7, 8);
static bool print_admin_msg(THD* thd, const char* msg_type, static bool print_admin_msg(THD* thd, uint len,
const char* msg_type,
const char* db_name, String &table_name, const char* db_name, String &table_name,
const char* op_name, const char *fmt, ...) const char* op_name, const char *fmt, ...)
{ {
va_list args; va_list args;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
uint length, msg_length; uint length;
char msgbuf[MYSQL_ERRMSG_SIZE]; uint msg_length;
char name[SAFE_NAME_LEN*2+2]; char name[SAFE_NAME_LEN*2+2];
char *msgbuf;
bool error= true;
if (!(msgbuf= (char*) my_malloc(len, MYF(0))))
return true;
va_start(args, fmt); va_start(args, fmt);
msg_length= my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); msg_length= my_vsnprintf(msgbuf, len, fmt, args);
va_end(args); va_end(args);
msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia if (msg_length >= (len - 1))
goto err;
msgbuf[len - 1] = 0; // healthy paranoia
if (!thd->vio_ok()) if (!thd->vio_ok())
{ {
sql_print_error(fmt, args); sql_print_error("%s", msgbuf);
return TRUE; goto err;
} }
length=(uint) (strxmov(name, db_name, ".", table_name.c_ptr_safe(), NullS) - name); length=(uint) (strxmov(name, db_name, ".", table_name.c_ptr_safe(), NullS) - name);
@ -1145,9 +1153,12 @@ static bool print_admin_msg(THD* thd, const char* msg_type,
{ {
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n", sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
msgbuf); msgbuf);
return TRUE; goto err;
} }
return FALSE; error= false;
err:
my_free(msgbuf);
return error;
} }
@ -1204,7 +1215,8 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
error != HA_ADMIN_ALREADY_DONE && error != HA_ADMIN_ALREADY_DONE &&
error != HA_ADMIN_TRY_ALTER) error != HA_ADMIN_TRY_ALTER)
{ {
print_admin_msg(thd, "error", table_share->db.str, table->alias, print_admin_msg(thd, MI_MAX_MSG_BUF, "error",
table_share->db.str, table->alias,
opt_op_name[flag], opt_op_name[flag],
"Subpartition %s returned error", "Subpartition %s returned error",
sub_elem->partition_name); sub_elem->partition_name);
@ -1230,7 +1242,8 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
error != HA_ADMIN_ALREADY_DONE && error != HA_ADMIN_ALREADY_DONE &&
error != HA_ADMIN_TRY_ALTER) error != HA_ADMIN_TRY_ALTER)
{ {
print_admin_msg(thd, "error", table_share->db.str, table->alias, print_admin_msg(thd, MI_MAX_MSG_BUF, "error",
table_share->db.str, table->alias,
opt_op_name[flag], "Partition %s returned error", opt_op_name[flag], "Partition %s returned error",
part_elem->partition_name); part_elem->partition_name);
} }
@ -1940,15 +1953,15 @@ char *ha_partition::update_table_comment(const char *comment)
names of the partitions and the underlying storage engines. names of the partitions and the underlying storage engines.
*/ */
uint ha_partition::del_ren_cre_table(const char *from, int ha_partition::del_ren_cre_table(const char *from,
const char *to, const char *to,
TABLE *table_arg, TABLE *table_arg,
HA_CREATE_INFO *create_info) HA_CREATE_INFO *create_info)
{ {
int save_error= 0; int save_error= 0;
int error; int error= HA_ERR_INTERNAL_ERROR;
char from_buff[FN_REFLEN], to_buff[FN_REFLEN], from_lc_buff[FN_REFLEN], char from_buff[FN_REFLEN], to_buff[FN_REFLEN], from_lc_buff[FN_REFLEN],
to_lc_buff[FN_REFLEN]; to_lc_buff[FN_REFLEN], buff[FN_REFLEN];
char *name_buffer_ptr; char *name_buffer_ptr;
const char *from_path; const char *from_path;
const char *to_path= NULL; const char *to_path= NULL;
@ -1960,24 +1973,28 @@ uint ha_partition::del_ren_cre_table(const char *from,
if (create_info && create_info->options & HA_LEX_CREATE_TMP_TABLE) if (create_info && create_info->options & HA_LEX_CREATE_TMP_TABLE)
{ {
my_error(ER_PARTITION_NO_TEMPORARY, MYF(0)); my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(error);
}
fn_format(buff,from, "", ha_par_ext, MY_APPEND_EXT);
/* Check if the par file exists */
if (my_access(buff,F_OK))
{
/*
If the .par file does not exist, return HA_ERR_NO_SUCH_TABLE,
This will signal to the caller that it can remove the .frm
file.
*/
error= HA_ERR_NO_SUCH_TABLE;
DBUG_RETURN(error);
} }
if (get_from_handler_file(from, ha_thd()->mem_root, false)) if (get_from_handler_file(from, ha_thd()->mem_root, false))
DBUG_RETURN(TRUE); DBUG_RETURN(error);
DBUG_ASSERT(m_file_buffer); DBUG_ASSERT(m_file_buffer);
DBUG_PRINT("enter", ("from: (%s) to: (%s)", from, to ? to : "(nil)")); DBUG_PRINT("enter", ("from: (%s) to: (%s)", from, to ? to : "(nil)"));
name_buffer_ptr= m_name_buffer_ptr; name_buffer_ptr= m_name_buffer_ptr;
file= m_file; file= m_file;
if (to == NULL && table_arg == NULL)
{
/*
Delete table, start by delete the .par file. If error, break, otherwise
delete as much as possible.
*/
if ((error= handler::delete_table(from)))
DBUG_RETURN(error);
}
/* /*
Since ha_partition has HA_FILE_BASED, it must alter underlying table names Since ha_partition has HA_FILE_BASED, it must alter underlying table names
if they do not have HA_FILE_BASED and lower_case_table_names == 2. if they do not have HA_FILE_BASED and lower_case_table_names == 2.
@ -2018,6 +2035,18 @@ uint ha_partition::del_ren_cre_table(const char *from,
save_error= error; save_error= error;
i++; i++;
} while (*(++file)); } while (*(++file));
if (to == NULL && table_arg == NULL)
{
DBUG_EXECUTE_IF("crash_before_deleting_par_file", DBUG_SUICIDE(););
/* Delete the .par file. If error, break.*/
if ((error= handler::delete_table(from)))
DBUG_RETURN(error);
DBUG_EXECUTE_IF("crash_after_deleting_par_file", DBUG_SUICIDE(););
}
if (to != NULL) if (to != NULL)
{ {
if ((error= handler::rename_table(from, to))) if ((error= handler::rename_table(from, to)))
@ -7936,7 +7965,8 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
if (num_misplaced_rows > 0) if (num_misplaced_rows > 0)
{ {
print_admin_msg(ha_thd(), "warning", table_share->db.str, table->alias, print_admin_msg(ha_thd(), MI_MAX_MSG_BUF, "warning",
table_share->db.str, table->alias,
opt_op_name[REPAIR_PARTS], opt_op_name[REPAIR_PARTS],
"Moved %lld misplaced rows", "Moved %lld misplaced rows",
num_misplaced_rows); num_misplaced_rows);
@ -7957,7 +7987,8 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
if (!repair) if (!repair)
{ {
/* Check. */ /* Check. */
print_admin_msg(ha_thd(), "error", table_share->db.str, table->alias, print_admin_msg(ha_thd(), MI_MAX_MSG_BUF, "error",
table_share->db.str, table->alias,
opt_op_name[CHECK_PARTS], opt_op_name[CHECK_PARTS],
"Found a misplaced row"); "Found a misplaced row");
/* Break on first misplaced row! */ /* Break on first misplaced row! */
@ -8004,7 +8035,8 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
correct_part_id, correct_part_id,
str.c_ptr_safe()); str.c_ptr_safe());
} }
print_admin_msg(ha_thd(), "error", table_share->db.str, table->alias, print_admin_msg(ha_thd(), MI_MAX_MSG_BUF, "error",
table_share->db.str, table->alias,
opt_op_name[REPAIR_PARTS], opt_op_name[REPAIR_PARTS],
"Failed to move/insert a row" "Failed to move/insert a row"
" from part %d into part %d:\n%s", " from part %d into part %d:\n%s",
@ -8135,12 +8167,18 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
NULL, NULL,
NULL, NULL,
NULL)) || NULL)) ||
/* Also check that the length is smaller than the output field! */ print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, "error",
(part_buf_len + db_name.length() + table_name.length()) >= table_share->db.str,
(SQL_ADMIN_MSG_TEXT_SIZE - table->alias,
(strlen(KEY_PARTITIONING_CHANGED_STR) - 3))) opt_op_name[CHECK_PARTS],
KEY_PARTITIONING_CHANGED_STR,
db_name.c_ptr_safe(),
table_name.c_ptr_safe(),
part_buf))
{ {
print_admin_msg(thd, "error", table_share->db.str, table->alias, /* Error creating admin message (too long string?). */
print_admin_msg(thd, MI_MAX_MSG_BUF, "error",
table_share->db.str, table->alias,
opt_op_name[CHECK_PARTS], opt_op_name[CHECK_PARTS],
KEY_PARTITIONING_CHANGED_STR, KEY_PARTITIONING_CHANGED_STR,
db_name.c_ptr_safe(), table_name.c_ptr_safe(), db_name.c_ptr_safe(), table_name.c_ptr_safe(),
@ -8148,14 +8186,6 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
" between 'KEY' and '(' to change the metadata" " between 'KEY' and '(' to change the metadata"
" without the need of a full table rebuild."); " without the need of a full table rebuild.");
} }
else
{
print_admin_msg(thd, "error", table_share->db.str, table->alias,
opt_op_name[CHECK_PARTS],
KEY_PARTITIONING_CHANGED_STR,
db_name.c_ptr_safe(), table_name.c_ptr_safe(),
part_buf);
}
m_part_info->key_algorithm= old_algorithm; m_part_info->key_algorithm= old_algorithm;
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View File

@ -274,7 +274,7 @@ private:
delete_table, rename_table and create uses very similar logic which delete_table, rename_table and create uses very similar logic which
is packed into this routine. is packed into this routine.
*/ */
uint del_ren_cre_table(const char *from, const char *to, int del_ren_cre_table(const char *from, const char *to,
TABLE *table_arg, HA_CREATE_INFO *create_info); TABLE *table_arg, HA_CREATE_INFO *create_info);
/* /*
One method to create the table_name.par file containing the names of the One method to create the table_name.par file containing the names of the

View File

@ -1599,15 +1599,14 @@ public:
:Item_func(b), cached_result_type(INT_RESULT), :Item_func(b), cached_result_type(INT_RESULT),
entry(NULL), entry_thread_id(0), name(a) entry(NULL), entry_thread_id(0), name(a)
{} {}
Item_func_set_user_var(Item_func_set_user_var *item) Item_func_set_user_var(THD *thd, Item_func_set_user_var *item)
:Item_func(item), cached_result_type(item->cached_result_type), :Item_func(thd, item), cached_result_type(item->cached_result_type),
entry(item->entry), entry_thread_id(item->entry_thread_id), entry(item->entry), entry_thread_id(item->entry_thread_id),
value(item->value), decimal_buff(item->decimal_buff), value(item->value), decimal_buff(item->decimal_buff),
null_item(item->null_item), save_result(item->save_result), null_item(item->null_item), save_result(item->save_result),
name(item->name) name(item->name)
{ {}
//fixed= 1;
}
enum Functype functype() const { return SUSERVAR_FUNC; } enum Functype functype() const { return SUSERVAR_FUNC; }
double val_real(); double val_real();
longlong val_int(); longlong val_int();

View File

@ -1737,7 +1737,16 @@ Item_in_subselect::single_value_transformer(JOIN *join)
*/ */
where_item->walk(&Item::remove_dependence_processor, 0, where_item->walk(&Item::remove_dependence_processor, 0,
(uchar *) select_lex->outer_select()); (uchar *) select_lex->outer_select());
substitution= func->create(left_expr, where_item); /*
fix_field of substitution item will be done in time of
substituting.
Note that real_item() should be used instead of
original left expression because left_expr can be
runtime created Ref item which is deleted at the end
of the statement. Thus one of 'substitution' arguments
can be broken in case of PS.
*/
substitution= func->create(left_expr->real_item(), where_item);
have_to_be_excluded= 1; have_to_be_excluded= 1;
if (thd->lex->describe) if (thd->lex->describe)
{ {

View File

@ -40,7 +40,6 @@
#include "rpl_utility.h" #include "rpl_utility.h"
#include "hash.h" #include "hash.h"
#include "rpl_tblmap.h" #include "rpl_tblmap.h"
#include "rpl_tblmap.cc"
#endif #endif
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER

View File

@ -2459,7 +2459,7 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info)
partition_element *new_sub_part_elem= new_sub_part_it++; partition_element *new_sub_part_elem= new_sub_part_it++;
/* new_part_elem may not have engine_type set! */ /* new_part_elem may not have engine_type set! */
if (new_sub_part_elem->engine_type && if (new_sub_part_elem->engine_type &&
sub_part_elem->engine_type != new_part_elem->engine_type) sub_part_elem->engine_type != new_sub_part_elem->engine_type)
DBUG_RETURN(false); DBUG_RETURN(false);
if (strcmp(sub_part_elem->partition_name, if (strcmp(sub_part_elem->partition_name,

View File

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include "my_global.h" #include "my_global.h"
#include <signal.h> #include <signal.h>

View File

@ -71,6 +71,7 @@ public:
bool is_subset(const Bitmap& map2) const { return bitmap_is_subset(&map, &map2.map); } bool is_subset(const Bitmap& map2) const { return bitmap_is_subset(&map, &map2.map); }
bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, &map2.map); } bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, &map2.map); }
bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); } bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); }
bool operator!=(const Bitmap& map2) const { return !(*this == map2); }
char *print(char *buf) const char *print(char *buf) const
{ {
char *s=buf; char *s=buf;

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2000, 2011, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Progrm 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

@ -173,7 +173,8 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec); static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec);
static int cmp_rec_and_tuple_prune(part_column_list_val *val, static int cmp_rec_and_tuple_prune(part_column_list_val *val,
uint32 n_vals_in_rec, uint32 n_vals_in_rec,
bool tail_is_min); bool is_left_endpoint,
bool include_endpoint);
/* /*
Convert constants in VALUES definition to the character set the Convert constants in VALUES definition to the character set the
@ -3222,17 +3223,63 @@ notfound:
} }
/* uint32 get_partition_id_cols_list_for_endpoint(partition_info *part_info,
Find the sub-array part_info->list_array that corresponds to given interval bool left_endpoint,
bool include_endpoint,
uint32 nparts)
{
part_column_list_val *list_col_array= part_info->list_col_array;
uint num_columns= part_info->part_field_list.elements;
uint list_index;
uint min_list_index= 0;
uint max_list_index= part_info->num_list_values;
DBUG_ENTER("get_partition_id_cols_list_for_endpoint");
SYNOPSIS /* Find the matching partition (including taking endpoint into account). */
get_list_array_idx_for_endpoint() do
part_info Partitioning info (partitioning type must be LIST) {
left_endpoint TRUE - the interval is [a; +inf) or (a; +inf) /* Midpoint, adjusted down, so it can never be > last index. */
list_index= (max_list_index + min_list_index) >> 1;
if (cmp_rec_and_tuple_prune(list_col_array + list_index*num_columns,
nparts, left_endpoint, include_endpoint) > 0)
min_list_index= list_index + 1;
else
max_list_index= list_index;
} while (max_list_index > min_list_index);
list_index= max_list_index;
/* Given value must be LESS THAN or EQUAL to the found partition. */
DBUG_ASSERT(list_index == part_info->num_list_values ||
(0 >= cmp_rec_and_tuple_prune(list_col_array +
list_index*num_columns,
nparts, left_endpoint,
include_endpoint)));
/* Given value must be GREATER THAN the previous partition. */
DBUG_ASSERT(list_index == 0 ||
(0 < cmp_rec_and_tuple_prune(list_col_array +
(list_index - 1)*num_columns,
nparts, left_endpoint,
include_endpoint)));
if (!left_endpoint)
{
/* Set the end after this list tuple if not already after the last. */
if (list_index < part_info->num_parts)
list_index++;
}
DBUG_RETURN(list_index);
}
/**
Find the sub-array part_info->list_array that corresponds to given interval.
@param part_info Partitioning info (partitioning type must be LIST)
@param left_endpoint TRUE - the interval is [a; +inf) or (a; +inf)
FALSE - the interval is (-inf; a] or (-inf; a) FALSE - the interval is (-inf; a] or (-inf; a)
include_endpoint TRUE iff the interval includes the endpoint @param include_endpoint TRUE iff the interval includes the endpoint
DESCRIPTION
This function finds the sub-array of part_info->list_array where values of This function finds the sub-array of part_info->list_array where values of
list_array[idx].list_value are contained within the specifed interval. list_array[idx].list_value are contained within the specifed interval.
list_array is ordered by list_value, so list_array is ordered by list_value, so
@ -3249,55 +3296,15 @@ notfound:
If all array elements are contained, part_info->num_list_values is If all array elements are contained, part_info->num_list_values is
returned. returned.
NOTE @note The caller will call this function and then will run along the
The caller will call this function and then will run along the sub-array of sub-array of list_array to collect partition ids. If the number of list
list_array to collect partition ids. If the number of list values is values is significantly higher then number of partitions, this could be slow
significantly higher then number of partitions, this could be slow and and we could invent some other approach. The "run over list array" part is
we could invent some other approach. The "run over list array" part is
already wrapped in a get_next()-like function. already wrapped in a get_next()-like function.
RETURN @return The index of corresponding sub-array of part_info->list_array.
The edge of corresponding sub-array of part_info->list_array
*/ */
uint32 get_partition_id_cols_list_for_endpoint(partition_info *part_info,
bool left_endpoint,
bool include_endpoint,
uint32 nparts)
{
part_column_list_val *list_col_array= part_info->list_col_array;
uint num_columns= part_info->part_field_list.elements;
int list_index, cmp;
uint min_list_index= 0;
uint max_list_index= part_info->num_list_values - 1;
bool tailf= !(left_endpoint ^ include_endpoint);
DBUG_ENTER("get_partition_id_cols_list_for_endpoint");
do
{
list_index= (max_list_index + min_list_index) >> 1;
cmp= cmp_rec_and_tuple_prune(list_col_array + list_index*num_columns,
nparts, tailf);
if (cmp > 0)
min_list_index= list_index + 1;
else if (cmp < 0)
{
if (!list_index)
goto notfound;
max_list_index= list_index - 1;
}
else
{
DBUG_RETURN(list_index + test(!tailf));
}
} while (max_list_index >= min_list_index);
if (cmp > 0)
list_index++;
notfound:
DBUG_RETURN(list_index);
}
uint32 get_list_array_idx_for_endpoint_charset(partition_info *part_info, uint32 get_list_array_idx_for_endpoint_charset(partition_info *part_info,
bool left_endpoint, bool left_endpoint,
bool include_endpoint) bool include_endpoint)
@ -7345,15 +7352,17 @@ uint32 store_tuple_to_record(Field **pfield,
return nparts; return nparts;
} }
/* /**
RANGE(columns) partitioning: compare value bound and probe tuple. RANGE(columns) partitioning: compare partition value bound and probe tuple.
The value bound always is a full tuple (but may include the MAXVALUE @param val Partition column values.
special value). @param nvals_in_rec Number of (prefix) fields to compare.
The probe tuple may be a prefix of partitioning tuple. The tail_is_min @return Less than/Equal to/Greater than 0 if the record is L/E/G than val.
parameter specifies whether the suffix components should be assumed to
hold MAXVALUE @note The partition value bound is always a full tuple (but may include the
MAXVALUE special value). The probe tuple may be a prefix of partitioning
tuple.
*/ */
static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec) static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec)
@ -7383,26 +7392,74 @@ static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec)
} }
/**
Compare record and columns partition tuple including endpoint handling.
@param val Columns partition tuple
@param n_vals_in_rec Number of columns to compare
@param is_left_endpoint True if left endpoint (part_tuple < rec or
part_tuple <= rec)
@param include_endpoint If endpoint is included (part_tuple <= rec or
rec <= part_tuple)
@return Less than/Equal to/Greater than 0 if the record is L/E/G than
the partition tuple.
@see get_list_array_idx_for_endpoint() and
get_partition_id_range_for_endpoint().
*/
static int cmp_rec_and_tuple_prune(part_column_list_val *val, static int cmp_rec_and_tuple_prune(part_column_list_val *val,
uint32 n_vals_in_rec, uint32 n_vals_in_rec,
bool tail_is_min) bool is_left_endpoint,
bool include_endpoint)
{ {
int cmp; int cmp;
Field **field; Field **field;
partition_info *part_info;
if ((cmp= cmp_rec_and_tuple(val, n_vals_in_rec))) if ((cmp= cmp_rec_and_tuple(val, n_vals_in_rec)))
return cmp; return cmp;
part_info= val->part_info; field= val->part_info->part_field_array + n_vals_in_rec;
field= part_info->part_field_array + n_vals_in_rec; if (!(*field))
for (; *field; field++, val++)
{ {
if (tail_is_min) /*
return -1; Full match, if right endpoint and not including the endpoint,
if (!tail_is_min && !val->max_value) (rec < part) return lesser.
return +1; */
} if (!is_left_endpoint && !include_endpoint)
return -4;
/* Otherwise they are equal! */
return 0; return 0;
} }
/*
The prefix is equal and there are more partition columns to compare.
If including left endpoint or not including right endpoint
then the record is considered lesser compared to the partition.
i.e:
part(10, x) <= rec(10, unknown) and rec(10, unknown) < part(10, x)
part <= rec -> lesser (i.e. this or previous partitions)
rec < part -> lesser (i.e. this or previous partitions)
*/
if (is_left_endpoint == include_endpoint)
return -2;
/*
If right endpoint and the first additional partition value
is MAXVALUE, then the record is lesser.
*/
if (!is_left_endpoint && (val + n_vals_in_rec)->max_value)
return -3;
/*
Otherwise the record is considered greater.
rec <= part -> greater (i.e. does not match this partition, seek higher).
part < rec -> greater (i.e. does not match this partition, seek higher).
*/
return 2;
}
typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint, typedef uint32 (*get_endpoint_func)(partition_info*, bool left_endpoint,
@ -7412,89 +7469,63 @@ typedef uint32 (*get_col_endpoint_func)(partition_info*, bool left_endpoint,
bool include_endpoint, bool include_endpoint,
uint32 num_parts); uint32 num_parts);
/* /**
Partitioning Interval Analysis: Initialize the iterator for "mapping" case Get partition for RANGE COLUMNS endpoint.
SYNOPSIS @param part_info Partitioning metadata.
get_part_iter_for_interval_via_mapping() @param is_left_endpoint True if left endpoint (const <=/< cols)
part_info Partition info @param include_endpoint True if range includes the endpoint (<=/>=)
is_subpart TRUE - act for subpartitioning @param nparts Total number of partitions
FALSE - act for partitioning
min_value minimum field value, in opt_range key format.
max_value minimum field value, in opt_range key format.
flags Some combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE,
NO_MAX_RANGE.
part_iter Iterator structure to be initialized
DESCRIPTION @return Partition id of matching partition.
Initialize partition set iterator to walk over the interval in
ordered-array-of-partitions (for RANGE partitioning) or
ordered-array-of-list-constants (for LIST partitioning) space.
IMPLEMENTATION @see get_partition_id_cols_list_for_endpoint and
This function is used when partitioning is done by get_partition_id_range_for_endpoint.
<RANGE|LIST>(ascending_func(t.field)), and we can map an interval in
t.field space into a sub-array of partition_info::range_int_array or
partition_info::list_array (see get_partition_id_range_for_endpoint,
get_list_array_idx_for_endpoint for details).
The function performs this interval mapping, and sets the iterator to
traverse the sub-array and return appropriate partitions.
RETURN
0 - No matching partitions (iterator not initialized)
1 - Ok, iterator intialized for traversal of matching partitions.
-1 - All partitions would match (iterator not initialized)
*/ */
uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info, uint32 get_partition_id_cols_range_for_endpoint(partition_info *part_info,
bool left_endpoint, bool is_left_endpoint,
bool include_endpoint, bool include_endpoint,
uint32 nparts) uint32 nparts)
{ {
uint max_partition= part_info->num_parts - 1; uint min_part_id= 0, max_part_id= part_info->num_parts, loc_part_id;
uint min_part_id= 0, max_part_id= max_partition, loc_part_id;
part_column_list_val *range_col_array= part_info->range_col_array; part_column_list_val *range_col_array= part_info->range_col_array;
uint num_columns= part_info->part_field_list.elements; uint num_columns= part_info->part_field_list.elements;
bool tailf= !(left_endpoint ^ include_endpoint);
DBUG_ENTER("get_partition_id_cols_range_for_endpoint"); DBUG_ENTER("get_partition_id_cols_range_for_endpoint");
/* Get the partitioning function value for the endpoint */ /* Find the matching partition (including taking endpoint into account). */
while (max_part_id > min_part_id) do
{ {
loc_part_id= (max_part_id + min_part_id + 1) >> 1; /* Midpoint, adjusted down, so it can never be > last partition. */
if (cmp_rec_and_tuple_prune(range_col_array + loc_part_id*num_columns, loc_part_id= (max_part_id + min_part_id) >> 1;
nparts, tailf) >= 0) if (0 <= cmp_rec_and_tuple_prune(range_col_array +
loc_part_id * num_columns,
nparts,
is_left_endpoint,
include_endpoint))
min_part_id= loc_part_id + 1; min_part_id= loc_part_id + 1;
else else
max_part_id= loc_part_id - 1; max_part_id= loc_part_id;
} } while (max_part_id > min_part_id);
loc_part_id= max_part_id; loc_part_id= max_part_id;
if (loc_part_id < max_partition &&
cmp_rec_and_tuple_prune(range_col_array + (loc_part_id+1)*num_columns, /* Given value must be LESS THAN the found partition. */
nparts, tailf) >= 0 DBUG_ASSERT(loc_part_id == part_info->num_parts ||
) (0 > cmp_rec_and_tuple_prune(range_col_array +
{
loc_part_id++;
}
if (left_endpoint)
{
if (cmp_rec_and_tuple_prune(range_col_array + loc_part_id*num_columns,
nparts, tailf) >= 0)
loc_part_id++;
}
else
{
if (loc_part_id < max_partition)
{
int res= cmp_rec_and_tuple_prune(range_col_array +
loc_part_id * num_columns, loc_part_id * num_columns,
nparts, tailf); nparts, is_left_endpoint,
if (!res) include_endpoint)));
loc_part_id += test(include_endpoint); /* Given value must be GREATER THAN or EQUAL to the previous partition. */
else if (res > 0) DBUG_ASSERT(loc_part_id == 0 ||
loc_part_id++; (0 <= cmp_rec_and_tuple_prune(range_col_array +
} (loc_part_id - 1) * num_columns,
nparts, is_left_endpoint,
include_endpoint)));
if (!is_left_endpoint)
{
/* Set the end after this partition if not already after the last. */
if (loc_part_id < part_info->num_parts)
loc_part_id++; loc_part_id++;
} }
DBUG_RETURN(loc_part_id); DBUG_RETURN(loc_part_id);
@ -7568,6 +7599,40 @@ int get_part_iter_for_interval_cols_via_map(partition_info *part_info,
} }
/**
Partitioning Interval Analysis: Initialize the iterator for "mapping" case
@param part_info Partition info
@param is_subpart TRUE - act for subpartitioning
FALSE - act for partitioning
@param store_length_array Ignored.
@param min_value minimum field value, in opt_range key format.
@param max_value minimum field value, in opt_range key format.
@param min_len Ignored.
@param max_len Ignored.
@param flags Some combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE,
NO_MAX_RANGE.
@param part_iter Iterator structure to be initialized
@details Initialize partition set iterator to walk over the interval in
ordered-array-of-partitions (for RANGE partitioning) or
ordered-array-of-list-constants (for LIST partitioning) space.
This function is used when partitioning is done by
<RANGE|LIST>(ascending_func(t.field)), and we can map an interval in
t.field space into a sub-array of partition_info::range_int_array or
partition_info::list_array (see get_partition_id_range_for_endpoint,
get_list_array_idx_for_endpoint for details).
The function performs this interval mapping, and sets the iterator to
traverse the sub-array and return appropriate partitions.
@return Status of iterator
@retval 0 No matching partitions (iterator not initialized)
@retval 1 Ok, iterator intialized for traversal of matching partitions.
@retval -1 All partitions would match (iterator not initialized)
*/
int get_part_iter_for_interval_via_mapping(partition_info *part_info, int get_part_iter_for_interval_via_mapping(partition_info *part_info,
bool is_subpart, bool is_subpart,
uint32 *store_length_array, /* ignored */ uint32 *store_length_array, /* ignored */

View File

@ -2391,6 +2391,7 @@ typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_longlong_t, longlong);
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_uint_t, uint); typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_uint_t, uint);
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulong_t, ulong); typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulong_t, ulong);
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulonglong_t, ulonglong); typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulonglong_t, ulonglong);
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_double_t, double);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int); typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_long_t, long); typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_long_t, long);
@ -2398,6 +2399,7 @@ typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_longlong_t, longlong);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint); typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong); typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong); typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong);
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_double_t, double);
/**************************************************************************** /****************************************************************************
@ -2613,6 +2615,20 @@ err:
return 1; return 1;
} }
static int check_func_double(THD *thd, struct st_mysql_sys_var *var,
void *save, st_mysql_value *value)
{
double v;
my_bool fixed;
struct my_option option;
value->val_real(value, &v);
plugin_opt_set_limits(&option, var);
*(double *) save= getopt_double_limit_value(v, &option, &fixed);
return throw_bounds_warning(thd, var->name, fixed, v);
}
static void update_func_bool(THD *thd, struct st_mysql_sys_var *var, static void update_func_bool(THD *thd, struct st_mysql_sys_var *var,
void *tgt, const void *save) void *tgt, const void *save)
@ -2654,6 +2670,11 @@ static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
} }
} }
static void update_func_double(THD *thd, struct st_mysql_sys_var *var,
void *tgt, const void *save)
{
*(double *) tgt= *(double *) save;
}
/**************************************************************************** /****************************************************************************
System Variables support System Variables support
@ -2768,6 +2789,9 @@ static st_bookmark *register_var(const char *plugin, const char *name,
case PLUGIN_VAR_STR: case PLUGIN_VAR_STR:
size= sizeof(char*); size= sizeof(char*);
break; break;
case PLUGIN_VAR_DOUBLE:
size= sizeof(double);
break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
return NULL; return NULL;
@ -2980,6 +3004,11 @@ static char **mysql_sys_var_str(THD* thd, int offset)
return (char **) intern_sys_var_ptr(thd, offset, true); return (char **) intern_sys_var_ptr(thd, offset, true);
} }
static double *mysql_sys_var_double(THD* thd, int offset)
{
return (double *) intern_sys_var_ptr(thd, offset, true);
}
void plugin_thdvar_init(THD *thd) void plugin_thdvar_init(THD *thd)
{ {
plugin_ref old_table_plugin= thd->variables.table_plugin; plugin_ref old_table_plugin= thd->variables.table_plugin;
@ -3132,6 +3161,8 @@ static SHOW_TYPE pluginvar_show_type(st_mysql_sys_var *plugin_var)
case PLUGIN_VAR_ENUM: case PLUGIN_VAR_ENUM:
case PLUGIN_VAR_SET: case PLUGIN_VAR_SET:
return SHOW_CHAR; return SHOW_CHAR;
case PLUGIN_VAR_DOUBLE:
return SHOW_DOUBLE;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
return SHOW_UNDEF; return SHOW_UNDEF;
@ -3152,6 +3183,8 @@ bool sys_var_pluginvar::check_update_type(Item_result type)
case PLUGIN_VAR_BOOL: case PLUGIN_VAR_BOOL:
case PLUGIN_VAR_SET: case PLUGIN_VAR_SET:
return type != STRING_RESULT && type != INT_RESULT; return type != STRING_RESULT && type != INT_RESULT;
case PLUGIN_VAR_DOUBLE:
return type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT;
default: default:
return true; return true;
} }
@ -3270,6 +3303,9 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
case PLUGIN_VAR_STR: case PLUGIN_VAR_STR:
src= &((sysvar_str_t*) plugin_var)->def_val; src= &((sysvar_str_t*) plugin_var)->def_val;
break; break;
case PLUGIN_VAR_DOUBLE:
src= &((sysvar_double_t*) plugin_var)->def_val;
break;
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_uint_t*) plugin_var)->def_val; src= &((thdvar_uint_t*) plugin_var)->def_val;
break; break;
@ -3291,6 +3327,9 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_str_t*) plugin_var)->def_val; src= &((thdvar_str_t*) plugin_var)->def_val;
break; break;
case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL:
src= &((thdvar_double_t*) plugin_var)->def_val;
break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
} }
@ -3308,6 +3347,13 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
options->max_value= (opt)->max_val; \ options->max_value= (opt)->max_val; \
options->block_size= (long) (opt)->blk_sz options->block_size= (long) (opt)->blk_sz
#define OPTION_SET_LIMITS_DOUBLE(options, opt) \
options->var_type= GET_DOUBLE; \
options->def_value= (longlong) getopt_double2ulonglong((opt)->def_val); \
options->min_value= (longlong) getopt_double2ulonglong((opt)->min_val); \
options->max_value= getopt_double2ulonglong((opt)->max_val); \
options->block_size= (long) (opt)->blk_sz;
static void plugin_opt_set_limits(struct my_option *options, static void plugin_opt_set_limits(struct my_option *options,
const struct st_mysql_sys_var *opt) const struct st_mysql_sys_var *opt)
@ -3358,6 +3404,9 @@ static void plugin_opt_set_limits(struct my_option *options,
GET_STR_ALLOC : GET_STR); GET_STR_ALLOC : GET_STR);
options->def_value= (intptr) ((sysvar_str_t*) opt)->def_val; options->def_value= (intptr) ((sysvar_str_t*) opt)->def_val;
break; break;
case PLUGIN_VAR_DOUBLE:
OPTION_SET_LIMITS_DOUBLE(options, (sysvar_double_t*) opt);
break;
/* threadlocal variables */ /* threadlocal variables */
case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_INT | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*) opt); OPTION_SET_LIMITS(GET_INT, options, (thdvar_int_t*) opt);
@ -3377,6 +3426,9 @@ static void plugin_opt_set_limits(struct my_option *options,
case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS(GET_ULL, options, (thdvar_ulonglong_t*) opt); OPTION_SET_LIMITS(GET_ULL, options, (thdvar_ulonglong_t*) opt);
break; break;
case PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL:
OPTION_SET_LIMITS_DOUBLE(options, (thdvar_double_t*) opt);
break;
case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL: case PLUGIN_VAR_ENUM | PLUGIN_VAR_THDLOCAL:
options->var_type= GET_ENUM; options->var_type= GET_ENUM;
options->typelib= ((thdvar_enum_t*) opt)->typelib; options->typelib= ((thdvar_enum_t*) opt)->typelib;
@ -3539,6 +3591,9 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
case PLUGIN_VAR_SET: case PLUGIN_VAR_SET:
((thdvar_set_t *) opt)->resolve= mysql_sys_var_ulonglong; ((thdvar_set_t *) opt)->resolve= mysql_sys_var_ulonglong;
break; break;
case PLUGIN_VAR_DOUBLE:
((thdvar_double_t *) opt)->resolve= mysql_sys_var_double;
break;
default: default:
sql_print_error("Unknown variable type code 0x%x in plugin '%s'.", sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
opt->flags, plugin_name); opt->flags, plugin_name);
@ -3602,6 +3657,12 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
if (!opt->update) if (!opt->update)
opt->update= update_func_longlong; opt->update= update_func_longlong;
break; break;
case PLUGIN_VAR_DOUBLE:
if (!opt->check)
opt->check= check_func_double;
if (!opt->update)
opt->update= update_func_double;
break;
default: default:
sql_print_error("Unknown variable type code 0x%x in plugin '%s'.", sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",
opt->flags, plugin_name); opt->flags, plugin_name);

View File

@ -1,5 +1,6 @@
/* /*
Copyright (c) 2000, 2010, Oracle and/or its affiliates. Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2011, 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
@ -294,7 +295,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
(void) mysql_rename_table(ha_resolve_by_legacy_type(thd, (void) mysql_rename_table(ha_resolve_by_legacy_type(thd,
table_type), table_type),
new_db, new_alias, new_db, new_alias,
ren_table->db, old_alias, 0); ren_table->db, old_alias, NO_FK_CHECKS);
} }
} }
} }

View File

@ -5038,8 +5038,23 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
Optionally (if out_args is supplied) will push the arguments of Optionally (if out_args is supplied) will push the arguments of
AGGFN(DISTINCT) to the list AGGFN(DISTINCT) to the list
Check for every COUNT(DISTINCT), AVG(DISTINCT) or
SUM(DISTINCT). These can be resolved by Loose Index Scan as long
as all the aggregate distinct functions refer to the same
fields. Thus:
SELECT AGGFN(DISTINCT a, b), AGGFN(DISTINCT b, a)... => can use LIS
SELECT AGGFN(DISTINCT a), AGGFN(DISTINCT a) ... => can use LIS
SELECT AGGFN(DISTINCT a, b), AGGFN(DISTINCT a) ... => cannot use LIS
SELECT AGGFN(DISTINCT a), AGGFN(DISTINCT b) ... => cannot use LIS
etc.
@param join the join to check @param join the join to check
@param[out] out_args list of aggregate function arguments @param[out] out_args Collect the arguments of the aggregate functions
to a list. We don't worry about duplicates as
these will be sorted out later in
get_best_group_min_max.
@return does the query qualify for indexed AGGFN(DISTINCT) @return does the query qualify for indexed AGGFN(DISTINCT)
@retval true it does @retval true it does
@retval false AGGFN(DISTINCT) must apply distinct in it. @retval false AGGFN(DISTINCT) must apply distinct in it.
@ -5050,6 +5065,7 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
{ {
Item_sum **sum_item_ptr; Item_sum **sum_item_ptr;
bool result= false; bool result= false;
Field_map first_aggdistinct_fields;
if (join->table_count != 1 || /* reference more than 1 table */ if (join->table_count != 1 || /* reference more than 1 table */
join->select_distinct || /* or a DISTINCT */ join->select_distinct || /* or a DISTINCT */
@ -5062,6 +5078,7 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
for (sum_item_ptr= join->sum_funcs; *sum_item_ptr; sum_item_ptr++) for (sum_item_ptr= join->sum_funcs; *sum_item_ptr; sum_item_ptr++)
{ {
Item_sum *sum_item= *sum_item_ptr; Item_sum *sum_item= *sum_item_ptr;
Field_map cur_aggdistinct_fields;
Item *expr; Item *expr;
/* aggregate is not AGGFN(DISTINCT) or more than 1 argument to it */ /* aggregate is not AGGFN(DISTINCT) or more than 1 argument to it */
switch (sum_item->sum_func()) switch (sum_item->sum_func())
@ -5091,15 +5108,23 @@ is_indexed_agg_distinct(JOIN *join, List<Item_field> *out_args)
if (expr->real_item()->type() != Item::FIELD_ITEM) if (expr->real_item()->type() != Item::FIELD_ITEM)
return false; return false;
/* Item_field* item= static_cast<Item_field*>(expr->real_item());
If we came to this point the AGGFN(DISTINCT) loose index scan
optimization is applicable
*/
if (out_args) if (out_args)
out_args->push_back((Item_field *) expr->real_item()); out_args->push_back(item);
cur_aggdistinct_fields.set_bit(item->field->field_index);
result= true; result= true;
} }
/*
If there are multiple aggregate functions, make sure that they all
refer to exactly the same set of columns.
*/
if (first_aggdistinct_fields.is_clear_all())
first_aggdistinct_fields.merge(cur_aggdistinct_fields);
else if (first_aggdistinct_fields != cur_aggdistinct_fields)
return false;
} }
return result; return result;
} }
@ -21169,22 +21194,20 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if (field != NULL) if (field != NULL)
{ {
/* /*
Replace "@:=<expression>" with "@:=<tmp table column>". Otherwise, Replace "@:=<expression>" with "@:=<tmp table column>". Otherwise, we
we would re-evaluate <expression>, and if expression were would re-evaluate <expression>, and if expression were a subquery, this
a subquery, this would access already-unlocked tables. would access already-unlocked tables.
*/ */
Item_func_set_user_var* suv= Item_func_set_user_var* suv=
new Item_func_set_user_var((Item_func_set_user_var*) item); new Item_func_set_user_var(thd, (Item_func_set_user_var*) item);
Item_field *new_field= new Item_field(field); Item_field *new_field= new Item_field(field);
if (!suv || !new_field || suv->fix_fields(thd, (Item**)&suv)) if (!suv || !new_field)
DBUG_RETURN(true); // Fatal error DBUG_RETURN(true); // Fatal error
((Item *)suv)->name= item->name;
/* /*
We are replacing the argument of Item_func_set_user_var after its We are replacing the argument of Item_func_set_user_var after its value
value has been read. The argument's null_value should be set by has been read. The argument's null_value should be set by now, so we
now, so we must set it explicitly for the replacement argument must set it explicitly for the replacement argument since the null_value
since the null_value may be read without any preceeding call to may be read without any preceeding call to val_*().
val_*().
*/ */
new_field->update_null_value(); new_field->update_null_value();
List<Item> list; List<Item> list;

View File

@ -4655,6 +4655,8 @@ make_unique_key_name(const char *field_name,KEY *start,KEY *end)
FN_TO_IS_TMP new_name is temporary. FN_TO_IS_TMP new_name is temporary.
NO_FRM_RENAME Don't rename the FRM file NO_FRM_RENAME Don't rename the FRM file
but only the table in the storage engine. but only the table in the storage engine.
NO_FK_CHECKS Don't check FK constraints
during rename.
RETURN RETURN
FALSE OK FALSE OK
@ -4673,10 +4675,15 @@ mysql_rename_table(handlerton *base, const char *old_db,
char tmp_name[SAFE_NAME_LEN+1]; char tmp_name[SAFE_NAME_LEN+1];
handler *file; handler *file;
int error=0; int error=0;
ulonglong save_bits= thd->variables.option_bits;
DBUG_ENTER("mysql_rename_table"); DBUG_ENTER("mysql_rename_table");
DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'", DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
old_db, old_name, new_db, new_name)); old_db, old_name, new_db, new_name));
// Temporarily disable foreign key checks
if (flags & NO_FK_CHECKS)
thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
file= (base == NULL ? 0 : file= (base == NULL ? 0 :
get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base)); get_new_handler((TABLE_SHARE*) 0, thd->mem_root, base));
@ -4723,6 +4730,10 @@ mysql_rename_table(handlerton *base, const char *old_db,
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error); my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
else if (!(flags & FN_IS_TMP)) else if (!(flags & FN_IS_TMP))
mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name); mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name);
// Restore options bits to the original value
thd->variables.option_bits= save_bits;
DBUG_RETURN(error != 0); DBUG_RETURN(error != 0);
} }
@ -6327,7 +6338,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
new_db, new_alias)) new_db, new_alias))
{ {
(void) mysql_rename_table(old_db_type, new_db, new_alias, db, (void) mysql_rename_table(old_db_type, new_db, new_alias, db,
table_name, 0); table_name, NO_FK_CHECKS);
error= -1; error= -1;
} }
} }
@ -7102,7 +7113,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error= 1; error= 1;
(void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP); (void) quick_rm_table(new_db_type, new_db, tmp_name, FN_IS_TMP);
(void) mysql_rename_table(old_db_type, db, old_name, db, alias, (void) mysql_rename_table(old_db_type, db, old_name, db, alias,
FN_FROM_IS_TMP); FN_FROM_IS_TMP | NO_FK_CHECKS);
} }
else if (new_name != table_name || new_db != db) else if (new_name != table_name || new_db != db)
{ {
@ -7114,7 +7125,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error= 1; error= 1;
(void) quick_rm_table(new_db_type, new_db, new_alias, 0); (void) quick_rm_table(new_db_type, new_db, new_alias, 0);
(void) mysql_rename_table(old_db_type, db, old_name, db, alias, (void) mysql_rename_table(old_db_type, db, old_name, db, alias,
FN_FROM_IS_TMP); FN_FROM_IS_TMP | NO_FK_CHECKS);
} }
else if (Table_triggers_list::change_table_name(thd, db, alias, else if (Table_triggers_list::change_table_name(thd, db, alias,
table_name, new_db, table_name, new_db,
@ -7124,7 +7135,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error= 1; error= 1;
(void) quick_rm_table(new_db_type, new_db, new_alias, 0); (void) quick_rm_table(new_db_type, new_db, new_alias, 0);
(void) mysql_rename_table(old_db_type, db, old_name, db, (void) mysql_rename_table(old_db_type, db, old_name, db,
alias, FN_FROM_IS_TMP); alias, FN_FROM_IS_TMP | NO_FK_CHECKS);
/* /*
If we were performing "fast"/in-place ALTER TABLE we also need If we were performing "fast"/in-place ALTER TABLE we also need
to restore old name of table in storage engine as a separate to restore old name of table in storage engine as a separate
@ -7133,7 +7144,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (need_copy_table == ALTER_TABLE_METADATA_ONLY) if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
{ {
(void) mysql_rename_table(save_old_db_type, new_db, new_alias, (void) mysql_rename_table(save_old_db_type, new_db, new_alias,
db, table_name, NO_FRM_RENAME); db, table_name,
NO_FRM_RENAME | NO_FK_CHECKS);
} }
} }
} }

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2006, 2013, 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
@ -118,6 +118,8 @@ enum enum_explain_filename_mode
#define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP) #define FN_IS_TMP (FN_FROM_IS_TMP | FN_TO_IS_TMP)
#define NO_FRM_RENAME (1 << 2) #define NO_FRM_RENAME (1 << 2)
#define FRM_ONLY (1 << 3) #define FRM_ONLY (1 << 3)
/** Don't check foreign key constraints while renaming table */
#define NO_FK_CHECKS (1 << 4)
uint filename_to_tablename(const char *from, char *to, uint to_length uint filename_to_tablename(const char *from, char *to, uint to_length
#ifndef DBUG_OFF #ifndef DBUG_OFF

View File

@ -4188,8 +4188,8 @@ ts_wait:
; ;
size_number: size_number:
real_ulong_num { $$= $1;} real_ulonglong_num { $$= $1;}
| IDENT | IDENT_sys
{ {
ulonglong number; ulonglong number;
uint text_shift_number= 0; uint text_shift_number= 0;

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 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
@ -138,6 +139,7 @@ public:
option.u_max_value= (uchar**)max_var_ptr(); option.u_max_value= (uchar**)max_var_ptr();
if (max_var_ptr()) if (max_var_ptr())
*max_var_ptr()= max_val; *max_var_ptr()= max_val;
global_var(T)= def_val; global_var(T)= def_val;
SYSVAR_ASSERT(size == sizeof(T)); SYSVAR_ASSERT(size == sizeof(T));
SYSVAR_ASSERT(min_val < max_val); SYSVAR_ASSERT(min_val < max_val);
@ -904,13 +906,14 @@ public:
on_update_function on_update_func=0, on_update_function on_update_func=0,
const char *substitute=0) const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id, : sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_DOUBLE, (longlong) double2ulonglong(def_val), getopt.arg_type, SHOW_DOUBLE,
(longlong) getopt_double2ulonglong(def_val),
lock, binlog_status_arg, on_check_func, on_update_func, lock, binlog_status_arg, on_check_func, on_update_func,
substitute) substitute)
{ {
option.var_type= GET_DOUBLE; option.var_type= GET_DOUBLE;
option.min_value= (longlong) double2ulonglong(min_val); option.min_value= (longlong) getopt_double2ulonglong(min_val);
option.max_value= (longlong) double2ulonglong(max_val); option.max_value= (longlong) getopt_double2ulonglong(max_val);
global_var(double)= (double)option.def_value; global_var(double)= (double)option.def_value;
SYSVAR_ASSERT(min_val < max_val); SYSVAR_ASSERT(min_val < max_val);
SYSVAR_ASSERT(min_val <= def_val); SYSVAR_ASSERT(min_val <= def_val);
@ -942,7 +945,7 @@ public:
void session_save_default(THD *thd, set_var *var) void session_save_default(THD *thd, set_var *var)
{ var->save_result.double_value= global_var(double); } { var->save_result.double_value= global_var(double); }
void global_save_default(THD *thd, set_var *var) void global_save_default(THD *thd, set_var *var)
{ var->save_result.double_value= (double)option.def_value; } { var->save_result.double_value= getopt_ulonglong2double(option.def_value); }
}; };
/** /**

View File

@ -953,9 +953,13 @@ enum index_hint_type
INDEX_HINT_FORCE INDEX_HINT_FORCE
}; };
#define CHECK_ROW_FOR_NULLS_TO_REJECT (1 << 0) #define CHECK_ROW_FOR_NULLS_TO_REJECT (1 << 0)
#define REJECT_ROW_DUE_TO_NULL_FIELDS (1 << 1) #define REJECT_ROW_DUE_TO_NULL_FIELDS (1 << 1)
/* Bitmap of table's fields */
typedef Bitmap<MAX_FIELDS> Field_map;
struct TABLE struct TABLE
{ {
TABLE() {} /* Remove gcc warning */ TABLE() {} /* Remove gcc warning */

View File

@ -1057,6 +1057,7 @@ struct st_mysql_storage_engine example_storage_engine=
static ulong srv_enum_var= 0; static ulong srv_enum_var= 0;
static ulong srv_ulong_var= 0; static ulong srv_ulong_var= 0;
static double srv_double_var= 0;
const char *enum_var_names[]= const char *enum_var_names[]=
{ {
@ -1091,9 +1092,34 @@ static MYSQL_SYSVAR_ULONG(
1000, 1000,
0); 0);
static MYSQL_SYSVAR_DOUBLE(
double_var,
srv_double_var,
PLUGIN_VAR_RQCMDARG,
"0.500000..1000.500000",
NULL,
NULL,
8.5,
0.5,
1000.5,
0); // reserved always 0
static MYSQL_THDVAR_DOUBLE(
double_thdvar,
PLUGIN_VAR_RQCMDARG,
"0.500000..1000.500000",
NULL,
NULL,
8.5,
0.5,
1000.5,
0);
static struct st_mysql_sys_var* example_system_variables[]= { static struct st_mysql_sys_var* example_system_variables[]= {
MYSQL_SYSVAR(enum_var), MYSQL_SYSVAR(enum_var),
MYSQL_SYSVAR(ulong_var), MYSQL_SYSVAR(ulong_var),
MYSQL_SYSVAR(double_var),
MYSQL_SYSVAR(double_thdvar),
NULL NULL
}; };
@ -1104,8 +1130,9 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
var->type= SHOW_CHAR; var->type= SHOW_CHAR;
var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes
my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE, my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE,
"enum_var is %lu, ulong_var is %lu, %.6b", // %b is MySQL extension "enum_var is %lu, ulong_var is %lu, "
srv_enum_var, srv_ulong_var, "really"); "double_var is %f, %.6b", // %b is a MySQL extension
srv_enum_var, srv_ulong_var, srv_double_var, "really");
return 0; return 0;
} }

View File

@ -42,7 +42,21 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h" #include "ibuf0ibuf.h"
#include "trx0trx.h" #include "trx0trx.h"
/**************************************************************//**
Checks if the page in the cursor can be merged with given page.
If necessary, re-organize the merge_page.
@return TRUE if possible to merge. */
UNIV_INTERN
ibool
btr_can_merge_with_page(
/*====================*/
btr_cur_t* cursor, /*!< in: cursor on the page to merge */
ulint page_no, /*!< in: a sibling page */
buf_block_t** merge_block, /*!< out: the merge block */
mtr_t* mtr); /*!< in: mini-transaction */
#endif /* UNIV_HOTBACKUP */ #endif /* UNIV_HOTBACKUP */
/**************************************************************//** /**************************************************************//**
Report that an index page is corrupted. */ Report that an index page is corrupted. */
UNIV_INTERN UNIV_INTERN
@ -3252,7 +3266,7 @@ btr_compress(
ulint left_page_no; ulint left_page_no;
ulint right_page_no; ulint right_page_no;
buf_block_t* merge_block; buf_block_t* merge_block;
page_t* merge_page; page_t* merge_page = NULL;
page_zip_des_t* merge_page_zip; page_zip_des_t* merge_page_zip;
ibool is_left; ibool is_left;
buf_block_t* block; buf_block_t* block;
@ -3260,11 +3274,8 @@ btr_compress(
btr_cur_t father_cursor; btr_cur_t father_cursor;
mem_heap_t* heap; mem_heap_t* heap;
ulint* offsets; ulint* offsets;
ulint data_size;
ulint n_recs;
ulint nth_rec = 0; /* remove bogus warning */ ulint nth_rec = 0; /* remove bogus warning */
ulint max_ins_size; DBUG_ENTER("btr_compress");
ulint max_ins_size_reorg;
block = btr_cur_get_block(cursor); block = btr_cur_get_block(cursor);
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
@ -3281,10 +3292,13 @@ btr_compress(
left_page_no = btr_page_get_prev(page, mtr); left_page_no = btr_page_get_prev(page, mtr);
right_page_no = btr_page_get_next(page, mtr); right_page_no = btr_page_get_next(page, mtr);
#if 0 #ifdef UNIV_DEBUG
fprintf(stderr, "Merge left page %lu right %lu \n", if (!page_is_leaf(page) && left_page_no == FIL_NULL) {
left_page_no, right_page_no); ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits(
#endif page_rec_get_next(page_get_infimum_rec(page)),
page_is_comp(page)));
}
#endif /* UNIV_DEBUG */
heap = mem_heap_create(100); heap = mem_heap_create(100);
offsets = btr_page_get_father_block(NULL, heap, index, block, mtr, offsets = btr_page_get_father_block(NULL, heap, index, block, mtr,
@ -3295,30 +3309,7 @@ btr_compress(
ut_ad(nth_rec > 0); ut_ad(nth_rec > 0);
} }
/* Decide the page to which we try to merge and which will inherit if (left_page_no == FIL_NULL && right_page_no == FIL_NULL) {
the locks */
is_left = left_page_no != FIL_NULL;
if (is_left) {
merge_block = btr_block_get(space, zip_size, left_page_no,
RW_X_LATCH, index, mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr)
== buf_block_get_page_no(block));
#endif /* UNIV_BTR_DEBUG */
} else if (right_page_no != FIL_NULL) {
merge_block = btr_block_get(space, zip_size, right_page_no,
RW_X_LATCH, index, mtr);
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr)
== buf_block_get_page_no(block));
#endif /* UNIV_BTR_DEBUG */
} else {
/* The page is the only one on the level, lift the records /* The page is the only one on the level, lift the records
to the father */ to the father */
@ -3326,57 +3317,34 @@ btr_compress(
goto func_exit; goto func_exit;
} }
n_recs = page_get_n_recs(page); /* Decide the page to which we try to merge and which will inherit
data_size = page_get_data_size(page); the locks */
is_left = btr_can_merge_with_page(cursor, left_page_no,
&merge_block, mtr);
DBUG_EXECUTE_IF("ib_always_merge_right", is_left = FALSE;);
if(!is_left
&& !btr_can_merge_with_page(cursor, right_page_no, &merge_block,
mtr)) {
goto err_exit;
}
merge_page = buf_block_get_frame(merge_block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(merge_page) == page_is_comp(page)); if (is_left) {
ut_a(btr_page_get_next(merge_page, mtr)
== buf_block_get_page_no(block));
} else {
ut_a(btr_page_get_prev(merge_page, mtr)
== buf_block_get_page_no(block));
}
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
max_ins_size_reorg = page_get_max_insert_size_after_reorganize(
merge_page, n_recs);
if (data_size > max_ins_size_reorg) {
/* No space for merge */
err_exit:
/* We play it safe and reset the free bits. */
if (zip_size
&& page_is_leaf(merge_page)
&& !dict_index_is_clust(index)) {
ibuf_reset_free_bits(merge_block);
}
mem_heap_free(heap);
return(FALSE);
}
ut_ad(page_validate(merge_page, index)); ut_ad(page_validate(merge_page, index));
max_ins_size = page_get_max_insert_size(merge_page, n_recs);
if (UNIV_UNLIKELY(data_size > max_ins_size)) {
/* We have to reorganize merge_page */
if (UNIV_UNLIKELY(!btr_page_reorganize(merge_block,
index, mtr))) {
goto err_exit;
}
max_ins_size = page_get_max_insert_size(merge_page, n_recs);
ut_ad(page_validate(merge_page, index));
ut_ad(max_ins_size == max_ins_size_reorg);
if (UNIV_UNLIKELY(data_size > max_ins_size)) {
/* Add fault tolerance, though this should
never happen */
goto err_exit;
}
}
merge_page_zip = buf_block_get_page_zip(merge_block); merge_page_zip = buf_block_get_page_zip(merge_block);
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
if (UNIV_LIKELY_NULL(merge_page_zip)) { if (UNIV_LIKELY_NULL(merge_page_zip)) {
@ -3411,11 +3379,18 @@ err_exit:
} }
} else { } else {
rec_t* orig_succ; rec_t* orig_succ;
ibool compressed;
ulint err;
btr_cur_t cursor2;
/* father cursor pointing to node ptr
of the right sibling */
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
byte fil_page_prev[4]; byte fil_page_prev[4];
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
if (UNIV_LIKELY_NULL(merge_page_zip)) { btr_page_get_father(index, merge_block, mtr, &cursor2);
if (merge_page_zip && left_page_no == FIL_NULL) {
/* The function page_zip_compress(), which will be /* The function page_zip_compress(), which will be
invoked by page_copy_rec_list_end() below, invoked by page_copy_rec_list_end() below,
requires that FIL_PAGE_PREV be FIL_NULL. requires that FIL_PAGE_PREV be FIL_NULL.
@ -3436,9 +3411,12 @@ err_exit:
if (UNIV_UNLIKELY(!orig_succ)) { if (UNIV_UNLIKELY(!orig_succ)) {
ut_a(merge_page_zip); ut_a(merge_page_zip);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
/* FIL_PAGE_PREV was restored from merge_page_zip. */ if (left_page_no == FIL_NULL) {
/* FIL_PAGE_PREV was restored from
merge_page_zip. */
ut_a(!memcmp(fil_page_prev, ut_a(!memcmp(fil_page_prev,
merge_page + FIL_PAGE_PREV, 4)); merge_page + FIL_PAGE_PREV, 4));
}
#endif /* UNIV_BTR_DEBUG */ #endif /* UNIV_BTR_DEBUG */
goto err_exit; goto err_exit;
} }
@ -3446,7 +3424,7 @@ err_exit:
btr_search_drop_page_hash_index(block); btr_search_drop_page_hash_index(block);
#ifdef UNIV_BTR_DEBUG #ifdef UNIV_BTR_DEBUG
if (UNIV_LIKELY_NULL(merge_page_zip)) { if (merge_page_zip && left_page_no == FIL_NULL) {
/* Restore FIL_PAGE_PREV in order to avoid an assertion /* Restore FIL_PAGE_PREV in order to avoid an assertion
failure in btr_level_list_remove(), which will set failure in btr_level_list_remove(), which will set
the field again to FIL_NULL. Even though this makes the field again to FIL_NULL. Even though this makes
@ -3462,12 +3440,18 @@ err_exit:
/* Replace the address of the old child node (= page) with the /* Replace the address of the old child node (= page) with the
address of the merge page to the right */ address of the merge page to the right */
btr_node_ptr_set_child_page_no( btr_node_ptr_set_child_page_no(
btr_cur_get_rec(&father_cursor), btr_cur_get_rec(&father_cursor),
btr_cur_get_page_zip(&father_cursor), btr_cur_get_page_zip(&father_cursor),
offsets, right_page_no, mtr); offsets, right_page_no, mtr);
btr_node_ptr_delete(index, merge_block, mtr);
compressed = btr_cur_pessimistic_delete(&err, TRUE, &cursor2,
RB_NONE, mtr);
ut_a(err == DB_SUCCESS);
if (!compressed) {
btr_cur_compress_if_useful(&cursor2, FALSE, mtr);
}
lock_update_merge_right(merge_block, orig_succ, block); lock_update_merge_right(merge_block, orig_succ, block);
} }
@ -3535,8 +3519,19 @@ func_exit:
page_rec_get_nth(merge_block->frame, nth_rec), page_rec_get_nth(merge_block->frame, nth_rec),
merge_block, cursor); merge_block, cursor);
} }
DBUG_RETURN(TRUE);
return(TRUE); err_exit:
/* We play it safe and reset the free bits. */
if (zip_size
&& merge_page
&& page_is_leaf(merge_page)
&& !dict_index_is_clust(index)) {
ibuf_reset_free_bits(merge_block);
}
mem_heap_free(heap);
DBUG_RETURN(FALSE);
} }
/*************************************************************//** /*************************************************************//**
@ -4532,4 +4527,86 @@ btr_validate_index(
return(TRUE); return(TRUE);
} }
/**************************************************************//**
Checks if the page in the cursor can be merged with given page.
If necessary, re-organize the merge_page.
@return TRUE if possible to merge. */
UNIV_INTERN
ibool
btr_can_merge_with_page(
/*====================*/
btr_cur_t* cursor, /*!< in: cursor on the page to merge */
ulint page_no, /*!< in: a sibling page */
buf_block_t** merge_block, /*!< out: the merge block */
mtr_t* mtr) /*!< in: mini-transaction */
{
dict_index_t* index;
page_t* page;
ulint space;
ulint zip_size;
ulint n_recs;
ulint data_size;
ulint max_ins_size_reorg;
ulint max_ins_size;
buf_block_t* mblock;
page_t* mpage;
DBUG_ENTER("btr_can_merge_with_page");
if (page_no == FIL_NULL) {
goto error;
}
index = btr_cur_get_index(cursor);
page = btr_cur_get_page(cursor);
space = dict_index_get_space(index);
zip_size = dict_table_zip_size(index->table);
mblock = btr_block_get(space, zip_size, page_no, RW_X_LATCH, index,
mtr);
mpage = buf_block_get_frame(mblock);
n_recs = page_get_n_recs(page);
data_size = page_get_data_size(page);
max_ins_size_reorg = page_get_max_insert_size_after_reorganize(
mpage, n_recs);
if (data_size > max_ins_size_reorg) {
goto error;
}
max_ins_size = page_get_max_insert_size(mpage, n_recs);
if (data_size > max_ins_size) {
/* We have to reorganize mpage */
if (!btr_page_reorganize(mblock, index, mtr)) {
goto error;
}
max_ins_size = page_get_max_insert_size(mpage, n_recs);
ut_ad(page_validate(mpage, index));
ut_ad(max_ins_size == max_ins_size_reorg);
if (data_size > max_ins_size) {
/* Add fault tolerance, though this should
never happen */
goto error;
}
}
*merge_block = mblock;
DBUG_RETURN(TRUE);
error:
*merge_block = NULL;
DBUG_RETURN(FALSE);
}
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -18,8 +18,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -18,8 +18,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

4
storage/innobase/compile-innodb Executable file → Normal file
View File

@ -11,8 +11,8 @@
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License along with # You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple # this program; if not, write to the Free Software Foundation, Inc.,
# Place, Suite 330, Boston, MA 02111-1307 USA # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# we assume this script is in storage/innobase/ # we assume this script is in storage/innobase/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/
@ -378,7 +378,7 @@ dict_create_sys_indexes_tuple(
sys_indexes = dict_sys->sys_indexes; sys_indexes = dict_sys->sys_indexes;
table = dict_table_get_low(index->table_name); table = dict_table_get_low(index->table_name, DICT_ERR_IGNORE_NONE);
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS); entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
@ -580,7 +580,7 @@ dict_build_index_def_step(
index = node->index; index = node->index;
table = dict_table_get_low(index->table_name); table = dict_table_get_low(index->table_name, DICT_ERR_IGNORE_NONE);
if (table == NULL) { if (table == NULL) {
return(DB_TABLE_NOT_FOUND); return(DB_TABLE_NOT_FOUND);
@ -1215,8 +1215,8 @@ dict_create_or_check_foreign_constraint_tables(void)
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
table1 = dict_table_get_low("SYS_FOREIGN"); table1 = dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE);
table2 = dict_table_get_low("SYS_FOREIGN_COLS"); table2 = dict_table_get_low("SYS_FOREIGN_COLS", DICT_ERR_IGNORE_NONE);
if (table1 && table2 if (table1 && table2
&& UT_LIST_GET_LEN(table1->indexes) == 3 && UT_LIST_GET_LEN(table1->indexes) == 3
@ -1546,7 +1546,7 @@ dict_create_add_foreigns_to_dictionary(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
if (NULL == dict_table_get_low("SYS_FOREIGN")) { if (NULL == dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: table SYS_FOREIGN not found" "InnoDB: table SYS_FOREIGN not found"
" in internal data dictionary\n"); " in internal data dictionary\n");

View File

@ -23,6 +23,8 @@ Data dictionary system
Created 1/8/1996 Heikki Tuuri Created 1/8/1996 Heikki Tuuri
***********************************************************************/ ***********************************************************************/
#include <my_sys.h>
#include "dict0dict.h" #include "dict0dict.h"
#ifdef UNIV_NONINL #ifdef UNIV_NONINL
@ -751,14 +753,17 @@ dict_table_t*
dict_table_get( dict_table_get(
/*===========*/ /*===========*/
const char* table_name, /*!< in: table name */ const char* table_name, /*!< in: table name */
ibool inc_mysql_count)/*!< in: whether to increment the open ibool inc_mysql_count,/*!< in: whether to increment
handle count on the table */ the open handle count on the
table */
dict_err_ignore_t ignore_err) /*!< in: errors to ignore when
loading the table */
{ {
dict_table_t* table; dict_table_t* table;
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(table_name); table = dict_table_get_low(table_name, ignore_err);
if (inc_mysql_count && table) { if (inc_mysql_count && table) {
table->n_mysql_handles_opened++; table->n_mysql_handles_opened++;
@ -1832,6 +1837,11 @@ undo_size_ok:
dict_index_is_ibuf(index) dict_index_is_ibuf(index)
? SYNC_IBUF_INDEX_TREE : SYNC_INDEX_TREE); ? SYNC_IBUF_INDEX_TREE : SYNC_INDEX_TREE);
DBUG_EXECUTE_IF(
"index_partially_created_should_kick",
DEBUG_SYNC_C("index_partially_created");
);
if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) { if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
new_index->stat_n_diff_key_vals = mem_heap_alloc( new_index->stat_n_diff_key_vals = mem_heap_alloc(
@ -2745,9 +2755,11 @@ UNIV_INTERN
ulint ulint
dict_foreign_add_to_cache( dict_foreign_add_to_cache(
/*======================*/ /*======================*/
dict_foreign_t* foreign, /*!< in, own: foreign key constraint */ dict_foreign_t* foreign, /*!< in, own: foreign key
ibool check_charsets) /*!< in: TRUE=check charset constraint */
ibool check_charsets, /*!< in: TRUE=check charset
compatibility */ compatibility */
dict_err_ignore_t ignore_err) /*!< in: error to be ignored */
{ {
dict_table_t* for_table; dict_table_t* for_table;
dict_table_t* ref_table; dict_table_t* ref_table;
@ -2787,7 +2799,8 @@ dict_foreign_add_to_cache(
for_in_cache->n_fields, for_in_cache->foreign_index, for_in_cache->n_fields, for_in_cache->foreign_index,
check_charsets, FALSE); check_charsets, FALSE);
if (index == NULL) { if (index == NULL
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
dict_foreign_error_report( dict_foreign_error_report(
ef, for_in_cache, ef, for_in_cache,
"there is no index in referenced table" "there is no index in referenced table"
@ -2822,7 +2835,8 @@ dict_foreign_add_to_cache(
& (DICT_FOREIGN_ON_DELETE_SET_NULL & (DICT_FOREIGN_ON_DELETE_SET_NULL
| DICT_FOREIGN_ON_UPDATE_SET_NULL)); | DICT_FOREIGN_ON_UPDATE_SET_NULL));
if (index == NULL) { if (index == NULL
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
dict_foreign_error_report( dict_foreign_error_report(
ef, for_in_cache, ef, for_in_cache,
"there is no index in the table" "there is no index in the table"
@ -2872,14 +2886,27 @@ dict_scan_to(
const char* string) /*!< in: look for this */ const char* string) /*!< in: look for this */
{ {
char quote = '\0'; char quote = '\0';
ibool escape = FALSE;
for (; *ptr; ptr++) { for (; *ptr; ptr++) {
if (*ptr == quote) { if (*ptr == quote) {
/* Closing quote character: do not look for /* Closing quote character: do not look for
starting quote or the keyword. */ starting quote or the keyword. */
/* If the quote character is escaped by a
backslash, ignore it. */
if (escape) {
escape = FALSE;
} else {
quote = '\0'; quote = '\0';
}
} else if (quote) { } else if (quote) {
/* Within quotes: do nothing. */ /* Within quotes: do nothing. */
if (escape) {
escape = FALSE;
} else if (*ptr == '\\') {
escape = TRUE;
}
} else if (*ptr == '`' || *ptr == '"' || *ptr == '\'') { } else if (*ptr == '`' || *ptr == '"' || *ptr == '\'') {
/* Starting quote: remember the quote character. */ /* Starting quote: remember the quote character. */
quote = *ptr; quote = *ptr;
@ -3198,7 +3225,7 @@ dict_scan_table_name(
2 = Store as given, compare in lower; case semi-sensitive */ 2 = Store as given, compare in lower; case semi-sensitive */
if (innobase_get_lower_case_table_names() == 2) { if (innobase_get_lower_case_table_names() == 2) {
innobase_casedn_str(ref); innobase_casedn_str(ref);
*table = dict_table_get_low(ref); *table = dict_table_get_low(ref, DICT_ERR_IGNORE_NONE);
memcpy(ref, database_name, database_name_len); memcpy(ref, database_name, database_name_len);
ref[database_name_len] = '/'; ref[database_name_len] = '/';
memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
@ -3211,7 +3238,7 @@ dict_scan_table_name(
#else #else
innobase_casedn_str(ref); innobase_casedn_str(ref);
#endif /* !__WIN__ */ #endif /* !__WIN__ */
*table = dict_table_get_low(ref); *table = dict_table_get_low(ref, DICT_ERR_IGNORE_NONE);
} }
*success = TRUE; *success = TRUE;
@ -3265,6 +3292,11 @@ dict_strip_comments(
char* ptr; char* ptr;
/* unclosed quote character (0 if none) */ /* unclosed quote character (0 if none) */
char quote = 0; char quote = 0;
ibool escape = FALSE;
DBUG_ENTER("dict_strip_comments");
DBUG_PRINT("dict_strip_comments", ("%s", sql_string));
str = mem_alloc(sql_length + 1); str = mem_alloc(sql_length + 1);
@ -3279,16 +3311,29 @@ end_of_string:
ut_a(ptr <= str + sql_length); ut_a(ptr <= str + sql_length);
return(str); DBUG_PRINT("dict_strip_comments", ("%s", str));
DBUG_RETURN(str);
} }
if (*sptr == quote) { if (*sptr == quote) {
/* Closing quote character: do not look for /* Closing quote character: do not look for
starting quote or comments. */ starting quote or comments. */
/* If the quote character is escaped by a
backslash, ignore it. */
if (escape) {
escape = FALSE;
} else {
quote = 0; quote = 0;
}
} else if (quote) { } else if (quote) {
/* Within quotes: do not look for /* Within quotes: do not look for
starting quotes or comments. */ starting quotes or comments. */
if (escape) {
escape = FALSE;
} else if (*sptr == '\\') {
escape = TRUE;
}
} else if (*sptr == '"' || *sptr == '`' || *sptr == '\'') { } else if (*sptr == '"' || *sptr == '`' || *sptr == '\'') {
/* Starting quote: remember the quote character. */ /* Starting quote: remember the quote character. */
quote = *sptr; quote = *sptr;
@ -3461,7 +3506,7 @@ dict_create_foreign_constraints_low(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
table = dict_table_get_low(name); table = dict_table_get_low(name, DICT_ERR_IGNORE_NONE);
if (table == NULL) { if (table == NULL) {
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
@ -4468,7 +4513,13 @@ dict_update_statistics(
return; return;
} }
do { for (; index != NULL; index = dict_table_get_next_index(index)) {
/* Skip incomplete indexes. */
if (index->name[0] == TEMP_INDEX_PREFIX) {
continue;
}
if (UNIV_LIKELY if (UNIV_LIKELY
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
@ -4522,9 +4573,7 @@ fake_statistics:
(1 + dict_index_get_n_unique(index)) (1 + dict_index_get_n_unique(index))
* sizeof(*index->stat_n_non_null_key_vals)); * sizeof(*index->stat_n_non_null_key_vals));
} }
}
index = dict_table_get_next_index(index);
} while (index);
index = dict_table_get_first_index(table); index = dict_table_get_first_index(table);
@ -4600,7 +4649,7 @@ dict_table_print_by_name(
mutex_enter(&(dict_sys->mutex)); mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(name); table = dict_table_get_low(name, DICT_ERR_IGNORE_NONE);
ut_a(table); ut_a(table);

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/
@ -103,7 +103,7 @@ dict_get_first_table_name_in_db(
mtr_start(&mtr); mtr_start(&mtr);
sys_tables = dict_table_get_low("SYS_TABLES"); sys_tables = dict_table_get_low("SYS_TABLES", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables)); ut_a(!dict_table_is_comp(sys_tables));
@ -269,7 +269,8 @@ dict_startscan_system(
ut_a(system_id < SYS_NUM_SYSTEM_TABLES); ut_a(system_id < SYS_NUM_SYSTEM_TABLES);
system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id]); system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id],
DICT_ERR_IGNORE_NONE);
clust_index = UT_LIST_GET_FIRST(system_table->indexes); clust_index = UT_LIST_GET_FIRST(system_table->indexes);
@ -334,7 +335,7 @@ dict_process_sys_tables_rec(
/* If DICT_TABLE_LOAD_FROM_CACHE is set, first check /* If DICT_TABLE_LOAD_FROM_CACHE is set, first check
whether there is cached dict_table_t struct first */ whether there is cached dict_table_t struct first */
if (status & DICT_TABLE_LOAD_FROM_CACHE) { if (status & DICT_TABLE_LOAD_FROM_CACHE) {
*table = dict_table_get_low(table_name); *table = dict_table_get_low(table_name, DICT_ERR_IGNORE_NONE);
if (!(*table)) { if (!(*table)) {
err_msg = "Table not found in cache"; err_msg = "Table not found in cache";
@ -675,7 +676,7 @@ dict_check_tablespaces_and_store_max_id(
mtr_start(&mtr); mtr_start(&mtr);
sys_tables = dict_table_get_low("SYS_TABLES"); sys_tables = dict_table_get_low("SYS_TABLES", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables)); ut_a(!dict_table_is_comp(sys_tables));
@ -958,7 +959,7 @@ dict_load_columns(
mtr_start(&mtr); mtr_start(&mtr);
sys_columns = dict_table_get_low("SYS_COLUMNS"); sys_columns = dict_table_get_low("SYS_COLUMNS", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes); sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
ut_a(!dict_table_is_comp(sys_columns)); ut_a(!dict_table_is_comp(sys_columns));
@ -1165,7 +1166,7 @@ dict_load_fields(
mtr_start(&mtr); mtr_start(&mtr);
sys_fields = dict_table_get_low("SYS_FIELDS"); sys_fields = dict_table_get_low("SYS_FIELDS", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes); sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
ut_a(!dict_table_is_comp(sys_fields)); ut_a(!dict_table_is_comp(sys_fields));
ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME")); ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
@ -1392,7 +1393,7 @@ dict_load_indexes(
mtr_start(&mtr); mtr_start(&mtr);
sys_indexes = dict_table_get_low("SYS_INDEXES"); sys_indexes = dict_table_get_low("SYS_INDEXES", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes); sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
ut_a(!dict_table_is_comp(sys_indexes)); ut_a(!dict_table_is_comp(sys_indexes));
ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME")); ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
@ -1764,7 +1765,7 @@ dict_load_table(
mtr_start(&mtr); mtr_start(&mtr);
sys_tables = dict_table_get_low("SYS_TABLES"); sys_tables = dict_table_get_low("SYS_TABLES", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes); sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables)); ut_a(!dict_table_is_comp(sys_tables));
ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID")); ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
@ -1893,9 +1894,16 @@ err_exit:
all indexes were loaded. */ all indexes were loaded. */
if (!cached) { if (!cached) {
} else if (err == DB_SUCCESS) { } else if (err == DB_SUCCESS) {
err = dict_load_foreigns(table->name, TRUE, TRUE); err = dict_load_foreigns(table->name, TRUE, TRUE,
ignore_err);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr,
"InnoDB: Load table '%s' failed, the table "
"has missing foreign key indexes. Turn off "
"'foreign_key_checks' and try again.",
table->name);
dict_table_remove_from_cache(table); dict_table_remove_from_cache(table);
table = NULL; table = NULL;
} else { } else {
@ -2093,7 +2101,8 @@ dict_load_foreign_cols(
foreign->heap, foreign->n_fields * sizeof(void*)); foreign->heap, foreign->n_fields * sizeof(void*));
mtr_start(&mtr); mtr_start(&mtr);
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS"); sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS",
DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes); sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
ut_a(!dict_table_is_comp(sys_foreign_cols)); ut_a(!dict_table_is_comp(sys_foreign_cols));
@ -2142,15 +2151,19 @@ static
ulint ulint
dict_load_foreign( dict_load_foreign(
/*==============*/ /*==============*/
const char* id, /*!< in: foreign constraint id, not const char* id,
/*!< in: foreign constraint id, not
necessary '\0'-terminated */ necessary '\0'-terminated */
ulint id_len, /*!< in: id length */ ulint id_len,
/*!< in: id length */
ibool check_charsets, ibool check_charsets,
/*!< in: TRUE=check charset compatibility */ /*!< in: TRUE=check charset compatibility */
ibool check_recursive) ibool check_recursive,
/*!< in: Whether to record the foreign table /*!< in: Whether to record the foreign table
parent count to avoid unlimited recursive parent count to avoid unlimited recursive
load of chained foreign tables */ load of chained foreign tables */
dict_err_ignore_t ignore_err)
/*!< in: error to be ignored */
{ {
dict_foreign_t* foreign; dict_foreign_t* foreign;
dict_table_t* sys_foreign; dict_table_t* sys_foreign;
@ -2173,7 +2186,7 @@ dict_load_foreign(
mtr_start(&mtr); mtr_start(&mtr);
sys_foreign = dict_table_get_low("SYS_FOREIGN"); sys_foreign = dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE);
sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes); sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
ut_a(!dict_table_is_comp(sys_foreign)); ut_a(!dict_table_is_comp(sys_foreign));
@ -2287,7 +2300,9 @@ dict_load_foreign(
have to load it so that we are able to make type comparisons have to load it so that we are able to make type comparisons
in the next function call. */ in the next function call. */
for_table = dict_table_get_low(foreign->foreign_table_name_lookup); for_table = dict_table_get_low(
foreign->foreign_table_name_lookup,
DICT_ERR_IGNORE_NONE);
if (for_table && ref_table && check_recursive) { if (for_table && ref_table && check_recursive) {
/* This is to record the longest chain of ancesters /* This is to record the longest chain of ancesters
@ -2310,7 +2325,7 @@ dict_load_foreign(
a new foreign key constraint but loading one from the data a new foreign key constraint but loading one from the data
dictionary. */ dictionary. */
return(dict_foreign_add_to_cache(foreign, check_charsets)); return(dict_foreign_add_to_cache(foreign, check_charsets, ignore_err));
} }
/***********************************************************************//** /***********************************************************************//**
@ -2325,10 +2340,12 @@ ulint
dict_load_foreigns( dict_load_foreigns(
/*===============*/ /*===============*/
const char* table_name, /*!< in: table name */ const char* table_name, /*!< in: table name */
ibool check_recursive,/*!< in: Whether to check recursive ibool check_recursive,/*!< in: Whether to check
load of tables chained by FK */ recursive load of tables
ibool check_charsets) /*!< in: TRUE=check charset chained by FK */
ibool check_charsets, /*!< in: TRUE=check charset
compatibility */ compatibility */
dict_err_ignore_t ignore_err) /*!< in: error to be ignored */
{ {
ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1) ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1)
/ sizeof(ulint)]; / sizeof(ulint)];
@ -2345,7 +2362,7 @@ dict_load_foreigns(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
sys_foreign = dict_table_get_low("SYS_FOREIGN"); sys_foreign = dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE);
if (sys_foreign == NULL) { if (sys_foreign == NULL) {
/* No foreign keys defined yet in this database */ /* No foreign keys defined yet in this database */
@ -2429,7 +2446,7 @@ loop:
/* Load the foreign constraint definition to the dictionary cache */ /* Load the foreign constraint definition to the dictionary cache */
err = dict_load_foreign((char*) field, len, check_charsets, err = dict_load_foreign((char*) field, len, check_charsets,
check_recursive); check_recursive, ignore_err);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
btr_pcur_close(&pcur); btr_pcur_close(&pcur);

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/
@ -1860,7 +1860,7 @@ fil_write_flushed_lsn_to_data_files(
} }
/*******************************************************************//** /*******************************************************************//**
Checks the consistency of the first data page of a data file Checks the consistency of the first data page of a tablespace
at database startup. at database startup.
@retval NULL on success, or if innodb_force_recovery is set @retval NULL on success, or if innodb_force_recovery is set
@return pointer to an error message string */ @return pointer to an error message string */
@ -1868,9 +1868,7 @@ static __attribute__((warn_unused_result))
const char* const char*
fil_check_first_page( fil_check_first_page(
/*=================*/ /*=================*/
const page_t* page, /*!< in: data page */ const page_t* page) /*!< in: data page */
ibool first_page) /*!< in: TRUE if this is the
first page of the tablespace */
{ {
ulint space_id; ulint space_id;
ulint flags; ulint flags;
@ -1882,7 +1880,7 @@ fil_check_first_page(
space_id = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page); space_id = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page);
flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
if (first_page && !space_id && !flags) { if (!space_id && !flags) {
ulint nonzero_bytes = UNIV_PAGE_SIZE; ulint nonzero_bytes = UNIV_PAGE_SIZE;
const byte* b = page; const byte* b = page;
@ -1900,9 +1898,8 @@ fil_check_first_page(
return("checksum mismatch"); return("checksum mismatch");
} }
if (!first_page if (page_get_space_id(page) == space_id
|| (page_get_space_id(page) == space_id && page_get_page_no(page) == 0) {
&& page_get_page_no(page) == 0)) {
return(NULL); return(NULL);
} }
@ -1937,7 +1934,7 @@ fil_read_first_page(
byte* buf; byte* buf;
page_t* page; page_t* page;
ib_uint64_t flushed_lsn; ib_uint64_t flushed_lsn;
const char* check_msg; const char* check_msg = NULL;
buf = ut_malloc(2 * UNIV_PAGE_SIZE); buf = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for a possible read from a raw device */ /* Align the memory for a possible read from a raw device */
@ -1949,7 +1946,9 @@ fil_read_first_page(
flushed_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN); flushed_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN);
check_msg = fil_check_first_page(page, !one_read_already); if (!one_read_already) {
check_msg = fil_check_first_page(page);
}
ut_free(buf); ut_free(buf);
@ -3272,7 +3271,7 @@ fil_open_single_table_tablespace(
success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE); success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
check_msg = fil_check_first_page(page, TRUE); check_msg = fil_check_first_page(page);
/* We have to read the tablespace id and flags from the file. */ /* We have to read the tablespace id and flags from the file. */
@ -3528,7 +3527,7 @@ fil_load_single_table_tablespace(
/* We have to read the tablespace id from the file */ /* We have to read the tablespace id from the file */
check_msg = fil_check_first_page(page, TRUE); check_msg = fil_check_first_page(page);
if (check_msg) { if (check_msg) {
fprintf(stderr, fprintf(stderr,

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -103,7 +103,6 @@ extern "C" {
static mysql_mutex_t innobase_share_mutex; static mysql_mutex_t innobase_share_mutex;
/** to force correct commit order in binlog */ /** to force correct commit order in binlog */
static ulong commit_threads = 0; static ulong commit_threads = 0;
static mysql_mutex_t commit_threads_m;
static mysql_cond_t commit_cond; static mysql_cond_t commit_cond;
static mysql_mutex_t commit_cond_m; static mysql_mutex_t commit_cond_m;
static bool innodb_inited = 0; static bool innodb_inited = 0;
@ -221,12 +220,10 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = {
/* Keys to register pthread mutexes/cond in the current file with /* Keys to register pthread mutexes/cond in the current file with
performance schema */ performance schema */
static mysql_pfs_key_t innobase_share_mutex_key; static mysql_pfs_key_t innobase_share_mutex_key;
static mysql_pfs_key_t commit_threads_m_key;
static mysql_pfs_key_t commit_cond_mutex_key; static mysql_pfs_key_t commit_cond_mutex_key;
static mysql_pfs_key_t commit_cond_key; static mysql_pfs_key_t commit_cond_key;
static PSI_mutex_info all_pthread_mutexes[] = { static PSI_mutex_info all_pthread_mutexes[] = {
{&commit_threads_m_key, "commit_threads_m", 0},
{&commit_cond_mutex_key, "commit_cond_mutex", 0}, {&commit_cond_mutex_key, "commit_cond_mutex", 0},
{&innobase_share_mutex_key, "innobase_share_mutex", 0} {&innobase_share_mutex_key, "innobase_share_mutex", 0}
}; };
@ -763,22 +760,18 @@ innodb_srv_conc_exit_innodb(
} }
/******************************************************************//** /******************************************************************//**
Releases possible search latch and InnoDB thread FIFO ticket. These should Force a thread to leave InnoDB even if it has spare tickets. */
be released at each SQL statement end, and also when mysqld passes the
control to the client. It does no harm to release these also in the middle
of an SQL statement. */
static inline static inline
void void
innobase_release_stat_resources( innodb_srv_conc_force_exit_innodb(
/*============================*/ /*==============================*/
trx_t* trx) /*!< in: transaction object */ trx_t* trx) /*!< in: transaction handle */
{ {
if (trx->has_search_latch) { #ifdef UNIV_SYNC_DEBUG
trx_search_latch_release_if_reserved(trx); ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
} #endif /* UNIV_SYNC_DEBUG */
if (trx->declared_to_be_inside_innodb) { if (trx->declared_to_be_inside_innodb) {
/* Release our possible ticket in the FIFO */
srv_conc_force_exit_innodb(trx); srv_conc_force_exit_innodb(trx);
} }
@ -889,9 +882,10 @@ innobase_release_temporary_latches(
trx = thd_to_trx(thd); trx = thd_to_trx(thd);
if (trx) { if (trx != NULL) {
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
} }
return(0); return(0);
} }
@ -1201,6 +1195,23 @@ innobase_convert_from_id(
strconvert(cs, from, system_charset_info, to, (uint) len, &errors); strconvert(cs, from, system_charset_info, to, (uint) len, &errors);
} }
/**********************************************************************
Converts an identifier from my_charset_filename to UTF-8 charset. */
extern "C"
uint
innobase_convert_to_system_charset(
/*===============================*/
char* to, /* out: converted identifier */
const char* from, /* in: identifier to convert */
ulint len, /* in: length of 'to', in bytes */
uint* errors) /* out: error return */
{
CHARSET_INFO* cs1 = &my_charset_filename;
CHARSET_INFO* cs2 = system_charset_info;
return(strconvert(cs1, from, cs2, to, len, errors));
}
/******************************************************************//** /******************************************************************//**
Compares NUL-terminated UTF-8 strings case insensitively. Compares NUL-terminated UTF-8 strings case insensitively.
@return 0 if a=b, <0 if a<b, >1 if a>b */ @return 0 if a=b, <0 if a<b, >1 if a>b */
@ -1844,7 +1855,8 @@ innobase_query_caching_of_table_permitted(
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
} }
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
@ -2157,7 +2169,8 @@ ha_innobase::init_table_handle_for_HANDLER(void)
/* Initialize the prebuilt struct much like it would be inited in /* Initialize the prebuilt struct much like it would be inited in
external_lock */ external_lock */
innobase_release_stat_resources(prebuilt->trx); trx_search_latch_release_if_reserved(prebuilt->trx);
innodb_srv_conc_force_exit_innodb(prebuilt->trx);
/* If the transaction is not started yet, start it */ /* If the transaction is not started yet, start it */
@ -2593,8 +2606,6 @@ innobase_change_buffering_inited_ok:
mysql_mutex_init(innobase_share_mutex_key, mysql_mutex_init(innobase_share_mutex_key,
&innobase_share_mutex, &innobase_share_mutex,
MY_MUTEX_INIT_FAST); MY_MUTEX_INIT_FAST);
mysql_mutex_init(commit_threads_m_key,
&commit_threads_m, MY_MUTEX_INIT_FAST);
mysql_mutex_init(commit_cond_mutex_key, mysql_mutex_init(commit_cond_mutex_key,
&commit_cond_m, MY_MUTEX_INIT_FAST); &commit_cond_m, MY_MUTEX_INIT_FAST);
mysql_cond_init(commit_cond_key, &commit_cond, NULL); mysql_cond_init(commit_cond_key, &commit_cond, NULL);
@ -2642,7 +2653,6 @@ innobase_end(
srv_free_paths_and_sizes(); srv_free_paths_and_sizes();
my_free(internal_innobase_data_file_path); my_free(internal_innobase_data_file_path);
mysql_mutex_destroy(&innobase_share_mutex); mysql_mutex_destroy(&innobase_share_mutex);
mysql_mutex_destroy(&commit_threads_m);
mysql_mutex_destroy(&commit_cond_m); mysql_mutex_destroy(&commit_cond_m);
mysql_cond_destroy(&commit_cond); mysql_cond_destroy(&commit_cond);
} }
@ -2728,7 +2738,8 @@ innobase_start_trx_and_assign_read_view(
search latch. Since we will reserve the kernel mutex, we have to search latch. Since we will reserve the kernel mutex, we have to
release the search system latch first to obey the latching order. */ release the search system latch first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* If the transaction is not started yet, start it */ /* If the transaction is not started yet, start it */
@ -2961,7 +2972,8 @@ innobase_rollback(
reserve the kernel mutex, we have to release the search system latch reserve the kernel mutex, we have to release the search system latch
first to obey the latching order. */ first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */ trx->n_autoinc_rows = 0; /* Reset the number AUTO-INC rows required */
@ -3001,7 +3013,8 @@ innobase_rollback_trx(
reserve the kernel mutex, we have to release the search system latch reserve the kernel mutex, we have to release the search system latch
first to obey the latching order. */ first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* If we had reserved the auto-inc lock for some table (if /* If we had reserved the auto-inc lock for some table (if
we come here to roll back the latest SQL statement) we we come here to roll back the latest SQL statement) we
@ -3041,7 +3054,8 @@ innobase_rollback_to_savepoint(
reserve the kernel mutex, we have to release the search system latch reserve the kernel mutex, we have to release the search system latch
first to obey the latching order. */ first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* TODO: use provided savepoint data area to store savepoint data */ /* TODO: use provided savepoint data area to store savepoint data */
@ -3116,7 +3130,8 @@ innobase_savepoint(
reserve the kernel mutex, we have to release the search system latch reserve the kernel mutex, we have to release the search system latch
first to obey the latching order. */ first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* Cannot happen outside of transaction */ /* Cannot happen outside of transaction */
DBUG_ASSERT(trx_is_registered_for_2pc(trx)); DBUG_ASSERT(trx_is_registered_for_2pc(trx));
@ -3913,6 +3928,7 @@ ha_innobase::open(
char* is_part = NULL; char* is_part = NULL;
ibool par_case_name_set = FALSE; ibool par_case_name_set = FALSE;
char par_case_name[MAX_FULL_NAME_LEN + 1]; char par_case_name[MAX_FULL_NAME_LEN + 1];
dict_err_ignore_t ignore_err = DICT_ERR_IGNORE_NONE;
DBUG_ENTER("ha_innobase::open"); DBUG_ENTER("ha_innobase::open");
@ -3949,8 +3965,15 @@ ha_innobase::open(
is_part = strstr(norm_name, "#P#"); is_part = strstr(norm_name, "#P#");
#endif /* __WIN__ */ #endif /* __WIN__ */
/* Check whether FOREIGN_KEY_CHECKS is set to 0. If so, the table
can be opened even if some FK indexes are missing. If not, the table
can't be opened in the same situation */
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
ignore_err = DICT_ERR_IGNORE_FK_NOKEY;
}
/* Get pointer to a table object in InnoDB dictionary cache */ /* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE); ib_table = dict_table_get(norm_name, TRUE, ignore_err);
if (NULL == ib_table) { if (NULL == ib_table) {
if (is_part) { if (is_part) {
@ -3994,7 +4017,7 @@ ha_innobase::open(
} }
ib_table = dict_table_get( ib_table = dict_table_get(
par_case_name, FALSE); par_case_name, FALSE, ignore_err);
} }
if (ib_table) { if (ib_table) {
#ifndef __WIN__ #ifndef __WIN__
@ -7387,7 +7410,8 @@ ha_innobase::create(
log_buffer_flush_to_disk(); log_buffer_flush_to_disk();
innobase_table = dict_table_get(norm_name, FALSE); innobase_table = dict_table_get(norm_name, FALSE,
DICT_ERR_IGNORE_NONE);
DBUG_ASSERT(innobase_table != 0); DBUG_ASSERT(innobase_table != 0);
@ -8211,6 +8235,8 @@ ha_innobase::info_low(
prebuilt->trx->op_info = "updating table statistics"; prebuilt->trx->op_info = "updating table statistics";
DEBUG_SYNC_C("info_before_stats_update");
dict_update_statistics( dict_update_statistics(
ib_table, ib_table,
FALSE, /* update even if initialized */ FALSE, /* update even if initialized */
@ -8729,6 +8755,9 @@ ha_innobase::check(
(ulong) n_rows, (ulong) n_rows,
(ulong) n_rows_in_table); (ulong) n_rows_in_table);
is_ok = FALSE; is_ok = FALSE;
row_mysql_lock_data_dictionary(prebuilt->trx);
dict_set_corrupted(index);
row_mysql_unlock_data_dictionary(prebuilt->trx);
} }
} }
@ -9273,7 +9302,8 @@ ha_innobase::start_stmt(
that may not be the case. We MUST release the search latch before an that may not be the case. We MUST release the search latch before an
INSERT, for example. */ INSERT, for example. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* Reset the AUTOINC statement level counter for multi-row INSERTs. */ /* Reset the AUTOINC statement level counter for multi-row INSERTs. */
trx->n_autoinc_rows = 0; trx->n_autoinc_rows = 0;
@ -9468,7 +9498,8 @@ ha_innobase::external_lock(
may reserve the kernel mutex, we have to release the search may reserve the kernel mutex, we have to release the search
system latch first to obey the latching order. */ system latch first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* If the MySQL lock count drops to zero we know that the current SQL /* If the MySQL lock count drops to zero we know that the current SQL
statement has ended */ statement has ended */
@ -9622,7 +9653,8 @@ innodb_show_status(
trx = check_trx_exists(thd); trx = check_trx_exists(thd);
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
/* We let the InnoDB Monitor to output at most MAX_STATUS_SIZE /* We let the InnoDB Monitor to output at most MAX_STATUS_SIZE
bytes of text. */ bytes of text. */
@ -10623,7 +10655,8 @@ innobase_xa_prepare(
reserve the kernel mutex, we have to release the search system latch reserve the kernel mutex, we have to release the search system latch
first to obey the latching order. */ first to obey the latching order. */
innobase_release_stat_resources(trx); trx_search_latch_release_if_reserved(trx);
innodb_srv_conc_force_exit_innodb(trx);
if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) {
@ -12106,7 +12139,6 @@ test_innobase_convert_name()
} }
} }
} }
#endif /* UNIV_COMPILE_TEST_FUNCS */ #endif /* UNIV_COMPILE_TEST_FUNCS */
/********************************************************************** /**********************************************************************
@ -12120,43 +12152,8 @@ innobase_convert_to_filename_charset(
ulint len) /* in: length of 'to', in bytes */ ulint len) /* in: length of 'to', in bytes */
{ {
uint errors; uint errors;
uint rlen;
CHARSET_INFO* cs_to = &my_charset_filename; CHARSET_INFO* cs_to = &my_charset_filename;
CHARSET_INFO* cs_from = system_charset_info; CHARSET_INFO* cs_from = system_charset_info;
rlen = strconvert(cs_from, from, cs_to, to, len, &errors); return(strconvert(cs_from, from, cs_to, to, len, &errors));
if (errors) {
fprintf(stderr, "InnoDB: There was a problem in converting"
"'%s' in charset %s to charset %s", from, cs_from->name,
cs_to->name);
}
return(rlen);
}
/**********************************************************************
Converts an identifier from my_charset_filename to UTF-8 charset. */
extern "C"
uint
innobase_convert_to_system_charset(
/*===============================*/
char* to, /* out: converted identifier */
const char* from, /* in: identifier to convert */
ulint len, /* in: length of 'to', in bytes */
uint* errors) /* out: error return */
{
uint rlen;
CHARSET_INFO* cs1 = &my_charset_filename;
CHARSET_INFO* cs2 = system_charset_info;
rlen = strconvert(cs1, from, cs2, to, len, errors);
if (*errors) {
fprintf(stderr, "InnoDB: There was a problem in converting"
"'%s' in charset %s to charset %s", from, cs1->name,
cs2->name);
}
return(rlen);
} }

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -702,7 +702,8 @@ ha_innobase::add_index(
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
indexed_table = dict_table_get(prebuilt->table->name, FALSE); indexed_table = dict_table_get(prebuilt->table->name, FALSE,
DICT_ERR_IGNORE_NONE);
if (UNIV_UNLIKELY(!indexed_table)) { if (UNIV_UNLIKELY(!indexed_table)) {
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);

View File

@ -1,6 +1,6 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 2007, 2013, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/
@ -24,7 +24,7 @@ Created July 18, 2007 Vasil Dimov
*******************************************************/ *******************************************************/
#include <mysqld_error.h> #include <mysqld_error.h>
#include <sql_acl.h> // PROCESS_ACL #include <sql_acl.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <hash.h> #include <hash.h>
@ -37,14 +37,16 @@ Created July 18, 2007 Vasil Dimov
extern "C" { extern "C" {
#include "btr0types.h" #include "btr0types.h"
#include "buf0buddy.h" /* for i_s_cmpmem */ #include "buf0buddy.h"
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */ #include "buf0buf.h"
#include "ibuf0ibuf.h"
#include "dict0mem.h" #include "dict0mem.h"
#include "dict0types.h" #include "dict0types.h"
#include "ha_prototypes.h" /* for innobase_convert_name() */ #include "dict0boot.h"
#include "srv0start.h" /* for srv_was_started */ #include "ha_prototypes.h"
#include "srv0start.h"
#include "trx0i_s.h" #include "trx0i_s.h"
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */ #include "trx0trx.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "page0zip.h" #include "page0zip.h"
#include "log0log.h" #include "log0log.h"
@ -60,8 +62,12 @@ struct buffer_page_desc_str_struct{
typedef struct buffer_page_desc_str_struct buf_page_desc_str_t; typedef struct buffer_page_desc_str_struct buf_page_desc_str_t;
/** Any states greater than FIL_PAGE_TYPE_LAST would be treated as unknown. */ /** Change buffer B-tree page */
#define I_S_PAGE_TYPE_UNKNOWN (FIL_PAGE_TYPE_LAST + 1) #define I_S_PAGE_TYPE_IBUF (FIL_PAGE_TYPE_LAST + 1)
/** Any states greater than I_S_PAGE_TYPE_IBUF would be treated as
unknown. */
#define I_S_PAGE_TYPE_UNKNOWN (I_S_PAGE_TYPE_IBUF + 1)
/** We also define I_S_PAGE_TYPE_INDEX as the Index Page's position /** We also define I_S_PAGE_TYPE_INDEX as the Index Page's position
in i_s_page_type[] array */ in i_s_page_type[] array */
@ -82,6 +88,7 @@ static buf_page_desc_str_t i_s_page_type[] = {
{"BLOB", FIL_PAGE_TYPE_BLOB}, {"BLOB", FIL_PAGE_TYPE_BLOB},
{"COMPRESSED_BLOB", FIL_PAGE_TYPE_ZBLOB}, {"COMPRESSED_BLOB", FIL_PAGE_TYPE_ZBLOB},
{"COMPRESSED_BLOB2", FIL_PAGE_TYPE_ZBLOB2}, {"COMPRESSED_BLOB2", FIL_PAGE_TYPE_ZBLOB2},
{"IBUF_INDEX", I_S_PAGE_TYPE_IBUF},
{"UNKNOWN", I_S_PAGE_TYPE_UNKNOWN} {"UNKNOWN", I_S_PAGE_TYPE_UNKNOWN}
}; };
@ -2788,14 +2795,21 @@ i_s_innodb_set_page_type(
if (page_type == FIL_PAGE_INDEX) { if (page_type == FIL_PAGE_INDEX) {
const page_t* page = (const page_t*) frame; const page_t* page = (const page_t*) frame;
page_info->index_id = btr_page_get_index_id(page);
/* FIL_PAGE_INDEX is a bit special, its value /* FIL_PAGE_INDEX is a bit special, its value
is defined as 17855, so we cannot use FIL_PAGE_INDEX is defined as 17855, so we cannot use FIL_PAGE_INDEX
to index into i_s_page_type[] array, its array index to index into i_s_page_type[] array, its array index
in the i_s_page_type[] array is I_S_PAGE_TYPE_INDEX in the i_s_page_type[] array is I_S_PAGE_TYPE_INDEX
(1) */ (1) for index pages or I_S_PAGE_TYPE_IBUF for
change buffer index pages */
if (page_info->index_id
== static_cast<index_id_t>(DICT_IBUF_ID_MIN
+ IBUF_SPACE_ID)) {
page_info->page_type = I_S_PAGE_TYPE_IBUF;
} else {
page_info->page_type = I_S_PAGE_TYPE_INDEX; page_info->page_type = I_S_PAGE_TYPE_INDEX;
}
page_info->index_id = btr_page_get_index_id(page);
page_info->data_size = (ulint)(page_header_get_field( page_info->data_size = (ulint)(page_header_get_field(
page, PAGE_HEAP_TOP) - (page_is_comp(page) page, PAGE_HEAP_TOP) - (page_is_comp(page)
@ -2804,7 +2818,7 @@ i_s_innodb_set_page_type(
- page_header_get_field(page, PAGE_GARBAGE)); - page_header_get_field(page, PAGE_GARBAGE));
page_info->num_recs = page_get_n_recs(page); page_info->num_recs = page_get_n_recs(page);
} else if (page_type >= I_S_PAGE_TYPE_UNKNOWN) { } else if (page_type > FIL_PAGE_TYPE_LAST) {
/* Encountered an unknown page type */ /* Encountered an unknown page type */
page_info->page_type = I_S_PAGE_TYPE_UNKNOWN; page_info->page_type = I_S_PAGE_TYPE_UNKNOWN;
} else { } else {
@ -2876,6 +2890,16 @@ i_s_innodb_buffer_page_get_info(
page_info->freed_page_clock = bpage->freed_page_clock; page_info->freed_page_clock = bpage->freed_page_clock;
switch (buf_page_get_io_fix(bpage)) {
case BUF_IO_NONE:
case BUF_IO_WRITE:
case BUF_IO_PIN:
break;
case BUF_IO_READ:
page_info->page_type = I_S_PAGE_TYPE_UNKNOWN;
return;
}
if (page_info->page_state == BUF_BLOCK_FILE_PAGE) { if (page_info->page_state == BUF_BLOCK_FILE_PAGE) {
const buf_block_t*block; const buf_block_t*block;

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -56,6 +56,7 @@ Created 7/19/1997 Heikki Tuuri
#include "log0recv.h" #include "log0recv.h"
#include "que0que.h" #include "que0que.h"
#include "srv0start.h" /* srv_shutdown_state */ #include "srv0start.h" /* srv_shutdown_state */
#include "rem0cmp.h"
/* STRUCTURE OF AN INSERT BUFFER RECORD /* STRUCTURE OF AN INSERT BUFFER RECORD
@ -3824,11 +3825,13 @@ skip_watch:
/********************************************************************//** /********************************************************************//**
During merge, inserts to an index page a secondary index entry extracted During merge, inserts to an index page a secondary index entry extracted
from the insert buffer. */ from the insert buffer.
@return newly inserted record */
static static
void rec_t*
ibuf_insert_to_index_page_low( ibuf_insert_to_index_page_low(
/*==========================*/ /*==========================*/
/* out: newly inserted record */
const dtuple_t* entry, /*!< in: buffered entry to insert */ const dtuple_t* entry, /*!< in: buffered entry to insert */
buf_block_t* block, /*!< in/out: index page where the buffered buf_block_t* block, /*!< in/out: index page where the buffered
entry should be placed */ entry should be placed */
@ -3843,10 +3846,12 @@ ibuf_insert_to_index_page_low(
ulint zip_size; ulint zip_size;
const page_t* bitmap_page; const page_t* bitmap_page;
ulint old_bits; ulint old_bits;
rec_t* rec;
DBUG_ENTER("ibuf_insert_to_index_page_low");
if (UNIV_LIKELY rec = page_cur_tuple_insert(page_cur, entry, index, 0, mtr);
(page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) { if (rec != NULL) {
return; DBUG_RETURN(rec);
} }
/* If the record did not fit, reorganize */ /* If the record did not fit, reorganize */
@ -3856,9 +3861,9 @@ ibuf_insert_to_index_page_low(
/* This time the record must fit */ /* This time the record must fit */
if (UNIV_LIKELY rec = page_cur_tuple_insert(page_cur, entry, index, 0, mtr);
(page_cur_tuple_insert(page_cur, entry, index, 0, mtr) != NULL)) { if (rec != NULL) {
return; DBUG_RETURN(rec);
} }
page = buf_block_get_frame(block); page = buf_block_get_frame(block);
@ -3892,6 +3897,7 @@ ibuf_insert_to_index_page_low(
fputs("InnoDB: Submit a detailed bug report" fputs("InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr); " to http://bugs.mysql.com\n", stderr);
ut_ad(0); ut_ad(0);
DBUG_RETURN(NULL);
} }
/************************************************************************ /************************************************************************
@ -3911,6 +3917,7 @@ ibuf_insert_to_index_page(
ulint low_match; ulint low_match;
page_t* page = buf_block_get_frame(block); page_t* page = buf_block_get_frame(block);
rec_t* rec; rec_t* rec;
DBUG_ENTER("ibuf_insert_to_index_page");
ut_ad(ibuf_inside(mtr)); ut_ad(ibuf_inside(mtr));
ut_ad(dtuple_check_typed(entry)); ut_ad(dtuple_check_typed(entry));
@ -3955,7 +3962,7 @@ dump:
"InnoDB: Submit a detailed bug report to" "InnoDB: Submit a detailed bug report to"
" http://bugs.mysql.com!\n", stderr); " http://bugs.mysql.com!\n", stderr);
return; DBUG_VOID_RETURN;
} }
low_match = page_cur_search(block, index, entry, low_match = page_cur_search(block, index, entry,
@ -3990,7 +3997,7 @@ dump:
rec, page_zip, FALSE, mtr); rec, page_zip, FALSE, mtr);
updated_in_place: updated_in_place:
mem_heap_free(heap); mem_heap_free(heap);
return; DBUG_VOID_RETURN;
} }
/* Copy the info bits. Clear the delete-mark. */ /* Copy the info bits. Clear the delete-mark. */
@ -4034,15 +4041,21 @@ updated_in_place:
lock_rec_store_on_page_infimum(block, rec); lock_rec_store_on_page_infimum(block, rec);
page_cur_delete_rec(&page_cur, index, offsets, mtr); page_cur_delete_rec(&page_cur, index, offsets, mtr);
page_cur_move_to_prev(&page_cur); page_cur_move_to_prev(&page_cur);
rec = ibuf_insert_to_index_page_low(entry, block, index, mtr,
&page_cur);
ut_ad(!cmp_dtuple_rec(entry, rec,
rec_get_offsets(rec, index, NULL,
ULINT_UNDEFINED,
&heap)));
mem_heap_free(heap); mem_heap_free(heap);
ibuf_insert_to_index_page_low(entry, block, index, mtr,
&page_cur);
lock_rec_restore_from_page_infimum(block, rec, block); lock_rec_restore_from_page_infimum(block, rec, block);
} else { } else {
ibuf_insert_to_index_page_low(entry, block, index, mtr, ibuf_insert_to_index_page_low(entry, block, index, mtr,
&page_cur); &page_cur);
} }
DBUG_VOID_RETURN;
} }
/****************************************************************//** /****************************************************************//**

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

View File

@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc.,
Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/

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