Manual merge from mysql-5.5.

This commit is contained in:
Ramil Kalimullin 2011-08-09 12:03:29 +04:00
commit dab1c8c4d0
76 changed files with 1406 additions and 308 deletions

View File

@ -1177,7 +1177,7 @@ int main(int argc,char *argv[])
mysql_thread_id(&mysql), server_version_string(&mysql));
put_info((char*) glob_buffer.ptr(),INFO_INFO);
put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"), INFO_INFO);
put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"), INFO_INFO);
#ifdef HAVE_READLINE
initialize_readline((char*) my_progname);
@ -1595,7 +1595,7 @@ static void usage(int version)
if (version)
return;
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
printf("Usage: %s [OPTIONS] [database]\n", my_progname);
my_print_help(my_long_options);
print_defaults("my", load_default_groups);

View File

@ -243,6 +243,7 @@ get_one_option(int optid, const struct my_option *opt,
switch (optid) {
case '?':
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
printf("%s Ver %s Distrib %s, for %s (%s)\n",
my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));

View File

@ -688,7 +688,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_VER:
new_line=1;
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
printf("Server version\t\t%s\n", mysql_get_server_info(mysql));
printf("Protocol version\t%d\n", mysql_get_proto_info(mysql));
printf("Connection\t\t%s\n",mysql_get_host_info(mysql));
@ -1086,7 +1086,7 @@ static void print_version(void)
static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
puts("Administration program for the mysqld daemon.");
printf("Usage: %s [OPTIONS] command command....\n", my_progname);
my_print_help(my_long_options);

View File

@ -1261,7 +1261,7 @@ static void print_version()
static void usage()
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2001, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
printf("\
Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
the mysql command line client.\n\n");

View File

@ -224,7 +224,7 @@ static void print_version(void)
static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
puts("used at the same time. Not all options are supported by all storage engines.");

View File

@ -55,6 +55,8 @@
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
/* Exit codes */
#define EX_USAGE 1
@ -596,7 +598,7 @@ static void short_usage_sub(void)
static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
puts("Dumping structure and contents of MySQL databases and tables.");
short_usage_sub();
print_defaults("my",load_default_groups);

View File

@ -18,14 +18,8 @@
/*
** mysqlimport.c - Imports all given files
** into a table(s).
**
** *************************
** * *
** * AUTHOR: Monty & Jani *
** * DATE: June 24, 1997 *
** * *
** *************************
*/
#define IMPORT_VERSION "3.7"
#include "client_priv.h"
@ -44,6 +38,8 @@ pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold;
#endif
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
static void db_error_with_table(MYSQL *mysql, char *table);
static void db_error(MYSQL *mysql);
static char *field_escape(char *to,const char *from,uint length);
@ -203,7 +199,7 @@ static void print_version(void)
static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
printf("\
Loads tables from text files in various formats. The base name of the\n\
text file must be the name of the table that should be used.\n\

View File

@ -264,7 +264,7 @@ static void print_version(void)
static void usage(void)
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010)"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011)"));
puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
puts("\n\

View File

@ -22,13 +22,6 @@
http://dev.mysql.com/doc/mysqltest/en/index.html
Please keep the test framework tools identical in all versions!
Written by:
Sasha Pachev <sasha@mysql.com>
Matt Wagner <matt@mysql.com>
Monty
Jani
Holyfoot
*/
#define MTEST_VERSION "3.3"
@ -6438,7 +6431,7 @@ void print_version(void)
void usage()
{
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
printf("Runs a test against the mysql server and compares output with a results file.\n\n");
printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
my_print_help(my_long_options);

View File

@ -1873,7 +1873,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
const char *name,const char *end,int append)
{
REGISTER FILE *fp;
REGISTER BOOLEAN newfile;
if (name != NULL)
{
@ -1902,7 +1901,6 @@ static void DBUGOpenFile(CODE_STATE *cs,
}
else
{
newfile= !EXISTS(name);
if (!(fp= fopen(name, append ? "a+" : "w")))
{
(void) fprintf(stderr, ERR_OPEN, cs->process, name);

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -11,7 +11,7 @@
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 Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_

View File

@ -23,9 +23,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -UMYSQL_CLIENT)
# We never use "mysql_embedded", is more of a linktest, so we don't
# use MYSQL_ADD_EXECUTABLE as that would install it and package it
ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
../../client/mysql.cc ../../client/readline.cc)
TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver)
IF(UNIX)

View File

@ -1144,8 +1144,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
const char *sqlstate)
{
uint error;
uchar converted_err[MYSQL_ERRMSG_SIZE];
uint32 converted_err_len;
char converted_err[MYSQL_ERRMSG_SIZE];
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
@ -1160,12 +1159,12 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
ei= data->embedded_info;
ei->last_errno= sql_errno;
converted_err_len= convert_error_message((char*)converted_err,
sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
strmake(ei->info, (const char*) converted_err, sizeof(ei->info)-1);
convert_error_message(converted_err, sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
/* Converted error message is always null-terminated. */
strmake(ei->info, converted_err, sizeof(ei->info)-1);
strmov(ei->sqlstate, sqlstate);
ei->server_status= thd->server_status;
thd->cur_data= 0;

View File

@ -8,16 +8,15 @@ funcs_1.charset_collation_1 # depends on compile-time decisions
main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2
main.lock_multi_bug38499 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
main.outfile_loaddata @solaris # Bug#11755168 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
main.signal_demo3 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.signal_demo3 @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.sp @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris
rpl.rpl_innodb_bug28430 # Bug#11754425
rpl.rpl_bug37426 # WL#5867: skozlov: test case moved from unused bugs suite
rpl.rpl_heartbeat_basic # BUG#12403008 2011-04-27 sven fails sporadically
rpl.rpl_show_slave_hosts # BUG#12416700 2011-05-02 sven fails sporadically
rpl.rpl_innodb_bug28430 # Bug#11754425
rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several test cases fail on Solaris with error Thread stack overrun
sys_vars.max_sp_recursion_depth_func @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails
# BUG #59055 : All ndb tests should be removed from the repository

View File

@ -77,5 +77,31 @@ reset slave;
source include/check_slave_no_error.inc;
change master to master_user='root';
--let $rpl_only_running_threads= 1
#
# BUG#11809016 - NO WAY TO DISCOVER AN INSTANCE IS NO LONGER A SLAVE FOLLOWING MYSQL BUG#28796
#
reset slave;
--source include/start_slave.inc
--source include/stop_slave.inc
--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
reset slave all;
--error ER_BAD_SLAVE
start slave;
--let $_show_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
if ($_show_master_host != No such row)
{
die;
}
--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT
--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port
--source include/start_slave.inc
--source include/rpl_end.inc

View File

@ -111,6 +111,9 @@ sub collect_test_cases ($$$$) {
my $opt_skip_test_list= shift;
my $cases= []; # Array of hash(one hash for each testcase)
# Unit tests off by default also if using --do-test or --start-from
$::opt_ctest= 0 if $::opt_ctest == -1 && ($do_test || $start_from);
$do_test_reg= init_pattern($do_test, "--do-test");
$skip_test_reg= init_pattern($skip_test, "--skip-test");

View File

@ -197,7 +197,7 @@ our $opt_debug_server;
our @opt_cases; # The test cases names in argv
our $opt_embedded_server;
# -1 indicates use default, override with env.var.
my $opt_ctest= env_or_val(MTR_UNIT_TESTS => -1);
our $opt_ctest= env_or_val(MTR_UNIT_TESTS => -1);
# Unit test report stored here for delayed printing
my $ctest_report;

View File

@ -699,3 +699,32 @@ select (1.175494351E-37 div 1.7976931348623157E+308);
0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ''
#
# Bug#12537160 ASSERTION FAILED:
# STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
#
select 999999999999999999999999999999999999999999999999999999999999999999999999999999999 % 0.1 as foo;
foo
0.0
select 999999999999999999999999999999999999999999999999999999999999999999999999999999999 % 0.0 as foo;
foo
NULL
#
# Bug#12711164 - 61676:
# RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
#
select 5 div 2;
5 div 2
2
select 5.0 div 2.0;
5.0 div 2.0
2
select 5.0 div 2;
5.0 div 2
2
select 5 div 2.0;
5 div 2.0
2
select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
5.9 div 2 1.23456789e3 DIV 2 1.23456789e9 DIV 2 1.23456789e19 DIV 2
2 617 617283945 6172839450000000000

View File

@ -1398,6 +1398,12 @@ NULL
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
NULL
#
# Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
#
DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
Warnings:
Warning 1292 Incorrect datetime value: '0'
End of 5.1 tests
#
# Bug#57039: constant subtime expression returns incorrect result.

View File

@ -904,7 +904,8 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t1' doesn't exist
test.tm1 check Error Table 'test.t1' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t1(a INT);
@ -912,7 +913,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t2' doesn't exist
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t2(a BLOB);
@ -920,7 +921,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Warning Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
ALTER TABLE t2 MODIFY a INT;
@ -3634,7 +3635,7 @@ test.t1 analyze Error Unable to open underlying table which is differently defin
test.t1 analyze error Corrupt
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Table 'test.t_not_exists' doesn't exist
test.t1 check Error Table 'test.t_not_exists' is differently defined or of non-MyISAM type or doesn't exist
test.t1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.t1 check error Corrupt
CHECKSUM TABLE t1;
@ -3650,7 +3651,7 @@ test.t1 optimize Error Unable to open underlying table which is differently defi
test.t1 optimize error Corrupt
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair Error Table 'test.t_not_exists' doesn't exist
test.t1 repair Error Table 'test.t_not_exists' is differently defined or of non-MyISAM type or doesn't exist
test.t1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.t1 repair error Corrupt
REPAIR TABLE t1 USE_FRM;
@ -3676,4 +3677,37 @@ ALTER TABLE t1 engine=myisam;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES;
DROP TABLE m1, t1;
End of 6.0 tests
#
# Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
# PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
#
drop tables if exists t1, t2, t3, t4, m1;
create table t1(id int) engine=myisam;
create view t3 as select 1 as id;
create table t4(id int) engine=memory;
create table m1(id int) engine=merge union=(t1,t2,t3,t4);
select * from m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
# The below CHECK and REPAIR TABLE statements should
# report all problems with underlying tables:
# - absence of 't2',
# - missing base table for 't3',
# - wrong engine of 't4'.
check table m1;
Table Op Msg_type Msg_text
test.m1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.m1 check Error Table 'test.t3' is differently defined or of non-MyISAM type or doesn't exist
test.m1 check Error Table 'test.t4' is differently defined or of non-MyISAM type or doesn't exist
test.m1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.m1 check error Corrupt
repair table m1;
Table Op Msg_type Msg_text
test.m1 repair Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair Error Table 'test.t3' is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair Error Table 'test.t4' is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair error Corrupt
# Clean-up.
drop tables m1, t1, t4;
drop view t3;
End of 5.5 tests

View File

@ -7163,7 +7163,7 @@ DROP PROCEDURE p2;
DROP PROCEDURE p5;
#
# Bug#11840395 (formerly known as bug#60347):
# The string "versiondata" seems to be 'leaking' into the schema name space
# The string "versiondata" seems
# to be 'leaking' into the schema name space
#
DROP DATABASE IF EXISTS mixedCaseDbName;
@ -7176,6 +7176,25 @@ select mixedCaseDbName.tryMyFunc();
mixedCaseDbName.tryMyFunc()
IT WORKS
DROP DATABASE mixedCaseDbName;
#
# Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
#
CREATE TABLE t1 (a INT, b INT, KEY(b));
CREATE TABLE t2 (c INT, d INT, KEY(c));
INSERT INTO t1 VALUES (1,1),(1,1),(1,2);
INSERT INTO t2 VALUES (1,1),(1,2);
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
BEGIN
DECLARE a int;
-- SQL statement inside
SELECT 1 INTO a;
RETURN a;
END $
SELECT COUNT(DISTINCT d) FROM t1, t2 WHERE a = c AND b = f1();
COUNT(DISTINCT d)
2
DROP FUNCTION f1;
DROP TABLE t1, t2;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------

View File

@ -973,6 +973,7 @@ v16 VARCHAR(500), v17 VARCHAR(500), v18 VARCHAR(500)
CREATE INDEX idx1 ON t1(a,v1);
INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
UPDATE t1 SET a=1000;
DELETE FROM t1;
DROP TABLE t1;
set global innodb_file_per_table=0;
set global innodb_file_format=Antelope;

View File

@ -63,42 +63,42 @@ row_format=compressed;
create table t14(a int primary key) engine=innodb key_block_size=9;
Warnings:
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t0 Compact
test t00 Compact
test t1 Compact
test t10 Dynamic
test t11 Compressed
test t12 Compressed
test t13 Compressed
test t14 Compact
test t2 Redundant
test t3 Compact
test t4 Compact
test t5 Redundant
test t6 Redundant
test t7 Redundant
test t8 Compact
test t9 Compact
table_schema table_name row_format data_length index_length
test t0 Compact 16384 0
test t00 Compact 16384 0
test t1 Compact 16384 0
test t10 Dynamic 16384 0
test t11 Compressed 1024 0
test t12 Compressed 1024 0
test t13 Compressed 8192 0
test t14 Compact 16384 0
test t2 Redundant 16384 0
test t3 Compact 16384 0
test t4 Compact 16384 0
test t5 Redundant 16384 0
test t6 Redundant 16384 0
test t7 Redundant 16384 0
test t8 Compact 16384 0
test t9 Compact 16384 0
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
alter table t1 key_block_size=0;
alter table t1 row_format=dynamic;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Dynamic
table_schema table_name row_format data_length index_length
test t1 Dynamic 16384 0
alter table t1 row_format=compact;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Compact
table_schema table_name row_format data_length index_length
test t1 Compact 16384 0
alter table t1 row_format=redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Redundant
table_schema table_name row_format data_length index_length
test t1 Redundant 16384 0
drop table t1;
create table t1(a int not null, b text, index(b(10))) engine=innodb
key_block_size=1;
@ -115,11 +115,11 @@ rollback;
select a,left(b,40) from t1 natural join t2;
a left(b,40)
1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Compressed
test t2 Compact
table_schema table_name row_format data_length index_length
test t1 Compressed 2048 1024
test t2 Compact 16384 0
drop table t1,t2;
SET SESSION innodb_strict_mode = off;
CREATE TABLE t1(
@ -207,19 +207,19 @@ create table t8 (id int primary key) engine = innodb row_format = compressed;
create table t9 (id int primary key) engine = innodb row_format = dynamic;
create table t10(id int primary key) engine = innodb row_format = compact;
create table t11(id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Compact
test t10 Compact
test t11 Redundant
test t3 Compressed
test t4 Compressed
test t5 Compressed
test t6 Compressed
test t7 Compressed
test t8 Compressed
test t9 Dynamic
table_schema table_name row_format data_length index_length
test t1 Compact 16384 0
test t10 Compact 16384 0
test t11 Redundant 16384 0
test t3 Compressed 1024 0
test t4 Compressed 2048 0
test t5 Compressed 4096 0
test t6 Compressed 8192 0
test t7 Compressed 16384 0
test t8 Compressed 8192 0
test t9 Dynamic 16384 0
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
create table t1 (id int primary key) engine = innodb
key_block_size = 8 row_format = compressed;
@ -246,11 +246,11 @@ Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t4' (errno: 1478)
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t1 Compressed
test t5 Compressed
table_schema table_name row_format data_length index_length
test t1 Compressed 8192 0
test t5 Compressed 8192 0
drop table t1, t5;
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
@ -276,9 +276,9 @@ Level Code Message
Warning 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
Error 1005 Can't create table 'test.t2' (errno: 1478)
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
table_schema table_name row_format data_length index_length
set global innodb_file_per_table = off;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
ERROR HY000: Can't create table 'test.t1' (errno: 1478)
@ -324,11 +324,11 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t8 Compact
test t9 Redundant
table_schema table_name row_format data_length index_length
test t8 Compact 16384 0
test t9 Redundant 16384 0
drop table t8, t9;
set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
@ -376,11 +376,11 @@ Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Error 1005 Can't create table 'test.t7' (errno: 1478)
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format
test t8 Compact
test t9 Redundant
table_schema table_name row_format data_length index_length
test t8 Compact 16384 0
test t9 Redundant 16384 0
drop table t8, t9;
set global innodb_file_per_table=0;
set global innodb_file_format=Antelope;

View File

@ -472,6 +472,9 @@ CREATE TABLE t1(a INT,
CREATE INDEX idx1 ON t1(a,v1);
INSERT INTO t1 VALUES(9,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r,@r);
UPDATE t1 SET a=1000;
DELETE FROM t1;
# Let the purge thread clean up this file.
-- sleep 10
DROP TABLE t1;
eval set global innodb_file_per_table=$per_table;

View File

@ -39,19 +39,19 @@ create table t13(a int primary key) engine=innodb
row_format=compressed;
create table t14(a int primary key) engine=innodb key_block_size=9;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
alter table t1 key_block_size=0;
alter table t1 row_format=dynamic;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
alter table t1 row_format=compact;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
alter table t1 row_format=redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1;
@ -84,7 +84,7 @@ connection default;
disconnect a;
disconnect b;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1,t2;
@ -195,7 +195,7 @@ create table t9 (id int primary key) engine = innodb row_format = dynamic;
create table t10(id int primary key) engine = innodb row_format = compact;
create table t11(id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1, t3, t4, t5, t6, t7, t8, t9, t10, t11;
@ -221,7 +221,7 @@ show warnings;
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t1, t5;
@ -241,7 +241,7 @@ create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
show warnings;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
#test valid values with innodb_file_per_table unset
@ -271,7 +271,7 @@ show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t8, t9;
@ -303,7 +303,7 @@ show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
drop table t8, t9;

View File

@ -0,0 +1,49 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1_11753004 (c1 INT);
CREATE TABLE t2_11753004 (c1 INT);
INSERT INTO t1_11753004 VALUES (1);
INSERT INTO t2_11753004 VALUES (2);
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
include/stop_slave.inc
SET @save_debug= @@global.debug;
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc
UPDATE t1_11753004, t2_11753004 SET t1_11753004.c1=3, t2_11753004.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004.c1=2;
include/wait_for_slave_sql_error.inc [errno=1593 ]
include/stop_slave.inc
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc
include/rpl_reset.inc
DROP TABLE t1_11753004, t2_11753004;
include/stop_slave.inc
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
include/start_slave.inc
include/rpl_reset.inc
CREATE TABLE t1_11753004 (c1 INT);
CREATE TABLE t2_11753004_ign (c1 INT);
INSERT INTO t1_11753004 VALUES (1);
INSERT INTO t2_11753004_ign VALUES (2);
UPDATE t1_11753004, t2_11753004_ign SET t1_11753004.c1=3, t2_11753004_ign.c1=4 WHERE t1_11753004.c1=1 OR t2_11753004_ign.c1=2;
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
BINLOG '
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
'/*!*/;
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
BINLOG '
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
'/*!*/;
ERROR HY000: Fatal error: Found table map event mapping table id 0 which was already mapped but with different settings.
DROP TABLE t1,t2;
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
DROP TABLE t1_11753004;
DROP TABLE t2_11753004_ign;
SET GLOBAL debug= @save_debug;
include/rpl_end.inc

View File

@ -41,4 +41,12 @@ include/stop_slave_sql.inc
reset slave;
include/check_slave_no_error.inc
change master to master_user='root';
reset slave;
include/start_slave.inc
include/stop_slave.inc
reset slave all;
start slave;
ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
include/start_slave.inc
include/rpl_end.inc

View File

@ -41,4 +41,12 @@ include/stop_slave_sql.inc
reset slave;
include/check_slave_no_error.inc
change master to master_user='root';
reset slave;
include/start_slave.inc
include/stop_slave.inc
reset slave all;
start slave;
ERROR HY000: The server is not configured as slave; fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
include/start_slave.inc
include/rpl_end.inc

View File

@ -0,0 +1 @@
--replicate-ignore-table=test.t2_11753004_ign

View File

@ -0,0 +1,115 @@
#
--source include/master-slave.inc
--source include/have_debug.inc
--source include/have_binlog_format_row.inc
# BUG#11753004: 44360: REPLICATION FAILED
## assert that we get an error when checking the
## identifiers at the slave (instead of a crash or
## different table being updated)
--let $t1= t1_11753004
--let $t2= t2_11753004
--let $t2_ign= t2_11753004_ign
## test #1: assert that we get an error raised when multiple
## tables in the same RBR statement are mapped with the
## same identifier
--eval CREATE TABLE $t1 (c1 INT)
--eval CREATE TABLE $t2 (c1 INT)
--eval INSERT INTO $t1 VALUES (1)
--eval INSERT INTO $t2 VALUES (2)
--sync_slave_with_master
call mtr.add_suppression(".*Found table map event mapping table id 0 which was already mapped but with different settings.*");
# stop the slave and inject corruption
--source include/stop_slave.inc
SET @save_debug= @@global.debug;
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc
--connection master
# both tables get mapped to 0 (in a way, simulating scenario
# originated by BUG#56226)
--eval UPDATE $t1, $t2 SET $t1.c1=3, $t2.c1=4 WHERE $t1.c1=1 OR $t2.c1=2
--connection slave
# wait for error 1593 (ER_SLAVE_FATAL_ERROR)
--let $slave_sql_errno=1593
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave.inc
# clean up
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc
--connection master
--source include/rpl_reset.inc
--eval DROP TABLE $t1, $t2
--sync_slave_with_master
## test #2: assert that ignored tables that may have been mapped
## with the same identifier are skipped, thus no error
## is raised.
--connection slave
--source include/stop_slave.inc
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
--source include/start_slave.inc
--source include/rpl_reset.inc
--connection master
--eval CREATE TABLE $t1 (c1 INT)
--eval CREATE TABLE $t2_ign (c1 INT)
--eval INSERT INTO $t1 VALUES (1)
--eval INSERT INTO $t2_ign VALUES (2)
--eval UPDATE $t1, $t2_ign SET $t1.c1=3, $t2_ign.c1=4 WHERE $t1.c1=1 OR $t2_ign.c1=2
# must not raise error as second table is filtered
--sync_slave_with_master
## test #3: check that BINLOG statements will also raise an
## error if containing table map events mapping different
## tables to same table identifier.
CREATE TABLE t1 (c1 INT);
CREATE TABLE t2 (c1 INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
# FD event
BINLOG '
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=
'/*!*/;
#110708 12:21:44 server id 1 end_log_pos 774 Table_map: `test`.`t1` mapped to number 66
# at 774
#110708 12:21:44 server id 1 end_log_pos 815 Table_map: `test`.`t2` mapped to number 67
# at 815
#110708 12:21:44 server id 1 end_log_pos 855 Update_rows: table id 66
# at 855
#110708 12:21:44 server id 1 end_log_pos 895 Update_rows: table id 67 flags: STMT_END_F
SET GLOBAL debug="+d,inject_tblmap_same_id_maps_diff_table";
--error ER_SLAVE_FATAL_ERROR
BINLOG '
SOgWThMBAAAAKQAAAAYDAAAAAEIAAAAAAAEABHRlc3QAAnQxAAEDAAE=
SOgWThMBAAAAKQAAAC8DAAAAAEMAAAAAAAEABHRlc3QAAnQyAAEDAAE=
SOgWThgBAAAAKAAAAFcDAAAAAEIAAAAAAAAAAf///gEAAAD+AwAAAA==
SOgWThgBAAAAKAAAAH8DAAAAAEMAAAAAAAEAAf///gEAAAD+BAAAAA==
'/*!*/;
# clean up
DROP TABLE t1,t2;
--connection slave
SET GLOBAL debug="-d,inject_tblmap_same_id_maps_diff_table";
--connection master
--eval DROP TABLE $t1
--eval DROP TABLE $t2_ign
--sync_slave_with_master
SET GLOBAL debug= @save_debug;
--source include/rpl_end.inc

View File

@ -0,0 +1,92 @@
SET @start_global_value = @@global.innodb_random_read_ahead;
SELECT @start_global_value;
@start_global_value
0
Valid values are 'ON' and 'OFF'
select @@global.innodb_random_read_ahead in (0, 1);
@@global.innodb_random_read_ahead in (0, 1)
1
select @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
0
select @@session.innodb_random_read_ahead;
ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable
show global variables like 'innodb_random_read_ahead';
Variable_name Value
innodb_random_read_ahead OFF
show session variables like 'innodb_random_read_ahead';
Variable_name Value
innodb_random_read_ahead OFF
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD OFF
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD OFF
set global innodb_random_read_ahead='ON';
select @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
1
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD ON
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD ON
set @@global.innodb_random_read_ahead=0;
select @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
0
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD OFF
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD OFF
set global innodb_random_read_ahead=1;
select @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
1
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD ON
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD ON
set @@global.innodb_random_read_ahead='OFF';
select @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
0
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD OFF
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD OFF
set session innodb_random_read_ahead='OFF';
ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_random_read_ahead='ON';
ERROR HY000: Variable 'innodb_random_read_ahead' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_random_read_ahead=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_random_read_ahead'
set global innodb_random_read_ahead=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_random_read_ahead'
set global innodb_random_read_ahead=2;
ERROR 42000: Variable 'innodb_random_read_ahead' can't be set to the value of '2'
NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643)
set global innodb_random_read_ahead=-3;
select @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
1
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD ON
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
VARIABLE_NAME VARIABLE_VALUE
INNODB_RANDOM_READ_AHEAD ON
set global innodb_random_read_ahead='AUTO';
ERROR 42000: Variable 'innodb_random_read_ahead' can't be set to the value of 'AUTO'
SET @@global.innodb_random_read_ahead = @start_global_value;
SELECT @@global.innodb_random_read_ahead;
@@global.innodb_random_read_ahead
0

View File

@ -0,0 +1,70 @@
# 2010-01-25 - Added
#
--source include/have_innodb.inc
SET @start_global_value = @@global.innodb_random_read_ahead;
SELECT @start_global_value;
#
# exists as global only
#
--echo Valid values are 'ON' and 'OFF'
select @@global.innodb_random_read_ahead in (0, 1);
select @@global.innodb_random_read_ahead;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_random_read_ahead;
show global variables like 'innodb_random_read_ahead';
show session variables like 'innodb_random_read_ahead';
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
#
# show that it's writable
#
set global innodb_random_read_ahead='ON';
select @@global.innodb_random_read_ahead;
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
set @@global.innodb_random_read_ahead=0;
select @@global.innodb_random_read_ahead;
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
set global innodb_random_read_ahead=1;
select @@global.innodb_random_read_ahead;
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
set @@global.innodb_random_read_ahead='OFF';
select @@global.innodb_random_read_ahead;
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
--error ER_GLOBAL_VARIABLE
set session innodb_random_read_ahead='OFF';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_random_read_ahead='ON';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_random_read_ahead=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_random_read_ahead=1e1;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_random_read_ahead=2;
--echo NOTE: The following should fail with ER_WRONG_VALUE_FOR_VAR (BUG#50643)
set global innodb_random_read_ahead=-3;
select @@global.innodb_random_read_ahead;
select * from information_schema.global_variables where variable_name='innodb_random_read_ahead';
select * from information_schema.session_variables where variable_name='innodb_random_read_ahead';
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_random_read_ahead='AUTO';
#
# Cleanup
#
SET @@global.innodb_random_read_ahead = @start_global_value;
SELECT @@global.innodb_random_read_ahead;

View File

@ -16,3 +16,4 @@ alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested
create-big : Bug#11748731 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836

View File

@ -536,3 +536,25 @@ SELECT 1 div null;
--echo # Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
--echo #
select (1.175494351E-37 div 1.7976931348623157E+308);
--echo #
--echo # Bug#12537160 ASSERTION FAILED:
--echo # STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
--echo #
let $nine_81=
999999999999999999999999999999999999999999999999999999999999999999999999999999999;
eval select $nine_81 % 0.1 as foo;
eval select $nine_81 % 0.0 as foo;
--echo #
--echo # Bug#12711164 - 61676:
--echo # RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
--echo #
select 5 div 2;
select 5.0 div 2.0;
select 5.0 div 2;
select 5 div 2.0;
select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;

View File

@ -909,6 +909,12 @@ SELECT DATE_FORMAT('0000-00-11', '%w');
SELECT MAKEDATE(11111111,1);
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
--echo #
--echo # Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
--echo #
DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
--echo End of 5.1 tests
--echo #

View File

@ -1,5 +1,6 @@
source include/have_innodb.inc;
source include/not_embedded.inc;
source include/have_profiling.inc;
SET GLOBAL EVENT_SCHEDULER = OFF;
SET BINLOG_FORMAT = STATEMENT;

View File

@ -2798,7 +2798,32 @@ UNLOCK TABLES;
DROP TABLE m1, t1;
--echo End of 6.0 tests
--echo #
--echo # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
--echo # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
--echo #
--disable_warnings
drop tables if exists t1, t2, t3, t4, m1;
--enable_warnings
create table t1(id int) engine=myisam;
create view t3 as select 1 as id;
create table t4(id int) engine=memory;
create table m1(id int) engine=merge union=(t1,t2,t3,t4);
--error ER_WRONG_MRG_TABLE
select * from m1;
--echo # The below CHECK and REPAIR TABLE statements should
--echo # report all problems with underlying tables:
--echo # - absence of 't2',
--echo # - missing base table for 't3',
--echo # - wrong engine of 't4'.
check table m1;
repair table m1;
--echo # Clean-up.
drop tables m1, t1, t4;
drop view t3;
--echo End of 5.5 tests
--disable_result_log
--disable_query_log

View File

@ -8376,9 +8376,10 @@ SET @@GLOBAL.init_connect= @old_init_connect;
DROP PROCEDURE p2;
DROP PROCEDURE p5;
--echo #
--echo # Bug#11840395 (formerly known as bug#60347):
--echo # The string "versiondata" seems to be 'leaking' into the schema name space
--echo # The string "versiondata" seems
--echo # to be 'leaking' into the schema name space
--echo #
--disable_warnings
@ -8394,6 +8395,34 @@ call mixedCaseDbName.tryMyProc();
select mixedCaseDbName.tryMyFunc();
DROP DATABASE mixedCaseDbName;
--echo #
--echo # Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
--echo #
CREATE TABLE t1 (a INT, b INT, KEY(b));
CREATE TABLE t2 (c INT, d INT, KEY(c));
INSERT INTO t1 VALUES (1,1),(1,1),(1,2);
INSERT INTO t2 VALUES (1,1),(1,2);
DELIMITER $;
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
BEGIN
DECLARE a int;
-- SQL statement inside
SELECT 1 INTO a;
RETURN a;
END $
DELIMITER ;$
SELECT COUNT(DISTINCT d) FROM t1, t2 WHERE a = c AND b = f1();
DROP FUNCTION f1;
DROP TABLE t1, t2;
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -84,6 +85,8 @@ So, we can read full search-structure as 32-bit word
#include <stdio.h>
#include <string.h>
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
struct hash_lex_struct
{
int first_char;
@ -374,24 +377,9 @@ int main(int argc,char **argv)
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/*\n\n Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
printf("\
/* Copyright (C) 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.\n\
\n\
This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
the Free Software Foundation; version 2 of the License.\n\
\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
\n\
You should have received a copy of the GNU General Public License\n\
along with this program; see the file COPYING. If not, write to the\n\
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston\n\
MA 02110-1301 USA. */\n\
\n\
");
puts("/*");
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
puts("*/");
/* Broken up to indicate that it's not advice to you, gentle reader. */
printf("/* Do " "not " "edit " "this " "file! This is generated by "

View File

@ -1605,8 +1605,13 @@ longlong Item_func_int_div::val_int()
return 0;
}
my_decimal truncated;
const bool do_truncate= true;
if (my_decimal_round(E_DEC_FATAL_ERROR, &tmp, 0, do_truncate, &truncated))
DBUG_ASSERT(false);
longlong res;
if (my_decimal2int(E_DEC_FATAL_ERROR, &tmp, unsigned_flag, &res) &
if (my_decimal2int(E_DEC_FATAL_ERROR, &truncated, unsigned_flag, &res) &
E_DEC_OVERFLOW)
raise_integer_overflow();
return res;
@ -4965,8 +4970,9 @@ longlong Item_func_get_user_var::val_int()
*/
int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
LEX_STRING &name, user_var_entry **out_entry)
static int
get_var_with_binlog(THD *thd, enum_sql_command sql_command,
LEX_STRING &name, user_var_entry **out_entry)
{
BINLOG_USER_VAR_EVENT *user_var_event;
user_var_entry *var_entry;
@ -5096,7 +5102,7 @@ void Item_func_get_user_var::fix_length_and_dec()
'var_entry' is NULL only if there occured an error during the call to
get_var_with_binlog.
*/
if (var_entry)
if (!error && var_entry)
{
m_cached_result_type= var_entry->type;
unsigned_flag= var_entry->unsigned_flag;

View File

@ -2747,7 +2747,7 @@ String *Item_time_typecast::val_str(String *str)
bool Item_date_typecast::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
{
bool res= get_arg0_date(ltime, TIME_FUZZY_DATE);
bool res= get_arg0_date(ltime, fuzzy_date);
ltime->hour= ltime->minute= ltime->second= ltime->second_part= 0;
ltime->time_type= MYSQL_TIMESTAMP_DATE;
return res;

View File

@ -71,6 +71,11 @@ static int rows_event_stmt_cleanup(Relay_log_info const *rli, THD* thd);
static const char *HA_ERR(int i)
{
/*
This function should only be called in case of an error
was detected
*/
DBUG_ASSERT(i != 0);
switch (i) {
case HA_ERR_KEY_NOT_FOUND: return "HA_ERR_KEY_NOT_FOUND";
case HA_ERR_FOUND_DUPP_KEY: return "HA_ERR_FOUND_DUPP_KEY";
@ -123,7 +128,7 @@ static const char *HA_ERR(int i)
case HA_ERR_CORRUPT_EVENT: return "HA_ERR_CORRUPT_EVENT";
case HA_ERR_ROWS_EVENT_APPLY : return "HA_ERR_ROWS_EVENT_APPLY";
}
return 0;
return "No Error!";
}
/**
@ -144,7 +149,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error,
TABLE *table, const char * type,
const char *log_name, ulong pos)
{
const char *handler_error= HA_ERR(ha_error);
const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL);
char buff[MAX_SLAVE_ERRMSG], *slider;
const char *buff_end= buff + sizeof(buff);
uint len;
@ -7765,7 +7770,8 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
error= do_exec_row(rli);
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
if (error)
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
DBUG_ASSERT(error != HA_ERR_RECORD_DELETED);
table->in_use = old_thd;
@ -8387,6 +8393,97 @@ Table_map_log_event::~Table_map_log_event()
*/
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
enum enum_tbl_map_status
{
/* no duplicate identifier found */
OK_TO_PROCESS= 0,
/* this table map must be filtered out */
FILTERED_OUT= 1,
/* identifier mapping table with different properties */
SAME_ID_MAPPING_DIFFERENT_TABLE= 2,
/* a duplicate identifier was found mapping the same table */
SAME_ID_MAPPING_SAME_TABLE= 3
};
/*
Checks if this table map event should be processed or not. First
it checks the filtering rules, and then looks for duplicate identifiers
in the existing list of rli->tables_to_lock.
It checks that there hasn't been any corruption by verifying that there
are no duplicate entries with different properties.
In some cases, some binary logs could get corrupted, showing several
tables mapped to the same table_id, 0 (see: BUG#56226). Thus we do this
early sanity check for such cases and avoid that the server crashes
later.
In some corner cases, the master logs duplicate table map events, i.e.,
same id, same database name, same table name (see: BUG#37137). This is
different from the above as it's the same table that is mapped again
to the same identifier. Thus we cannot just check for same ids and
assume that the event is corrupted we need to check every property.
NOTE: in the event that BUG#37137 ever gets fixed, this extra check
will still be valid because we would need to support old binary
logs anyway.
@param rli The relay log info reference.
@param table_list A list element containing the table to check against.
@return OK_TO_PROCESS
if there was no identifier already in rli->tables_to_lock
FILTERED_OUT
if the event is filtered according to the filtering rules
SAME_ID_MAPPING_DIFFERENT_TABLE
if the same identifier already maps a different table in
rli->tables_to_lock
SAME_ID_MAPPING_SAME_TABLE
if the same identifier already maps the same table in
rli->tables_to_lock.
*/
static enum_tbl_map_status
check_table_map(Relay_log_info const *rli, RPL_TABLE_LIST *table_list)
{
DBUG_ENTER("check_table_map");
enum_tbl_map_status res= OK_TO_PROCESS;
if (rli->sql_thd->slave_thread /* filtering is for slave only */ &&
(!rpl_filter->db_ok(table_list->db) ||
(rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))))
res= FILTERED_OUT;
else
{
for(RPL_TABLE_LIST *ptr= static_cast<RPL_TABLE_LIST*>(rli->tables_to_lock);
ptr;
ptr= static_cast<RPL_TABLE_LIST*>(ptr->next_local))
{
if (ptr->table_id == table_list->table_id)
{
if (strcmp(ptr->db, table_list->db) ||
strcmp(ptr->alias, table_list->table_name) ||
ptr->lock_type != TL_WRITE) // the ::do_apply_event always sets TL_WRITE
res= SAME_ID_MAPPING_DIFFERENT_TABLE;
else
res= SAME_ID_MAPPING_SAME_TABLE;
break;
}
}
}
DBUG_PRINT("debug", ("check of table map ended up with: %u", res));
DBUG_RETURN(res);
}
int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
{
RPL_TABLE_LIST *table_list;
@ -8413,18 +8510,11 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
tname_mem, strlen(tname_mem),
tname_mem, TL_WRITE);
table_list->table_id= m_table_id;
table_list->table_id= DBUG_EVALUATE_IF("inject_tblmap_same_id_maps_diff_table", 0, m_table_id);
table_list->updating= 1;
int error= 0;
if (rli->sql_thd->slave_thread /* filtering is for slave only */ &&
(!rpl_filter->db_ok(table_list->db) ||
(rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list))))
{
my_free(memory);
}
else
DBUG_PRINT("debug", ("table: %s is mapped to %u", table_list->table_name, table_list->table_id));
enum_tbl_map_status tblmap_status= check_table_map(rli, table_list);
if (tblmap_status == OK_TO_PROCESS)
{
DBUG_ASSERT(thd->lex->query_tables != table_list);
@ -8454,8 +8544,48 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
const_cast<Relay_log_info*>(rli)->tables_to_lock_count++;
/* 'memory' is freed in clear_tables_to_lock */
}
else // FILTERED_OUT, SAME_ID_MAPPING_*
{
/*
If mapped already but with different properties, we raise an
error.
If mapped already but with same properties we skip the event.
If filtered out we skip the event.
DBUG_RETURN(error);
In all three cases, we need to free the memory previously
allocated.
*/
if (tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE)
{
/*
Something bad has happened. We need to stop the slave as strange things
could happen if we proceed: slave crash, wrong table being updated, ...
As a consequence we push an error in this case.
*/
char buf[256];
my_snprintf(buf, sizeof(buf),
"Found table map event mapping table id %u which "
"was already mapped but with different settings.",
table_list->table_id);
if (thd->slave_thread)
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER(ER_SLAVE_FATAL_ERROR), buf);
else
/*
For the cases in which a 'BINLOG' statement is set to
execute in a user session
*/
my_printf_error(ER_SLAVE_FATAL_ERROR, ER(ER_SLAVE_FATAL_ERROR),
MYF(0), buf);
}
my_free(memory);
}
DBUG_RETURN(tblmap_status == SAME_ID_MAPPING_DIFFERENT_TABLE);
}
Log_event::enum_skip_reason
@ -9384,7 +9514,8 @@ int Rows_log_event::find_row(const Relay_log_info *rli)
restart_rnd_next:
error= table->file->rnd_next(table->record[0]);
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
if (error)
DBUG_PRINT("info", ("error: %s", HA_ERR(error)));
switch (error) {
case 0:

View File

@ -5161,6 +5161,9 @@ void handle_connections_sockets()
DBUG_ENTER("handle_connections_sockets");
(void) ip_flags;
(void) socket_flags;
#ifndef HAVE_POLL
FD_ZERO(&clientFDs);
#endif
@ -6705,7 +6708,7 @@ static void usage(void)
if (!default_collation_name)
default_collation_name= (char*) default_charset_info->name;
print_version();
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
puts("Starts the MySQL database server.\n");
printf("Usage: %s [OPTIONS]\n", my_progname);
if (!opt_verbose)

View File

@ -368,9 +368,8 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
buff[]: sql_errno:2 + ('#':1 + SQLSTATE_LENGTH:5) + MYSQL_ERRMSG_SIZE:512
*/
uint error;
uchar converted_err[MYSQL_ERRMSG_SIZE];
uint32 converted_err_len;
uchar buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
char converted_err[MYSQL_ERRMSG_SIZE];
char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos;
DBUG_ENTER("send_error_packet");
@ -390,19 +389,16 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
{
/* The first # is to make the protocol backward compatible */
buff[2]= '#';
pos= (uchar*) strmov((char*) buff+3, sqlstate);
pos= strmov(buff+3, sqlstate);
}
converted_err_len= convert_error_message((char*)converted_err,
sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err),
system_charset_info, &error);
length= (uint) (strmake((char*) pos, (char*)converted_err,
MYSQL_ERRMSG_SIZE - 1) - (char*) buff);
err= (char*) buff;
convert_error_message(converted_err, sizeof(converted_err),
thd->variables.character_set_results,
err, strlen(err), system_charset_info, &error);
/* Converted error message is always null-terminated. */
length= (uint) (strmake(pos, converted_err, MYSQL_ERRMSG_SIZE - 1) - buff);
DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff,
length));
}
@ -984,8 +980,8 @@ bool Protocol_text::store(const char *from, size_t length,
{
CHARSET_INFO *tocs= this->thd->variables.character_set_results;
#ifndef DBUG_OFF
DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %s", field_pos,
field_count, (length == 0? "" : from)));
DBUG_PRINT("info", ("Protocol_text::store field %u (%u): %.*s", field_pos,
field_count, (int) length, (length == 0 ? "" : from)));
DBUG_ASSERT(field_pos < field_count);
DBUG_ASSERT(field_types == 0 ||
field_types[field_pos] == MYSQL_TYPE_DECIMAL ||

View File

@ -31,6 +31,8 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val);
int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f);
static void init_master_log_pos(Master_info* mi);
Master_info::Master_info(bool is_slave_recovery)
:Slave_reporting_capability("I/O"),
ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0),
@ -100,6 +102,16 @@ bool Master_info::shall_ignore_server_id(ulong s_id)
!= NULL;
}
void Master_info::clear_in_memory_info(bool all)
{
init_master_log_pos(this);
if (all)
{
port= MYSQL_PORT;
host[0] = 0; user[0] = 0; password[0] = 0;
}
}
void init_master_log_pos(Master_info* mi)
{
DBUG_ENTER("init_master_log_pos");
@ -234,7 +246,7 @@ file '%s')", fname);
}
mi->fd = fd;
init_master_log_pos(mi);
mi->clear_in_memory_info(false);
}
else // file exists

View File

@ -62,6 +62,7 @@ class Master_info : public Slave_reporting_capability
Master_info(bool is_slave_recovery);
~Master_info();
bool shall_ignore_server_id(ulong s_id);
void clear_in_memory_info(bool all);
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN];
@ -113,7 +114,6 @@ class Master_info : public Slave_reporting_capability
DYNAMIC_ARRAY ignore_server_ids;
ulong master_id;
};
void init_master_log_pos(Master_info* mi);
int init_master_info(Master_info* mi, const char* master_info_fname,
const char* slave_info_fname,
bool abort_if_no_master_info_file,

View File

@ -89,6 +89,69 @@ bool No_such_table_error_handler::safely_trapped_errors()
return ((m_handled_errors > 0) && (m_unhandled_errors == 0));
}
/**
This internal handler is used to trap ER_NO_SUCH_TABLE and
ER_WRONG_MRG_TABLE errors during CHECK/REPAIR TABLE for MERGE
tables.
*/
class Repair_mrg_table_error_handler : public Internal_error_handler
{
public:
Repair_mrg_table_error_handler()
: m_handled_errors(false), m_unhandled_errors(false)
{}
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
MYSQL_ERROR::enum_warning_level level,
const char* msg,
MYSQL_ERROR ** cond_hdl);
/**
Returns TRUE if there were ER_NO_SUCH_/WRONG_MRG_TABLE and there
were no unhandled errors. FALSE otherwise.
*/
bool safely_trapped_errors()
{
/*
Check for m_handled_errors is here for extra safety.
It can be useful in situation when call to open_table()
fails because some error which was suppressed by another
error handler (e.g. in case of MDL deadlock which we
decided to solve by back-off and retry).
*/
return (m_handled_errors && (! m_unhandled_errors));
}
private:
bool m_handled_errors;
bool m_unhandled_errors;
};
bool
Repair_mrg_table_error_handler::handle_condition(THD *,
uint sql_errno,
const char*,
MYSQL_ERROR::enum_warning_level level,
const char*,
MYSQL_ERROR ** cond_hdl)
{
*cond_hdl= NULL;
if (sql_errno == ER_NO_SUCH_TABLE || sql_errno == ER_WRONG_MRG_TABLE)
{
m_handled_errors= true;
return TRUE;
}
m_unhandled_errors= true;
return FALSE;
}
/**
@defgroup Data_Dictionary Data Dictionary
@{
@ -4377,6 +4440,20 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
thd->pop_internal_handler();
safe_to_ignore_table= no_such_table_handler.safely_trapped_errors();
}
else if (tables->parent_l && (thd->open_options & HA_OPEN_FOR_REPAIR))
{
/*
Also fail silently for underlying tables of a MERGE table if this
table is opened for CHECK/REPAIR TABLE statement. This is needed
to provide complete list of problematic underlying tables in
CHECK/REPAIR TABLE output.
*/
Repair_mrg_table_error_handler repair_mrg_table_handler;
thd->push_internal_handler(&repair_mrg_table_handler);
error= open_table(thd, tables, new_frm_mem, ot_ctx);
thd->pop_internal_handler();
safe_to_ignore_table= repair_mrg_table_handler.safely_trapped_errors();
}
else
error= open_table(thd, tables, new_frm_mem, ot_ctx);
@ -7811,7 +7888,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
sum_func_list)
item->split_sum_func(thd, ref_pointer_array, *sum_func_list);
thd->used_tables|= item->used_tables();
thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;
}
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
@ -8158,7 +8235,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
views and natural joins this update is performed inside the loop below.
*/
if (table)
thd->used_tables|= table->map;
thd->lex->used_tables|= table->map;
/*
Initialize a generic field iterator for the current table reference.
@ -8243,7 +8320,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
field_table= nj_col->table_ref->table;
if (field_table)
{
thd->used_tables|= field_table->map;
thd->lex->used_tables|= field_table->map;
field_table->covering_keys.intersect(field->part_of_key);
field_table->merge_keys.merge(field->part_of_key);
field_table->used_fields++;
@ -8251,7 +8328,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
}
}
else
thd->used_tables|= item->used_tables();
thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;
}
/*

View File

@ -520,11 +520,11 @@ const char *set_thd_proc_info(void *thd_arg, const char *info,
thd= current_thd;
const char *old_info= thd->proc_info;
const char *basename= calling_file ? base_name(calling_file) : NULL;
DBUG_PRINT("proc_info", ("%s:%d %s", basename, calling_line, info));
DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, info));
#if defined(ENABLED_PROFILING)
thd->profiling.status_change(info, calling_function, basename, calling_line);
thd->profiling.status_change(info,
calling_function, calling_file, calling_line);
#endif
thd->proc_info= info;
return old_info;
@ -795,7 +795,6 @@ THD::THD()
is_slave_error= thread_specific_used= FALSE;
my_hash_clear(&handler_tables_hash);
tmp_table=0;
used_tables=0;
cuted_fields= 0L;
sent_row_count= 0L;
limit_found_rows= 0;

View File

@ -1960,13 +1960,6 @@ public:
*/
ha_rows examined_row_count;
/*
The set of those tables whose fields are referenced in all subqueries
of the query.
TODO: possibly this it is incorrect to have used tables in THD because
with more than one subquery, it is not clear what does the field mean.
*/
table_map used_tables;
USER_CONN *user_connect;
CHARSET_INFO *db_charset;
Warning_info *warning_info;
@ -3642,14 +3635,6 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
void mark_transaction_to_rollback(THD *thd, bool all);
/*
This prototype is placed here instead of in item_func.h because it
depends on the definition of enum_sql_command, which is in this
file.
*/
int get_var_with_binlog(THD *thd, enum_sql_command sql_command,
LEX_STRING &name, user_var_entry **out_entry);
/* Inline functions */
inline bool add_item_to_list(THD *thd, Item *item)

View File

@ -717,7 +717,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
lock_type= table_list->lock_type;
thd_proc_info(thd, "init");
thd->used_tables=0;
thd->lex->used_tables=0;
values= its++;
value_count= values->elements;
@ -872,7 +872,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
}
else
{
if (thd->used_tables) // Column used in values()
if (thd->lex->used_tables) // Column used in values()
restore_record(table,s->default_values); // Get empty record
else
{
@ -1610,9 +1610,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto before_trg_err;
table->file->restore_auto_increment(prev_insert_id);
if (table->next_number_field)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
info->touched++;
if (!records_are_comparable(table) || compare_records(table))
{
@ -1649,8 +1646,6 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
if (table->next_number_field)
table->file->adjust_next_insert_id_after_explicit_value(
table->next_number_field->val_int());
info->touched++;
goto ok_or_after_trg_err;
}
else /* DUP_REPLACE */

View File

@ -434,6 +434,7 @@ void lex_start(THD *thd)
lex->server_options.port= -1;
lex->is_lex_started= TRUE;
lex->used_tables= 0;
DBUG_VOID_RETURN;
}

View File

@ -294,6 +294,10 @@ typedef struct st_lex_master_info
DYNAMIC_ARRAY repl_ignore_server_ids;
} LEX_MASTER_INFO;
typedef struct st_lex_reset_slave
{
bool all;
} LEX_RESET_SLAVE;
enum sub_select_type
{
@ -2232,6 +2236,7 @@ struct LEX: public Query_tables_list
LEX_MASTER_INFO mi; // used by CHANGE MASTER
LEX_SERVER_OPTIONS server_options;
USER_RESOURCES mqh;
LEX_RESET_SLAVE reset_slave_info;
ulong type;
/*
This variable is used in post-parse stage to declare that sum-functions,
@ -2391,6 +2396,16 @@ struct LEX: public Query_tables_list
bool escape_used;
bool is_lex_started; /* If lex_start() did run. For debugging. */
/*
The set of those tables whose fields are referenced in all subqueries
of the query.
TODO: possibly this it is incorrect to have used tables in LEX because
with subquery, it is not clear what does the field mean. To fix this
we should aggregate used tables information for selected expressions
into the select_lex.
*/
table_map used_tables;
LEX();
virtual ~LEX()

View File

@ -177,6 +177,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
#ifndef EMBEDDED_LIBRARY
LOAD_FILE_INFO lf_info;
THD::killed_state killed_status= THD::NOT_KILLED;
bool is_concurrent;
#endif
char *db = table_list->db; // This is never null
/*
@ -187,7 +188,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
char *tdb= thd->db ? thd->db : db; // Result is never null
ulong skip_lines= ex->skip_lines;
bool transactional_table;
bool is_concurrent;
DBUG_ENTER("mysql_load");
/*
@ -256,7 +256,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table= table_list->table;
transactional_table= table->file->has_transactions();
#ifndef EMBEDDED_LIBRARY
is_concurrent= (table_list->lock_type == TL_WRITE_CONCURRENT_INSERT);
#endif
if (!fields_vars.elements)
{

View File

@ -1474,7 +1474,7 @@ static int mysql_test_select(Prepared_statement *stmt,
if (open_normal_and_derived_tables(thd, tables, MYSQL_OPEN_FORCE_SHARED_MDL))
goto error;
thd->used_tables= 0; // Updated by setup_fields
thd->lex->used_tables= 0; // Updated by setup_fields
/*
JOIN::prepare calls
@ -1646,7 +1646,7 @@ static bool select_like_stmt_test(Prepared_statement *stmt,
if (specific_prepare && (*specific_prepare)(thd))
DBUG_RETURN(TRUE);
thd->used_tables= 0; // Updated by setup_fields
thd->lex->used_tables= 0; // Updated by setup_fields
/* Calls JOIN::prepare */
DBUG_RETURN(lex->unit.prepare(thd, 0, setup_tables_done_option));

View File

@ -294,7 +294,7 @@ void QUERY_PROFILE::new_status(const char *status_arg,
DBUG_ASSERT(status_arg != NULL);
if ((function_arg != NULL) && (file_arg != NULL))
prof= new PROF_MEASUREMENT(this, status_arg, function_arg, file_arg, line_arg);
prof= new PROF_MEASUREMENT(this, status_arg, function_arg, base_name(file_arg), line_arg);
else
prof= new PROF_MEASUREMENT(this, status_arg);

View File

@ -1285,8 +1285,9 @@ int reset_slave(THD *thd, Master_info* mi)
goto err;
}
/* Clear master's log coordinates */
init_master_log_pos(mi);
/* Clear master's log coordinates and associated information */
mi->clear_in_memory_info(thd->lex->reset_slave_info.all);
/*
Reset errors (the idea is that we forget about the
old master).

View File

@ -435,7 +435,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
if (!ref->fixed && ref->fix_fields(thd, 0))
return TRUE;
thd->used_tables|= item->used_tables();
thd->lex->used_tables|= item->used_tables();
}
return false;
}
@ -1675,7 +1675,7 @@ JOIN::optimize()
if (exec_tmp_table1->distinct)
{
table_map used_tables= thd->used_tables;
table_map used_tables= thd->lex->used_tables;
JOIN_TAB *last_join_tab= join_tab+tables-1;
do
{
@ -2552,7 +2552,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (!(join= new JOIN(thd, fields, select_options, result)))
DBUG_RETURN(TRUE);
thd_proc_info(thd, "init");
thd->used_tables=0; // Updated by setup_fields
thd->lex->used_tables=0; // Updated by setup_fields
err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit);
@ -17032,7 +17032,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
need_order=0;
extra.append(STRING_WITH_LEN("; Using filesort"));
}
if (distinct & test_all_bits(used_tables,thd->used_tables))
if (distinct & test_all_bits(used_tables, thd->lex->used_tables))
extra.append(STRING_WITH_LEN("; Distinct"));
for (uint part= 0; part < tab->ref.key_parts; part++)

View File

@ -11321,7 +11321,10 @@ flush_option:
| STATUS_SYM
{ Lex->type|= REFRESH_STATUS; }
| SLAVE
{ Lex->type|= REFRESH_SLAVE; }
{
Lex->type|= REFRESH_SLAVE;
Lex->reset_slave_info.all= false;
}
| MASTER_SYM
{ Lex->type|= REFRESH_MASTER; }
| DES_KEY_FILE
@ -11352,10 +11355,16 @@ reset_options:
reset_option:
SLAVE { Lex->type|= REFRESH_SLAVE; }
slave_reset_options { }
| MASTER_SYM { Lex->type|= REFRESH_MASTER; }
| QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}
;
slave_reset_options:
/* empty */ { Lex->reset_slave_info.all= false; }
| ALL { Lex->reset_slave_info.all= true; }
;
purge:
PURGE
{

View File

@ -3575,7 +3575,6 @@ static
void
btr_record_not_null_field_in_rec(
/*=============================*/
rec_t* rec, /*!< in: physical record */
ulint n_unique, /*!< in: dict_index_get_n_unique(index),
number of columns uniquely determine
an index entry */
@ -3595,9 +3594,8 @@ btr_record_not_null_field_in_rec(
for (i = 0; i < n_unique; i++) {
ulint rec_len;
byte* field;
field = rec_get_nth_field(rec, offsets, i, &rec_len);
rec_get_nth_field_offs(offsets, i, &rec_len);
if (rec_len != UNIV_SQL_NULL) {
n_not_null[i]++;
@ -3712,7 +3710,7 @@ btr_estimate_number_of_different_key_vals(
if (n_not_null) {
btr_record_not_null_field_in_rec(
rec, n_cols, offsets_rec, n_not_null);
n_cols, offsets_rec, n_not_null);
}
}
@ -3747,7 +3745,7 @@ btr_estimate_number_of_different_key_vals(
if (n_not_null) {
btr_record_not_null_field_in_rec(
next_rec, n_cols, offsets_next_rec,
n_cols, offsets_next_rec,
n_not_null);
}

View File

@ -400,6 +400,7 @@ buf_get_total_stat(
tot_stat->n_pages_read += buf_stat->n_pages_read;
tot_stat->n_pages_written += buf_stat->n_pages_written;
tot_stat->n_pages_created += buf_stat->n_pages_created;
tot_stat->n_ra_pages_read_rnd += buf_stat->n_ra_pages_read_rnd;
tot_stat->n_ra_pages_read += buf_stat->n_ra_pages_read;
tot_stat->n_ra_pages_evicted += buf_stat->n_ra_pages_evicted;
tot_stat->n_pages_made_young += buf_stat->n_pages_made_young;
@ -2358,6 +2359,9 @@ loop2:
}
if (buf_read_page(space, zip_size, offset)) {
buf_read_ahead_random(space, zip_size, offset,
ibuf_inside(mtr));
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
@ -4381,6 +4385,7 @@ buf_stats_aggregate_pool_info(
total_info->n_pages_created += pool_info->n_pages_created;
total_info->n_pages_written += pool_info->n_pages_written;
total_info->n_page_gets += pool_info->n_page_gets;
total_info->n_ra_pages_read_rnd += pool_info->n_ra_pages_read_rnd;
total_info->n_ra_pages_read += pool_info->n_ra_pages_read;
total_info->n_ra_pages_evicted += pool_info->n_ra_pages_evicted;
total_info->page_made_young_rate += pool_info->page_made_young_rate;
@ -4393,6 +4398,7 @@ buf_stats_aggregate_pool_info(
total_info->page_read_delta += pool_info->page_read_delta;
total_info->young_making_delta += pool_info->young_making_delta;
total_info->not_young_making_delta += pool_info->not_young_making_delta;
total_info->pages_readahead_rnd_rate += pool_info->pages_readahead_rnd_rate;
total_info->pages_readahead_rate += pool_info->pages_readahead_rate;
total_info->pages_evicted_rate += pool_info->pages_evicted_rate;
total_info->unzip_lru_len += pool_info->unzip_lru_len;
@ -4470,6 +4476,7 @@ buf_stats_get_pool_info(
pool_info->n_page_gets = buf_pool->stat.n_page_gets;
pool_info->n_ra_pages_read_rnd = buf_pool->stat.n_ra_pages_read_rnd;
pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read;
pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted;
@ -4509,6 +4516,10 @@ buf_stats_get_pool_info(
buf_pool->stat.n_pages_not_made_young
- buf_pool->old_stat.n_pages_not_made_young;
}
pool_info->pages_readahead_rnd_rate =
(buf_pool->stat.n_ra_pages_read_rnd
- buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed;
pool_info->pages_readahead_rate =
(buf_pool->stat.n_ra_pages_read
@ -4594,9 +4605,12 @@ buf_print_io_instance(
/* Statistics about read ahead algorithm */
fprintf(file, "Pages read ahead %.2f/s,"
" evicted without access %.2f/s\n",
" evicted without access %.2f/s,"
" Random read ahead %.2f/s\n",
pool_info->pages_readahead_rate,
pool_info->pages_evicted_rate);
pool_info->pages_evicted_rate,
pool_info->pages_readahead_rnd_rate);
/* Print some values to help us with visualizing what is
happening with LRU eviction. */

View File

@ -40,8 +40,10 @@ Created 11/5/1995 Heikki Tuuri
#include "mysql/plugin.h"
#include "mysql/service_thd_wait.h"
/** The linear read-ahead area size */
#define BUF_READ_AHEAD_LINEAR_AREA BUF_READ_AHEAD_AREA
/** There must be at least this many pages in buf_pool in the area to start
a random read-ahead */
#define BUF_READ_AHEAD_RANDOM_THRESHOLD(b) \
(5 + BUF_READ_AHEAD_AREA(b) / 8)
/** If there are buf_pool->curr_size per the number below pending reads, then
read-ahead is not done: this is to prevent flooding the buffer pool with
@ -161,6 +163,171 @@ buf_read_page_low(
return(1);
}
/********************************************************************//**
Applies a random read-ahead in buf_pool if there are at least a threshold
value of accessed pages from the random read-ahead area. Does not read any
page, not even the one at the position (space, offset), if the read-ahead
mechanism is not activated. NOTE 1: the calling thread may own latches on
pages: to avoid deadlocks this function must be written such that it cannot
end up waiting for these latches! NOTE 2: the calling thread must want
access to the page given: this rule is set to prevent unintended read-aheads
performed by ibuf routines, a situation which could result in a deadlock if
the OS does not support asynchronous i/o.
@return number of page read requests issued; NOTE that if we read ibuf
pages, it may happen that the page at the given page number does not
get read even if we return a positive value!
@return number of page read requests issued */
UNIV_INTERN
ulint
buf_read_ahead_random(
/*==================*/
ulint space, /*!< in: space id */
ulint zip_size, /*!< in: compressed page size in bytes,
or 0 */
ulint offset, /*!< in: page number of a page which
the current thread wants to access */
ibool inside_ibuf) /*!< in: TRUE if we are inside ibuf
routine */
{
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ib_int64_t tablespace_version;
ulint recent_blocks = 0;
ulint ibuf_mode;
ulint count;
ulint low, high;
ulint err;
ulint i;
const ulint buf_read_ahead_random_area
= BUF_READ_AHEAD_AREA(buf_pool);
if (!srv_random_read_ahead) {
/* Disabled by user */
return(0);
}
if (srv_startup_is_before_trx_rollback_phase) {
/* No read-ahead to avoid thread deadlocks */
return(0);
}
if (ibuf_bitmap_page(zip_size, offset)
|| trx_sys_hdr_page(space, offset)) {
/* If it is an ibuf bitmap page or trx sys hdr, we do
no read-ahead, as that could break the ibuf page access
order */
return(0);
}
/* Remember the tablespace version before we ask te tablespace size
below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
do not try to read outside the bounds of the tablespace! */
tablespace_version = fil_space_get_version(space);
low = (offset / buf_read_ahead_random_area)
* buf_read_ahead_random_area;
high = (offset / buf_read_ahead_random_area + 1)
* buf_read_ahead_random_area;
if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space);
}
buf_pool_mutex_enter(buf_pool);
if (buf_pool->n_pend_reads
> buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
buf_pool_mutex_exit(buf_pool);
return(0);
}
/* Count how many blocks in the area have been recently accessed,
that is, reside near the start of the LRU list. */
for (i = low; i < high; i++) {
const buf_page_t* bpage =
buf_page_hash_get(buf_pool, space, i);
if (bpage
&& buf_page_is_accessed(bpage)
&& buf_page_peek_if_young(bpage)) {
recent_blocks++;
if (recent_blocks
>= BUF_READ_AHEAD_RANDOM_THRESHOLD(buf_pool)) {
buf_pool_mutex_exit(buf_pool);
goto read_ahead;
}
}
}
buf_pool_mutex_exit(buf_pool);
/* Do nothing */
return(0);
read_ahead:
/* Read all the suitable blocks within the area */
if (inside_ibuf) {
ibuf_mode = BUF_READ_IBUF_PAGES_ONLY;
} else {
ibuf_mode = BUF_READ_ANY_PAGE;
}
count = 0;
for (i = low; i < high; i++) {
/* It is only sensible to do read-ahead in the non-sync aio
mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(zip_size, i)) {
count += buf_read_page_low(
&err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, zip_size, FALSE,
tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: in random"
" readahead trying to access\n"
"InnoDB: tablespace %lu page %lu,\n"
"InnoDB: but the tablespace does not"
" exist or is just being dropped.\n",
(ulong) space, (ulong) i);
}
}
}
/* In simulated aio we wake the aio handler threads only after
queuing all aio requests, in native aio the following call does
nothing: */
os_aio_simulated_wake_handler_threads();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset,
(ulong) count);
}
#endif /* UNIV_DEBUG */
/* Read ahead is considered one I/O operation for the purpose of
LRU policy decision. */
buf_LRU_stat_inc_io();
buf_pool->stat.n_ra_pages_read_rnd += count;
srv_buf_pool_reads += count;
return(count);
}
/********************************************************************//**
High-level function which reads a page asynchronously from a file to the
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
@ -257,7 +424,7 @@ buf_read_ahead_linear(
ulint err;
ulint i;
const ulint buf_read_ahead_linear_area
= BUF_READ_AHEAD_LINEAR_AREA(buf_pool);
= BUF_READ_AHEAD_AREA(buf_pool);
ulint threshold;
if (UNIV_UNLIKELY(srv_startup_is_before_trx_rollback_phase)) {

View File

@ -614,6 +614,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_buffer_pool_pages_misc, SHOW_LONG},
{"buffer_pool_pages_total",
(char*) &export_vars.innodb_buffer_pool_pages_total, SHOW_LONG},
{"buffer_pool_read_ahead_rnd",
(char*) &export_vars.innodb_buffer_pool_read_ahead_rnd, SHOW_LONG},
{"buffer_pool_read_ahead",
(char*) &export_vars.innodb_buffer_pool_read_ahead, SHOW_LONG},
{"buffer_pool_read_ahead_evicted",
@ -7896,6 +7898,8 @@ ha_innobase::info_low(
if (flag & HA_STATUS_VARIABLE) {
ulint page_size;
dict_table_stats_lock(ib_table, RW_S_LATCH);
n_rows = ib_table->stat_n_rows;
@ -7938,14 +7942,19 @@ ha_innobase::info_low(
prebuilt->autoinc_last_value = 0;
}
page_size = dict_table_zip_size(ib_table);
if (page_size == 0) {
page_size = UNIV_PAGE_SIZE;
}
stats.records = (ha_rows)n_rows;
stats.deleted = 0;
stats.data_file_length = ((ulonglong)
ib_table->stat_clustered_index_size)
* UNIV_PAGE_SIZE;
stats.index_file_length = ((ulonglong)
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
stats.data_file_length
= ((ulonglong) ib_table->stat_clustered_index_size)
* page_size;
stats.index_file_length =
((ulonglong) ib_table->stat_sum_of_other_index_sizes)
* page_size;
dict_table_stats_unlock(ib_table, RW_S_LATCH);
@ -11317,6 +11326,11 @@ static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
NULL, NULL, 0, 0, 1, 0);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead,
PLUGIN_VAR_NOCMDARG,
"Whether to use read ahead for random access within an extent.",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
PLUGIN_VAR_RQCMDARG,
"Number of pages that must be accessed sequentially for InnoDB to "
@ -11385,6 +11399,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
MYSQL_SYSVAR(change_buffering_debug),
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
MYSQL_SYSVAR(random_read_ahead),
MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(io_capacity),
MYSQL_SYSVAR(purge_threads),

View File

@ -147,6 +147,8 @@ struct buf_pool_info_struct{
ulint n_pages_created; /*!< buf_pool->n_pages_created */
ulint n_pages_written; /*!< buf_pool->n_pages_written */
ulint n_page_gets; /*!< buf_pool->n_page_gets */
ulint n_ra_pages_read_rnd; /*!< buf_pool->n_ra_pages_read_rnd,
number of pages readahead */
ulint n_ra_pages_read; /*!< buf_pool->n_ra_pages_read, number
of pages readahead */
ulint n_ra_pages_evicted; /*!< buf_pool->n_ra_pages_evicted,
@ -171,6 +173,8 @@ struct buf_pool_info_struct{
last printout */
/* Statistics about read ahead algorithm. */
double pages_readahead_rnd_rate;/*!< random readahead rate in pages per
second */
double pages_readahead_rate; /*!< readahead rate in pages per
second */
double pages_evicted_rate; /*!< rate of readahead page evicted
@ -542,6 +546,18 @@ buf_block_get_freed_page_clock(
__attribute__((pure));
/********************************************************************//**
Tells if a block is still close enough to the MRU end of the LRU list
meaning that it is not in danger of getting evicted and also implying
that it has been accessed recently.
Note that this is for heuristics only and does not reserve buffer pool
mutex.
@return TRUE if block is close to MRU end of LRU */
UNIV_INLINE
ibool
buf_page_peek_if_young(
/*===================*/
const buf_page_t* bpage); /*!< in: block */
/********************************************************************//**
Recommends a move of a block to the start of the LRU list if there is danger
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
mutex.
@ -1605,6 +1621,8 @@ struct buf_pool_stat_struct{
ulint n_pages_written;/*!< number write operations */
ulint n_pages_created;/*!< number of pages created
in the pool with no read */
ulint n_ra_pages_read_rnd;/*!< number of pages read in
as part of random read ahead */
ulint n_ra_pages_read;/*!< number of pages read in
as part of read ahead */
ulint n_ra_pages_evicted;/*!< number of read ahead
@ -1744,7 +1762,7 @@ struct buf_pool_struct{
UT_LIST_BASE_NODE_T(buf_page_t) LRU;
/*!< base node of the LRU list */
buf_page_t* LRU_old; /*!< pointer to the about
buf_LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV
oldest blocks in the LRU list;
NULL if LRU length less than
BUF_LRU_OLD_MIN_LEN;

View File

@ -124,6 +124,29 @@ buf_block_get_freed_page_clock(
return(buf_page_get_freed_page_clock(&block->page));
}
/********************************************************************//**
Tells if a block is still close enough to the MRU end of the LRU list
meaning that it is not in danger of getting evicted and also implying
that it has been accessed recently.
Note that this is for heuristics only and does not reserve buffer pool
mutex.
@return TRUE if block is close to MRU end of LRU */
UNIV_INLINE
ibool
buf_page_peek_if_young(
/*===================*/
const buf_page_t* bpage) /*!< in: block */
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
/* FIXME: bpage->freed_page_clock is 31 bits */
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
< ((ulint) bpage->freed_page_clock
+ (buf_pool->curr_size
* (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
}
/********************************************************************//**
Recommends a move of a block to the start of the LRU list if there is danger
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
@ -154,12 +177,7 @@ buf_page_peek_if_too_old(
buf_pool->stat.n_pages_not_made_young++;
return(FALSE);
} else {
/* FIXME: bpage->freed_page_clock is 31 bits */
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
> ((ulint) bpage->freed_page_clock
+ (buf_pool->curr_size
* (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
return(!buf_page_peek_if_young(bpage));
}
}

View File

@ -184,7 +184,7 @@ buf_LRU_make_block_old(
/*===================*/
buf_page_t* bpage); /*!< in: control block */
/**********************************************************************//**
Updates buf_LRU_old_ratio.
Updates buf_pool->LRU_old_ratio.
@return updated old_pct */
UNIV_INTERN
ulint
@ -193,7 +193,7 @@ buf_LRU_old_ratio_update(
uint old_pct,/*!< in: Reserve this percentage of
the buffer pool for "old" blocks. */
ibool adjust);/*!< in: TRUE=adjust the LRU list;
FALSE=just assign buf_LRU_old_ratio
FALSE=just assign buf_pool->LRU_old_ratio
during the initialization of InnoDB */
/********************************************************************//**
Update the historical stats that we are collecting for LRU eviction
@ -222,18 +222,15 @@ buf_LRU_print(void);
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
/** @name Heuristics for detecting index scan @{ */
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
"old" blocks. Protected by buf_pool->mutex. */
extern uint buf_LRU_old_ratio;
/** The denominator of buf_LRU_old_ratio. */
/** The denominator of buf_pool->LRU_old_ratio. */
#define BUF_LRU_OLD_RATIO_DIV 1024
/** Maximum value of buf_LRU_old_ratio.
/** Maximum value of buf_pool->LRU_old_ratio.
@see buf_LRU_old_adjust_len
@see buf_LRU_old_ratio_update */
@see buf_pool->LRU_old_ratio_update */
#define BUF_LRU_OLD_RATIO_MAX BUF_LRU_OLD_RATIO_DIV
/** Minimum value of buf_LRU_old_ratio.
/** Minimum value of buf_pool->LRU_old_ratio.
@see buf_LRU_old_adjust_len
@see buf_LRU_old_ratio_update
@see buf_pool->LRU_old_ratio_update
The minimum must exceed
(BUF_LRU_OLD_TOLERANCE + 5) * BUF_LRU_OLD_RATIO_DIV / BUF_LRU_OLD_MIN_LEN. */
#define BUF_LRU_OLD_RATIO_MIN 51

View File

@ -43,6 +43,31 @@ buf_read_page(
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
ulint offset);/*!< in: page number */
/********************************************************************//**
Applies a random read-ahead in buf_pool if there are at least a threshold
value of accessed pages from the random read-ahead area. Does not read any
page, not even the one at the position (space, offset), if the read-ahead
mechanism is not activated. NOTE 1: the calling thread may own latches on
pages: to avoid deadlocks this function must be written such that it cannot
end up waiting for these latches! NOTE 2: the calling thread must want
access to the page given: this rule is set to prevent unintended read-aheads
performed by ibuf routines, a situation which could result in a deadlock if
the OS does not support asynchronous i/o.
@return number of page read requests issued; NOTE that if we read ibuf
pages, it may happen that the page at the given page number does not
get read even if we return a positive value!
@return number of page read requests issued */
UNIV_INTERN
ulint
buf_read_ahead_random(
/*==================*/
ulint space, /*!< in: space id */
ulint zip_size, /*!< in: compressed page size in bytes,
or 0 */
ulint offset, /*!< in: page number of a page which
the current thread wants to access */
ibool inside_ibuf); /*!< in: TRUE if we are inside ibuf
routine */
/********************************************************************//**
Applies linear read-ahead if in the buf_pool the page is a border page of
a linear read-ahead area and all the pages in the area have been accessed.
Does not read any page if the read-ahead mechanism is not activated. Note

View File

@ -158,6 +158,7 @@ extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
extern ulint srv_n_file_io_threads;
extern my_bool srv_random_read_ahead;
extern ulong srv_read_ahead_threshold;
extern ulint srv_n_read_io_threads;
extern ulint srv_n_write_io_threads;
@ -703,6 +704,7 @@ struct export_var_struct{
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */

View File

@ -148,22 +148,27 @@ row_build_index_entry(
continue;
}
} else if (dfield_is_ext(dfield)) {
/* This table should be in Antelope format
(ROW_FORMAT=REDUNDANT or ROW_FORMAT=COMPACT).
In that format, the maximum column prefix
/* This table is either in Antelope format
(ROW_FORMAT=REDUNDANT or ROW_FORMAT=COMPACT)
or a purge record where the ordered part of
the field is not external.
In Antelope, the maximum column prefix
index length is 767 bytes, and the clustered
index record contains a 768-byte prefix of
each off-page column. */
ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
len -= BTR_EXTERN_FIELD_REF_SIZE;
dfield_set_len(dfield, len);
}
/* If a column prefix index, take only the prefix. */
ut_ad(ind_field->prefix_len);
len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminmaxlen,
ind_field->prefix_len, len, dfield_get_data(dfield));
dfield_set_len(dfield, len);
if (ind_field->prefix_len) {
len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminmaxlen,
ind_field->prefix_len, len,
dfield_get_data(dfield));
dfield_set_len(dfield, len);
}
}
ut_ad(dtuple_check_typed(entry));

View File

@ -222,6 +222,8 @@ UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX;
UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX;
UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;
/* Switch to enable random read ahead. */
UNIV_INTERN my_bool srv_random_read_ahead = FALSE;
/* User settable value of the number of pages that must be present
in the buffer cache and accessed sequentially for InnoDB to trigger a
readahead request. */
@ -2032,6 +2034,8 @@ srv_export_innodb_status(void)
export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads;
export_vars.innodb_buffer_pool_read_ahead_rnd
= stat.n_ra_pages_read_rnd;
export_vars.innodb_buffer_pool_read_ahead
= stat.n_ra_pages_read;
export_vars.innodb_buffer_pool_read_ahead_evicted

View File

@ -159,9 +159,14 @@ extern "C" void myrg_print_wrong_table(const char *table_name)
buf[db.length]= '.';
memcpy(buf + db.length + 1, name.str, name.length);
buf[db.length + name.length + 1]= 0;
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE),
buf);
/*
Push an error to be reported as part of CHECK/REPAIR result-set.
Note that calling my_error() from handler is a hack which is kept
here to avoid refactoring. Normally engines should report errors
through return value which will be interpreted by caller using
handler::print_error() call.
*/
my_error(ER_ADMIN_WRONG_MRG_TABLE, MYF(0), buf);
}
@ -593,8 +598,7 @@ public:
@return pointer to open MyISAM table structure
@retval !=NULL OK, returning pointer
@retval NULL, my_errno == 0 Ok, no more child tables
@retval NULL, my_errno != 0 error
@retval NULL, Error.
@detail
This function retrieves the MyISAM table handle from the
@ -614,16 +618,32 @@ extern "C" MI_INFO *myisammrg_attach_children_callback(void *callback_param)
MI_INFO *myisam= NULL;
DBUG_ENTER("myisammrg_attach_children_callback");
if (!child_l)
{
DBUG_PRINT("myrg", ("No more children to attach"));
my_errno= 0; /* Ok, no more child tables. */
goto end;
}
/*
Number of children in the list and MYRG_INFO::tables_count,
which is used by caller of this function, should always match.
*/
DBUG_ASSERT(child_l);
child= child_l->table;
/* Prepare for next child. */
param->next();
/*
When MERGE table is opened for CHECK or REPAIR TABLE statements,
failure to open any of underlying tables is ignored until this moment
(this is needed to provide complete list of the problematic underlying
tables in CHECK/REPAIR TABLE output).
Here we detect such a situation and report an appropriate error.
*/
if (! child)
{
DBUG_PRINT("error", ("failed to open underlying table '%s'.'%s'",
child_l->db, child_l->table_name));
/* This should only happen inside of CHECK/REPAIR TABLE. */
DBUG_ASSERT(current_thd->open_options & HA_OPEN_FOR_REPAIR);
goto end;
}
/*
Do a quick compatibility check. The table def version is set when
the table share is created. The child def version is copied
@ -653,7 +673,6 @@ extern "C" MI_INFO *myisammrg_attach_children_callback(void *callback_param)
{
DBUG_PRINT("error", ("temporary table mismatch parent: %d child: %d",
parent->s->tmp_table, child->s->tmp_table));
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
goto end;
}
@ -664,12 +683,27 @@ extern "C" MI_INFO *myisammrg_attach_children_callback(void *callback_param)
DBUG_PRINT("error", ("no MyISAM handle for child table: '%s'.'%s' 0x%lx",
child->s->db.str, child->s->table_name.str,
(long) child));
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
}
DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx my_errno: %d",
my_errno ? 0L : (long) myisam, my_errno));
DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx", (long) myisam));
end:
if (!myisam &&
(current_thd->open_options & HA_OPEN_FOR_REPAIR))
{
char buf[2*NAME_LEN + 1 + 1];
strxnmov(buf, sizeof(buf) - 1, child_l->db, ".", child_l->table_name, NULL);
/*
Push an error to be reported as part of CHECK/REPAIR result-set.
Note that calling my_error() from handler is a hack which is kept
here to avoid refactoring. Normally engines should report errors
through return value which will be interpreted by caller using
handler::print_error() call.
*/
my_error(ER_ADMIN_WRONG_MRG_TABLE, MYF(0), buf);
}
DBUG_RETURN(myisam);
}
@ -783,12 +817,6 @@ int ha_myisammrg::attach_children(void)
/* Must call this with children list in place. */
DBUG_ASSERT(this->table->pos_in_table_list->next_global == this->children_l);
/*
'my_errno' is set by myisammrg_attach_children_callback() in
case of an error.
*/
my_errno= 0;
if (myrg_attach_children(this->file, this->test_if_locked |
current_thd->open_options,
myisammrg_attach_children_callback, &param,

View File

@ -385,6 +385,7 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
uint UNINIT_VAR(key_parts);
uint min_keys;
my_bool bad_children= FALSE;
my_bool first_child= TRUE;
DBUG_ENTER("myrg_attach_children");
DBUG_PRINT("myrg", ("handle_locking: %d", handle_locking));
@ -399,16 +400,26 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
errpos= 0;
file_offset= 0;
min_keys= 0;
child_nr= 0;
while ((myisam= (*callback)(callback_param)))
for (child_nr= 0; child_nr < m_info->tables; child_nr++)
{
if (! (myisam= (*callback)(callback_param)))
{
if (handle_locking & HA_OPEN_FOR_REPAIR)
{
/* An appropriate error should've been already pushed by callback. */
bad_children= TRUE;
continue;
}
goto bad_children;
}
DBUG_PRINT("myrg", ("child_nr: %u table: '%s'",
child_nr, myisam->filename));
DBUG_ASSERT(child_nr < m_info->tables);
/* Special handling when the first child is attached. */
if (!child_nr)
if (first_child)
{
first_child= FALSE;
m_info->reclength= myisam->s->base.reclength;
min_keys= myisam->s->base.keys;
key_parts= myisam->s->base.key_parts;
@ -456,14 +467,11 @@ int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
for (idx= 0; idx < key_parts; idx++)
m_info->rec_per_key_part[idx]+= (myisam->s->state.rec_per_key_part[idx] /
m_info->tables);
child_nr++;
}
if (bad_children)
goto bad_children;
/* Note: callback() resets my_errno, so it is safe to check it here */
if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
goto err;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
{
my_errno= HA_ERR_RECORD_FILE_FULL;

View File

@ -1574,6 +1574,9 @@ static void unlock_rwlock_v1(PSI_rwlock *rwlock)
aggregate_single_stat_chain(&pfs_rwlock->m_read_lock_stat, locked_time);
}
}
#else
(void) last_reader;
(void) last_writer;
#endif
}

View File

@ -2182,7 +2182,6 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
}
buf0=to->buf;
stop0=buf0+intg0+frac0;
DBUG_ASSERT(stop0 <= &to->buf[to->len]);
if (likely(div_mod))
while (dintg++ < 0 && buf0 < &to->buf[to->len])
{
@ -2277,7 +2276,10 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2,
}
}
if (likely(div_mod))
{
DBUG_ASSERT(buf0 < to->buf + to->len);
*buf0=(dec1)guess;
}
dcarry= *start1;
start1++;
}

View File

@ -127,13 +127,13 @@
%define distro_description Oracle Enterprise Linux 4
%define distro_releasetag oel4
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
%define distro_requires chkconfig coreutils grep procps shadow-utils
%define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%if "%oelver" == "5"
%define distro_description Oracle Enterprise Linux 5
%define distro_releasetag oel5
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
%define distro_requires chkconfig coreutils grep procps shadow-utils
%define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%{error:Oracle Enterprise Linux %{oelver} is unsupported}
%endif
@ -145,13 +145,13 @@
%define distro_description Red Hat Enterprise Linux 4
%define distro_releasetag rhel4
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
%define distro_requires chkconfig coreutils grep procps shadow-utils
%define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%if "%rhelver" == "5"
%define distro_description Red Hat Enterprise Linux 5
%define distro_releasetag rhel5
%define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
%define distro_requires chkconfig coreutils grep procps shadow-utils
%define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
%else
%{error:Red Hat Enterprise Linux %{rhelver} is unsupported}
%endif
@ -721,13 +721,12 @@ else
fi
# echo "Analyzed: SERVER_TO_START=$SERVER_TO_START"
if [ ! -d $mysql_datadir/mysql ] ; then
mkdir $mysql_datadir/mysql;
mkdir $mysql_datadir/mysql $mysql_datadir/test
echo "MySQL RPM installation of version $NEW_VERSION" >> $STATUS_FILE
else
# If the directory exists, we may assume it is an upgrade.
echo "MySQL RPM upgrade to version $NEW_VERSION" >> $STATUS_FILE
fi
if [ ! -d $mysql_datadir/test ] ; then mkdir $mysql_datadir/test; fi
# ----------------------------------------------------------------------
# Make MySQL start/shutdown automatically when the machine does it.
@ -762,7 +761,12 @@ chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
# ----------------------------------------------------------------------
# Initiate databases if needed
# ----------------------------------------------------------------------
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
if ! grep '^MySQL RPM upgrade' $STATUS_FILE >/dev/null 2>&1 ; then
# Fix bug#45415: no "mysql_install_db" on an upgrade
# Do this as a negative to err towards more "install" runs
# rather than to miss one.
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
fi
# ----------------------------------------------------------------------
# Upgrade databases if needed would go here - but it cannot be automated yet
@ -1117,6 +1121,7 @@ echo "=====" >> $STATUS_HISTORY
# ----------------------------------------------------------------------------
%files -n MySQL-embedded%{product_suffix}
%defattr(-, root, root, 0755)
%attr(755, root, root) %{_bindir}/mysql_embedded
%attr(644, root, root) %{_libdir}/mysql/libmysqld.a
%attr(644, root, root) %{_libdir}/mysql/libmysqld-debug.a
@ -1126,6 +1131,17 @@ echo "=====" >> $STATUS_HISTORY
# merging BK trees)
##############################################################################
%changelog
* Thu Jul 21 2011 Sunanda Menon <sunanda.menon@oracle.com>
- Fix bug#12561297: Added the MySQL embedded binary
* Thu Jul 07 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
- Fix bug#45415: "rpm upgrade recreates test database"
Let the creation of the "test" database happen only during a new installation,
not in an RPM upgrade.
This affects both the "mkdir" and the call of "mysql_install_db".
* Thu Feb 09 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
- Fix bug#56581: If an installation deviates from the default file locations

View File

@ -18596,12 +18596,9 @@ static void test_bug38486(void)
static void test_bug33831(void)
{
MYSQL *l_mysql;
my_bool error;
DBUG_ENTER("test_bug33831");
error= 0;
if (!(l_mysql= mysql_client_init(NULL)))
{
myerror("mysql_client_init() failed");
@ -18623,7 +18620,6 @@ static void test_bug33831(void)
DIE_UNLESS(0);
}
mysql_close(l_mysql);
DBUG_VOID_RETURN;
@ -19664,6 +19660,34 @@ static void test_bug12337762()
DBUG_VOID_RETURN;
}
/*
BUG 11754979 - 46675: ON DUPLICATE KEY UPDATE AND UPDATECOUNT() POSSIBLY WRONG
*/
static void test_bug11754979()
{
MYSQL* conn;
DBUG_ENTER("test_bug11754979");
myheader("test_bug11754979");
DIE_UNLESS((conn= mysql_client_init(NULL)));
DIE_UNLESS(mysql_real_connect(conn, opt_host, opt_user,
opt_password, opt_db ? opt_db:"test", opt_port,
opt_unix_socket, CLIENT_FOUND_ROWS));
myquery(mysql_query(conn, "DROP TABLE IF EXISTS t1"));
myquery(mysql_query(conn, "CREATE TABLE t1(id INT, label CHAR(1), PRIMARY KEY(id))"));
myquery(mysql_query(conn, "INSERT INTO t1(id, label) VALUES (1, 'a')"));
myquery(mysql_query(conn, "INSERT INTO t1(id, label) VALUES (1, 'a') "
"ON DUPLICATE KEY UPDATE id = 4"));
DIE_UNLESS(mysql_affected_rows(conn) == 2);
myquery(mysql_query(conn, "DROP TABLE t1"));
mysql_close(conn);
DBUG_VOID_RETURN;
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
@ -20009,6 +20033,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug56976", test_bug56976 },
{ "test_bug11766854", test_bug11766854 },
{ "test_bug12337762", test_bug12337762 },
{ "test_bug11754979", test_bug11754979 },
{ 0, 0 }
};

View File

@ -34,8 +34,7 @@ int with_my_thread_init=0;
*/
pthread_handler_t test_lf_pinbox(void *arg)
{
int m= *(int *)arg;
int32 x= 0;
int m= *(int *)arg;
LF_PINS *pins;
if (with_my_thread_init)
@ -43,7 +42,7 @@ pthread_handler_t test_lf_pinbox(void *arg)
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
for (x= ((int)(intptr)(&m)); m ; m--)
for (; m ; m--)
{
lf_pinbox_put_pins(pins);
pins= lf_pinbox_get_pins(&lf_allocator.pinbox);