mirror of
https://github.com/MariaDB/server.git
synced 2025-11-09 11:41:36 +03:00
Merge bugteam trunk and local.
This commit is contained in:
@@ -61,7 +61,7 @@ static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
|
|||||||
#ifdef HAVE_NCURSES_H
|
#ifdef HAVE_NCURSES_H
|
||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
#endif
|
#endif
|
||||||
/* Solaris's term.h does horrid things. */
|
/* Don't use Solaris's term.h. */
|
||||||
#if (defined(HAVE_TERM_H) && !defined(__SunOS))
|
#if (defined(HAVE_TERM_H) && !defined(__SunOS))
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -720,3 +720,11 @@ connection con1;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
disconnect con1;
|
disconnect con1;
|
||||||
connection default;
|
connection default;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#44151 using handler commands on information_schema tables crashes server
|
||||||
|
#
|
||||||
|
USE information_schema;
|
||||||
|
--error ER_WRONG_USAGE
|
||||||
|
HANDLER COLUMNS OPEN;
|
||||||
|
USE test;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ DROP TABLE IF EXISTS t1, t2;
|
|||||||
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
|
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
4181000
|
4201000
|
||||||
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
|
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
|
||||||
|
# Begin cleanup
|
||||||
|
SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
set @@read_buffer_size=default;
|
|
||||||
|
|||||||
@@ -1,3 +1,37 @@
|
|||||||
select des_encrypt('hello');
|
select des_encrypt('hello');
|
||||||
des_encrypt('hello')
|
des_encrypt('hello')
|
||||||
<EFBFBD><EFBFBD>2nV<6E><56>}
|
<EFBFBD><EFBFBD>2nV<6E><56>}
|
||||||
|
#
|
||||||
|
# Bug #11643: des_encrypt() causes server to die
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (des VARBINARY(200) NOT NULL DEFAULT '') ENGINE=MyISAM;
|
||||||
|
INSERT INTO t1 VALUES ('1234'), ('12345'), ('123456'), ('1234567');
|
||||||
|
UPDATE t1 SET des=DES_ENCRYPT('1234');
|
||||||
|
SELECT LENGTH(des) FROM t1;
|
||||||
|
LENGTH(des)
|
||||||
|
9
|
||||||
|
9
|
||||||
|
9
|
||||||
|
9
|
||||||
|
SELECT DES_DECRYPT(des) FROM t1;
|
||||||
|
DES_DECRYPT(des)
|
||||||
|
1234
|
||||||
|
1234
|
||||||
|
1234
|
||||||
|
1234
|
||||||
|
SELECT
|
||||||
|
LENGTH(DES_ENCRYPT('1234')),
|
||||||
|
LENGTH(DES_ENCRYPT('12345')),
|
||||||
|
LENGTH(DES_ENCRYPT('123456')),
|
||||||
|
LENGTH(DES_ENCRYPT('1234567'));
|
||||||
|
LENGTH(DES_ENCRYPT('1234')) LENGTH(DES_ENCRYPT('12345')) LENGTH(DES_ENCRYPT('123456')) LENGTH(DES_ENCRYPT('1234567'))
|
||||||
|
9 9 9 9
|
||||||
|
SELECT
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('1234')),
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('12345')),
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('123456')),
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('1234567'));
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('1234')) DES_DECRYPT(DES_ENCRYPT('12345')) DES_DECRYPT(DES_ENCRYPT('123456')) DES_DECRYPT(DES_ENCRYPT('1234567'))
|
||||||
|
1234 12345 123456 1234567
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
|||||||
@@ -739,3 +739,7 @@ handler t1 read a next;
|
|||||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||||
handler t1 close;
|
handler t1 close;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
USE information_schema;
|
||||||
|
HANDLER COLUMNS OPEN;
|
||||||
|
ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
|
||||||
|
USE test;
|
||||||
|
|||||||
@@ -737,3 +737,7 @@ handler t1 read a next;
|
|||||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||||
handler t1 close;
|
handler t1 close;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
USE information_schema;
|
||||||
|
HANDLER COLUMNS OPEN;
|
||||||
|
ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
|
||||||
|
USE test;
|
||||||
|
|||||||
@@ -38,3 +38,10 @@ a
|
|||||||
11
|
11
|
||||||
7
|
7
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (a int, b int) engine=myisam;
|
||||||
|
create table t2 (c int, d int, key (c)) engine=innodb;
|
||||||
|
insert into t1 values (1,1);
|
||||||
|
insert into t2 values (1,2);
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
|
||||||
|
drop table t1, t2;
|
||||||
|
|||||||
@@ -1736,36 +1736,36 @@ select count(*) from t1 where x = 18446744073709551601;
|
|||||||
count(*)
|
count(*)
|
||||||
1
|
1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
show status like "Innodb_buffer_pool_pages_total";
|
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
|
||||||
Variable_name Value
|
variable_value
|
||||||
Innodb_buffer_pool_pages_total 512
|
512
|
||||||
show status like "Innodb_page_size";
|
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
|
||||||
Variable_name Value
|
variable_value
|
||||||
Innodb_page_size 16384
|
16384
|
||||||
show status like "Innodb_rows_deleted";
|
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
|
||||||
Variable_name Value
|
variable_value - @innodb_rows_deleted_orig
|
||||||
Innodb_rows_deleted 71
|
71
|
||||||
show status like "Innodb_rows_inserted";
|
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
|
||||||
Variable_name Value
|
variable_value - @innodb_rows_inserted_orig
|
||||||
Innodb_rows_inserted 1084
|
1084
|
||||||
show status like "Innodb_rows_updated";
|
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
|
||||||
Variable_name Value
|
variable_value - @innodb_rows_updated_orig
|
||||||
Innodb_rows_updated 885
|
885
|
||||||
show status like "Innodb_row_lock_waits";
|
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
|
||||||
Variable_name Value
|
variable_value - @innodb_row_lock_waits_orig
|
||||||
Innodb_row_lock_waits 0
|
0
|
||||||
show status like "Innodb_row_lock_current_waits";
|
SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
|
||||||
Variable_name Value
|
variable_value - @innodb_row_lock_current_waits_orig
|
||||||
Innodb_row_lock_current_waits 0
|
0
|
||||||
show status like "Innodb_row_lock_time";
|
SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
|
||||||
Variable_name Value
|
variable_value - @innodb_row_lock_time_orig
|
||||||
Innodb_row_lock_time 0
|
0
|
||||||
show status like "Innodb_row_lock_time_max";
|
SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
|
||||||
Variable_name Value
|
variable_value - @innodb_row_lock_time_max_orig
|
||||||
Innodb_row_lock_time_max 0
|
0
|
||||||
show status like "Innodb_row_lock_time_avg";
|
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
|
||||||
Variable_name Value
|
variable_value - @innodb_row_lock_time_avg_orig
|
||||||
Innodb_row_lock_time_avg 0
|
0
|
||||||
show variables like "innodb_sync_spin_loops";
|
show variables like "innodb_sync_spin_loops";
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
innodb_sync_spin_loops 20
|
innodb_sync_spin_loops 20
|
||||||
|
|||||||
@@ -2115,4 +2115,16 @@ insert into m1 (col1) values (1);
|
|||||||
insert into m1 (col1) values (1);
|
insert into m1 (col1) values (1);
|
||||||
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
|
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
|
||||||
drop table m1, t1;
|
drop table m1, t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
col1 INT(10)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
CREATE VIEW v1 as SELECT * FROM t1;
|
||||||
|
CREATE TABLE m1 (
|
||||||
|
col1 INT(10)
|
||||||
|
)ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(v1);
|
||||||
|
#Select should detect that the child table is a view and fail.
|
||||||
|
SELECT * FROM m1;
|
||||||
|
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE m1, t1;
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
|
|||||||
@@ -10,5 +10,4 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
rpl_binlog_corruption : BUG#41793 2008-12-30 sven rpl_binlog_corruption disabled in main (needs new mtr)
|
|
||||||
rpl_cross_version : BUG#42311 2009-03-27 joro rpl_cross_version fails on macosx
|
rpl_cross_version : BUG#42311 2009-03-27 joro rpl_cross_version fails on macosx
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ source include/setup_fake_relay_log.inc;
|
|||||||
|
|
||||||
--echo ==== Test ====
|
--echo ==== Test ====
|
||||||
START SLAVE SQL_THREAD;
|
START SLAVE SQL_THREAD;
|
||||||
|
let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
|
||||||
source include/wait_for_slave_sql_error.inc;
|
source include/wait_for_slave_sql_error.inc;
|
||||||
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
|
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
|
||||||
--echo Last_SQL_Error = $error
|
--echo Last_SQL_Error = $error
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#
|
# Bug #958 a big table without indices and select with group by doesnt work
|
||||||
# this is a test for error 1032 in count(distinct) + group by, introduced in
|
# this is a test for error 1032 in count(distinct) + group by, introduced in
|
||||||
# mysql-4.1
|
# mysql-4.1
|
||||||
#
|
#
|
||||||
@@ -21,27 +21,16 @@ while ($1)
|
|||||||
INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
|
INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
|
||||||
dec $1;
|
dec $1;
|
||||||
}
|
}
|
||||||
set @@read_buffer_size=2*1024*1024;
|
|
||||||
CREATE TABLE t2 SELECT * FROM t1;
|
# We increase the size of t1 here.
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
SET @orig_myisam_sort_buffer_size = @@session.myisam_sort_buffer_size;
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
SET session myisam_sort_buffer_size=20000000;
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
INSERT INTO t1
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
SELECT A.id, A.grp, A.id_rev
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
FROM
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
t1 A,
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
(SELECT * FROM t1 B LIMIT 100) B,
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
(SELECT * FROM t1 Z LIMIT 42) Z;
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
|
||||||
INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
|
|
||||||
INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
|
|
||||||
DROP TABLE t2;
|
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
|
|
||||||
SELECT COUNT(*) FROM t1;
|
SELECT COUNT(*) FROM t1;
|
||||||
@@ -49,12 +38,12 @@ SELECT COUNT(*) FROM t1;
|
|||||||
# As t1 contains random numbers, results are different from test to test.
|
# As t1 contains random numbers, results are different from test to test.
|
||||||
# That's okay, because we test only that select doesn't yield an
|
# That's okay, because we test only that select doesn't yield an
|
||||||
# error. Note, that --disable_result_log doesn't suppress error output.
|
# error. Note, that --disable_result_log doesn't suppress error output.
|
||||||
|
|
||||||
--disable_result_log
|
--disable_result_log
|
||||||
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
|
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
|
||||||
--enable_result_log
|
--enable_result_log
|
||||||
|
|
||||||
|
--echo # Begin cleanup
|
||||||
|
SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
set @@read_buffer_size=default;
|
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|||||||
@@ -9,3 +9,31 @@
|
|||||||
select des_encrypt('hello');
|
select des_encrypt('hello');
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #11643: des_encrypt() causes server to die
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (des VARBINARY(200) NOT NULL DEFAULT '') ENGINE=MyISAM;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES ('1234'), ('12345'), ('123456'), ('1234567');
|
||||||
|
|
||||||
|
UPDATE t1 SET des=DES_ENCRYPT('1234');
|
||||||
|
|
||||||
|
SELECT LENGTH(des) FROM t1;
|
||||||
|
SELECT DES_DECRYPT(des) FROM t1;
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
LENGTH(DES_ENCRYPT('1234')),
|
||||||
|
LENGTH(DES_ENCRYPT('12345')),
|
||||||
|
LENGTH(DES_ENCRYPT('123456')),
|
||||||
|
LENGTH(DES_ENCRYPT('1234567'));
|
||||||
|
SELECT
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('1234')),
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('12345')),
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('123456')),
|
||||||
|
DES_DECRYPT(DES_ENCRYPT('1234567'));
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--Echo End of 5.0 tests
|
||||||
|
|||||||
@@ -53,3 +53,16 @@ drop table t1;
|
|||||||
connection default;
|
connection default;
|
||||||
disconnect a;
|
disconnect a;
|
||||||
disconnect b;
|
disconnect b;
|
||||||
|
|
||||||
|
# Bug 39320
|
||||||
|
create table t1 (a int, b int) engine=myisam;
|
||||||
|
create table t2 (c int, d int, key (c)) engine=innodb;
|
||||||
|
insert into t1 values (1,1);
|
||||||
|
insert into t2 values (1,2);
|
||||||
|
connect (a,localhost,root,,);
|
||||||
|
connection a;
|
||||||
|
set session transaction isolation level read committed;
|
||||||
|
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
|
||||||
|
connection default;
|
||||||
|
disconnect a;
|
||||||
|
drop table t1, t2;
|
||||||
|
|||||||
@@ -6,22 +6,45 @@
|
|||||||
# Use innodb_mysql.[test|result] files instead. #
|
# Use innodb_mysql.[test|result] files instead. #
|
||||||
# #
|
# #
|
||||||
# If nevertheless you need to make some changes here, please, forward #
|
# If nevertheless you need to make some changes here, please, forward #
|
||||||
# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com #
|
# your commit message #
|
||||||
|
# To: innodb_dev_ww@oracle.com #
|
||||||
|
# Cc: dev-innodb@mysql.com #
|
||||||
# (otherwise your changes may be erased). #
|
# (otherwise your changes may be erased). #
|
||||||
# #
|
# #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
|
|
||||||
#
|
# Save the original values of some variables in order to be able to
|
||||||
# Small basic test with ignore
|
# estimate how much they have changed during the tests. Previously this
|
||||||
#
|
# test assumed that e.g. rows_deleted is 0 here and after deleting 23
|
||||||
|
# rows it expected that rows_deleted will be 23. Now we do not make
|
||||||
|
# assumptions about the values of the variables at the beginning, e.g.
|
||||||
|
# rows_deleted should be 23 + "rows_deleted before the test". This allows
|
||||||
|
# the test to be run multiple times without restarting the mysqld server.
|
||||||
|
# See Bug#43309 Test main.innodb can't be run twice
|
||||||
|
-- disable_query_log
|
||||||
|
SET @innodb_thread_concurrency_orig = @@innodb_thread_concurrency;
|
||||||
|
|
||||||
|
SET @innodb_rows_deleted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted');
|
||||||
|
SET @innodb_rows_inserted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted');
|
||||||
|
SET @innodb_rows_updated_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated');
|
||||||
|
SET @innodb_row_lock_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits');
|
||||||
|
SET @innodb_row_lock_current_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits');
|
||||||
|
SET @innodb_row_lock_time_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time');
|
||||||
|
SET @innodb_row_lock_time_max_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max');
|
||||||
|
SET @innodb_row_lock_time_avg_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg');
|
||||||
|
-- enable_query_log
|
||||||
|
|
||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1,t2,t3,t4;
|
drop table if exists t1,t2,t3,t4;
|
||||||
drop database if exists mysqltest;
|
drop database if exists mysqltest;
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
|
||||||
|
#
|
||||||
|
# Small basic test with ignore
|
||||||
|
#
|
||||||
|
|
||||||
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
|
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
|
||||||
|
|
||||||
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
|
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
|
||||||
@@ -1294,18 +1317,18 @@ drop table t1;
|
|||||||
|
|
||||||
# Test for testable InnoDB status variables. This test
|
# Test for testable InnoDB status variables. This test
|
||||||
# uses previous ones(pages_created, rows_deleted, ...).
|
# uses previous ones(pages_created, rows_deleted, ...).
|
||||||
show status like "Innodb_buffer_pool_pages_total";
|
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
|
||||||
show status like "Innodb_page_size";
|
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
|
||||||
show status like "Innodb_rows_deleted";
|
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
|
||||||
show status like "Innodb_rows_inserted";
|
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
|
||||||
show status like "Innodb_rows_updated";
|
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
|
||||||
|
|
||||||
# Test for row locks InnoDB status variables.
|
# Test for row locks InnoDB status variables.
|
||||||
show status like "Innodb_row_lock_waits";
|
SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
|
||||||
show status like "Innodb_row_lock_current_waits";
|
SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
|
||||||
show status like "Innodb_row_lock_time";
|
SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
|
||||||
show status like "Innodb_row_lock_time_max";
|
SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
|
||||||
show status like "Innodb_row_lock_time_avg";
|
SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
|
||||||
|
|
||||||
# Test for innodb_sync_spin_loops variable
|
# Test for innodb_sync_spin_loops variable
|
||||||
show variables like "innodb_sync_spin_loops";
|
show variables like "innodb_sync_spin_loops";
|
||||||
@@ -2524,6 +2547,8 @@ DROP TABLE bug35537;
|
|||||||
DISCONNECT c1;
|
DISCONNECT c1;
|
||||||
CONNECTION default;
|
CONNECTION default;
|
||||||
|
|
||||||
|
SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig;
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# #
|
# #
|
||||||
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
|
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
|
||||||
@@ -2532,7 +2557,9 @@ CONNECTION default;
|
|||||||
# Use innodb_mysql.[test|result] files instead. #
|
# Use innodb_mysql.[test|result] files instead. #
|
||||||
# #
|
# #
|
||||||
# If nevertheless you need to make some changes here, please, forward #
|
# If nevertheless you need to make some changes here, please, forward #
|
||||||
# your commit message To: dev@innodb.com Cc: dev-innodb@mysql.com #
|
# your commit message #
|
||||||
|
# To: innodb_dev_ww@oracle.com #
|
||||||
|
# Cc: dev-innodb@mysql.com #
|
||||||
# (otherwise your changes may be erased). #
|
# (otherwise your changes may be erased). #
|
||||||
# #
|
# #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|||||||
@@ -1514,4 +1514,25 @@ insert into m1 (col1) values (1);
|
|||||||
insert into m1 (col1) values (1);
|
insert into m1 (col1) values (1);
|
||||||
|
|
||||||
drop table m1, t1;
|
drop table m1, t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
#Bug #44040 MySQL allows creating a MERGE table upon VIEWs but crashes
|
||||||
|
#when using it
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
col1 INT(10)
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
CREATE VIEW v1 as SELECT * FROM t1;
|
||||||
|
CREATE TABLE m1 (
|
||||||
|
col1 INT(10)
|
||||||
|
)ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(v1);
|
||||||
|
|
||||||
|
--echo #Select should detect that the child table is a view and fail.
|
||||||
|
--error ER_WRONG_MRG_TABLE
|
||||||
|
SELECT * FROM m1;
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE m1, t1;
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
|||||||
@@ -504,17 +504,21 @@ String *Item_func_des_encrypt::val_str(String *str)
|
|||||||
string marking change of string length.
|
string marking change of string length.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tail= (8-(res_length) % 8); // 1..8 marking extra length
|
tail= 8 - (res_length % 8); // 1..8 marking extra length
|
||||||
res_length+=tail;
|
res_length+=tail;
|
||||||
|
tmp_arg.realloc(res_length);
|
||||||
|
tmp_arg.length(0);
|
||||||
|
tmp_arg.append(res->ptr(), res->length());
|
||||||
code= ER_OUT_OF_RESOURCES;
|
code= ER_OUT_OF_RESOURCES;
|
||||||
if (tail && res->append(append_str, tail) || tmp_value.alloc(res_length+1))
|
if (tmp_arg.append(append_str, tail) || tmp_value.alloc(res_length+1))
|
||||||
goto error;
|
goto error;
|
||||||
(*res)[res_length-1]=tail; // save extra length
|
tmp_arg[res_length-1]=tail; // save extra length
|
||||||
|
tmp_value.realloc(res_length+1);
|
||||||
tmp_value.length(res_length+1);
|
tmp_value.length(res_length+1);
|
||||||
tmp_value[0]=(char) (128 | key_number);
|
tmp_value[0]=(char) (128 | key_number);
|
||||||
// Real encryption
|
// Real encryption
|
||||||
bzero((char*) &ivec,sizeof(ivec));
|
bzero((char*) &ivec,sizeof(ivec));
|
||||||
DES_ede3_cbc_encrypt((const uchar*) (res->ptr()),
|
DES_ede3_cbc_encrypt((const uchar*) (tmp_arg.ptr()),
|
||||||
(uchar*) (tmp_value.ptr()+1),
|
(uchar*) (tmp_value.ptr()+1),
|
||||||
res_length,
|
res_length,
|
||||||
&keyschedule.ks1,
|
&keyschedule.ks1,
|
||||||
|
|||||||
@@ -293,13 +293,17 @@ public:
|
|||||||
|
|
||||||
class Item_func_des_encrypt :public Item_str_func
|
class Item_func_des_encrypt :public Item_str_func
|
||||||
{
|
{
|
||||||
String tmp_value;
|
String tmp_value,tmp_arg;
|
||||||
public:
|
public:
|
||||||
Item_func_des_encrypt(Item *a) :Item_str_func(a) {}
|
Item_func_des_encrypt(Item *a) :Item_str_func(a) {}
|
||||||
Item_func_des_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
Item_func_des_encrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{ maybe_null=1; max_length = args[0]->max_length+8; }
|
{
|
||||||
|
maybe_null=1;
|
||||||
|
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
|
||||||
|
max_length = args[0]->max_length + 9;
|
||||||
|
}
|
||||||
const char *func_name() const { return "des_encrypt"; }
|
const char *func_name() const { return "des_encrypt"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -310,7 +314,12 @@ public:
|
|||||||
Item_func_des_decrypt(Item *a) :Item_str_func(a) {}
|
Item_func_des_decrypt(Item *a) :Item_str_func(a) {}
|
||||||
Item_func_des_decrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
Item_func_des_decrypt(Item *a, Item *b): Item_str_func(a,b) {}
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec() { maybe_null=1; max_length = args[0]->max_length; }
|
void fix_length_and_dec()
|
||||||
|
{
|
||||||
|
maybe_null=1;
|
||||||
|
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
|
||||||
|
max_length = args[0]->max_length - 9;
|
||||||
|
}
|
||||||
const char *func_name() const { return "des_decrypt"; }
|
const char *func_name() const { return "des_decrypt"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3843,6 +3843,16 @@ retry:
|
|||||||
|
|
||||||
if (share->is_view)
|
if (share->is_view)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
If parent_l of the table_list is non null then a merge table
|
||||||
|
has this view as child table, which is not supported.
|
||||||
|
*/
|
||||||
|
if (table_list->parent_l)
|
||||||
|
{
|
||||||
|
my_error(ER_WRONG_MRG_TABLE, MYF(0));
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This table is a view. Validate its metadata version: in particular,
|
This table is a view. Validate its metadata version: in particular,
|
||||||
that it was a view when the statement was prepared.
|
that it was a view when the statement was prepared.
|
||||||
|
|||||||
@@ -199,6 +199,14 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
|||||||
tables->db, tables->table_name, tables->alias,
|
tables->db, tables->table_name, tables->alias,
|
||||||
(int) reopen));
|
(int) reopen));
|
||||||
|
|
||||||
|
if (tables->schema_table)
|
||||||
|
{
|
||||||
|
my_error(ER_WRONG_USAGE, MYF(0), "HANDLER OPEN",
|
||||||
|
INFORMATION_SCHEMA_NAME.str);
|
||||||
|
DBUG_PRINT("exit",("ERROR"));
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if (! hash_inited(&thd->handler_tables_hash))
|
if (! hash_inited(&thd->handler_tables_hash))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -8260,6 +8260,14 @@ static MYSQL_SYSVAR_BOOL(stats_on_metadata, innobase_stats_on_metadata,
|
|||||||
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
|
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
|
||||||
NULL, NULL, TRUE);
|
NULL, NULL, TRUE);
|
||||||
|
|
||||||
|
static MYSQL_SYSVAR_BOOL(use_legacy_cardinality_algorithm,
|
||||||
|
srv_use_legacy_cardinality_algorithm,
|
||||||
|
PLUGIN_VAR_OPCMDARG,
|
||||||
|
"Use legacy algorithm for picking random pages during index cardinality "
|
||||||
|
"estimation. Disable this to use a better algorithm, but note that your "
|
||||||
|
"query plans may change (enabled by default).",
|
||||||
|
NULL, NULL, TRUE);
|
||||||
|
|
||||||
static MYSQL_SYSVAR_BOOL(adaptive_hash_index, innobase_adaptive_hash_index,
|
static MYSQL_SYSVAR_BOOL(adaptive_hash_index, innobase_adaptive_hash_index,
|
||||||
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
||||||
"Enable InnoDB adaptive hash index (enabled by default). "
|
"Enable InnoDB adaptive hash index (enabled by default). "
|
||||||
@@ -8395,6 +8403,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
|
|||||||
MYSQL_SYSVAR(open_files),
|
MYSQL_SYSVAR(open_files),
|
||||||
MYSQL_SYSVAR(rollback_on_timeout),
|
MYSQL_SYSVAR(rollback_on_timeout),
|
||||||
MYSQL_SYSVAR(stats_on_metadata),
|
MYSQL_SYSVAR(stats_on_metadata),
|
||||||
|
MYSQL_SYSVAR(use_legacy_cardinality_algorithm),
|
||||||
MYSQL_SYSVAR(adaptive_hash_index),
|
MYSQL_SYSVAR(adaptive_hash_index),
|
||||||
MYSQL_SYSVAR(status_file),
|
MYSQL_SYSVAR(status_file),
|
||||||
MYSQL_SYSVAR(support_xa),
|
MYSQL_SYSVAR(support_xa),
|
||||||
|
|||||||
@@ -656,6 +656,21 @@ struct row_prebuilt_struct {
|
|||||||
This eliminates lock waits in some
|
This eliminates lock waits in some
|
||||||
cases; note that this breaks
|
cases; note that this breaks
|
||||||
serializability. */
|
serializability. */
|
||||||
|
ulint new_rec_locks; /* normally 0; if
|
||||||
|
srv_locks_unsafe_for_binlog is
|
||||||
|
TRUE or session is using READ
|
||||||
|
COMMITTED isolation level, in a
|
||||||
|
cursor search, if we set a new
|
||||||
|
record lock on an index, this is
|
||||||
|
incremented; this is used in
|
||||||
|
releasing the locks under the
|
||||||
|
cursors if we are performing an
|
||||||
|
UPDATE and we determine after
|
||||||
|
retrieving the row that it does
|
||||||
|
not need to be locked; thus,
|
||||||
|
these can be used to implement a
|
||||||
|
'mini-rollback' that releases
|
||||||
|
the latest record locks */
|
||||||
ulint mysql_prefix_len;/* byte offset of the end of
|
ulint mysql_prefix_len;/* byte offset of the end of
|
||||||
the last requested column */
|
the last requested column */
|
||||||
ulint mysql_row_len; /* length in bytes of a row in the
|
ulint mysql_row_len; /* length in bytes of a row in the
|
||||||
|
|||||||
@@ -235,6 +235,12 @@ extern ulint srv_read_ahead_seq;
|
|||||||
/* variable to count the number of random read-aheads were done */
|
/* variable to count the number of random read-aheads were done */
|
||||||
extern ulint srv_read_ahead_rnd;
|
extern ulint srv_read_ahead_rnd;
|
||||||
|
|
||||||
|
/* An option to enable the fix for "Bug#43660 SHOW INDEXES/ANALYZE does
|
||||||
|
NOT update cardinality for indexes of InnoDB table". By default we are
|
||||||
|
running with the fix disabled because MySQL 5.1 is frozen for such
|
||||||
|
behavioral changes. */
|
||||||
|
extern char srv_use_legacy_cardinality_algorithm;
|
||||||
|
|
||||||
/* In this structure we store status variables to be passed to MySQL */
|
/* In this structure we store status variables to be passed to MySQL */
|
||||||
typedef struct export_var_struct export_struc;
|
typedef struct export_var_struct export_struc;
|
||||||
|
|
||||||
|
|||||||
@@ -21,34 +21,6 @@ Created 3/26/1996 Heikki Tuuri
|
|||||||
|
|
||||||
extern ulint trx_n_mysql_transactions;
|
extern ulint trx_n_mysql_transactions;
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Resets the new record lock info in a transaction struct. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
trx_reset_new_rec_lock_info(
|
|
||||||
/*========================*/
|
|
||||||
trx_t* trx); /* in: transaction struct */
|
|
||||||
/*****************************************************************
|
|
||||||
Registers that we have set a new record lock on an index. We only have space
|
|
||||||
to store 2 indexes! If this is called to store more than 2 indexes after
|
|
||||||
trx_reset_new_rec_lock_info(), then this function does nothing. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
trx_register_new_rec_lock(
|
|
||||||
/*======================*/
|
|
||||||
trx_t* trx, /* in: transaction struct */
|
|
||||||
dict_index_t* index); /* in: trx sets a new record lock on this
|
|
||||||
index */
|
|
||||||
/*****************************************************************
|
|
||||||
Checks if trx has set a new record lock on an index. */
|
|
||||||
UNIV_INLINE
|
|
||||||
ibool
|
|
||||||
trx_new_rec_locks_contain(
|
|
||||||
/*======================*/
|
|
||||||
/* out: TRUE if trx has set a new record lock
|
|
||||||
on index */
|
|
||||||
trx_t* trx, /* in: transaction struct */
|
|
||||||
dict_index_t* index); /* in: index */
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Releases the search latch if trx has reserved it. */
|
Releases the search latch if trx has reserved it. */
|
||||||
|
|
||||||
@@ -527,20 +499,6 @@ struct trx_struct{
|
|||||||
lock_t* auto_inc_lock; /* possible auto-inc lock reserved by
|
lock_t* auto_inc_lock; /* possible auto-inc lock reserved by
|
||||||
the transaction; note that it is also
|
the transaction; note that it is also
|
||||||
in the lock list trx_locks */
|
in the lock list trx_locks */
|
||||||
dict_index_t* new_rec_locks[2];/* these are normally NULL; if
|
|
||||||
srv_locks_unsafe_for_binlog is TRUE
|
|
||||||
or session is using READ COMMITTED
|
|
||||||
isolation level,
|
|
||||||
in a cursor search, if we set a new
|
|
||||||
record lock on an index, this is set
|
|
||||||
to point to the index; this is
|
|
||||||
used in releasing the locks under the
|
|
||||||
cursors if we are performing an UPDATE
|
|
||||||
and we determine after retrieving
|
|
||||||
the row that it does not need to be
|
|
||||||
locked; thus, these can be used to
|
|
||||||
implement a 'mini-rollback' that
|
|
||||||
releases the latest record locks */
|
|
||||||
UT_LIST_NODE_T(trx_t)
|
UT_LIST_NODE_T(trx_t)
|
||||||
trx_list; /* list of transactions */
|
trx_list; /* list of transactions */
|
||||||
UT_LIST_NODE_T(trx_t)
|
UT_LIST_NODE_T(trx_t)
|
||||||
|
|||||||
@@ -38,61 +38,3 @@ trx_start_if_not_started_low(
|
|||||||
trx_start_low(trx, ULINT_UNDEFINED);
|
trx_start_low(trx, ULINT_UNDEFINED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Resets the new record lock info in a transaction struct. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
trx_reset_new_rec_lock_info(
|
|
||||||
/*========================*/
|
|
||||||
trx_t* trx) /* in: transaction struct */
|
|
||||||
{
|
|
||||||
trx->new_rec_locks[0] = NULL;
|
|
||||||
trx->new_rec_locks[1] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Registers that we have set a new record lock on an index. We only have space
|
|
||||||
to store 2 indexes! If this is called to store more than 2 indexes after
|
|
||||||
trx_reset_new_rec_lock_info(), then this function does nothing. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
trx_register_new_rec_lock(
|
|
||||||
/*======================*/
|
|
||||||
trx_t* trx, /* in: transaction struct */
|
|
||||||
dict_index_t* index) /* in: trx sets a new record lock on this
|
|
||||||
index */
|
|
||||||
{
|
|
||||||
if (trx->new_rec_locks[0] == NULL) {
|
|
||||||
trx->new_rec_locks[0] = index;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trx->new_rec_locks[0] == index) {
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trx->new_rec_locks[1] != NULL) {
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
trx->new_rec_locks[1] = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Checks if trx has set a new record lock on an index. */
|
|
||||||
UNIV_INLINE
|
|
||||||
ibool
|
|
||||||
trx_new_rec_locks_contain(
|
|
||||||
/*======================*/
|
|
||||||
/* out: TRUE if trx has set a new record lock
|
|
||||||
on index */
|
|
||||||
trx_t* trx, /* in: transaction struct */
|
|
||||||
dict_index_t* index) /* in: index */
|
|
||||||
{
|
|
||||||
return(trx->new_rec_locks[0] == index
|
|
||||||
|| trx->new_rec_locks[1] == index);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1970,12 +1970,6 @@ lock_rec_lock_fast(
|
|||||||
if (lock == NULL) {
|
if (lock == NULL) {
|
||||||
if (!impl) {
|
if (!impl) {
|
||||||
lock_rec_create(mode, rec, index, trx);
|
lock_rec_create(mode, rec, index, trx);
|
||||||
|
|
||||||
if (srv_locks_unsafe_for_binlog
|
|
||||||
|| trx->isolation_level
|
|
||||||
== TRX_ISO_READ_COMMITTED) {
|
|
||||||
trx_register_new_rec_lock(trx, index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@@ -1999,11 +1993,6 @@ lock_rec_lock_fast(
|
|||||||
|
|
||||||
if (!lock_rec_get_nth_bit(lock, heap_no)) {
|
if (!lock_rec_get_nth_bit(lock, heap_no)) {
|
||||||
lock_rec_set_nth_bit(lock, heap_no);
|
lock_rec_set_nth_bit(lock, heap_no);
|
||||||
if (srv_locks_unsafe_for_binlog
|
|
||||||
|| trx->isolation_level
|
|
||||||
== TRX_ISO_READ_COMMITTED) {
|
|
||||||
trx_register_new_rec_lock(trx, index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2058,22 +2047,12 @@ lock_rec_lock_slow(
|
|||||||
enough already granted on the record, we have to wait. */
|
enough already granted on the record, we have to wait. */
|
||||||
|
|
||||||
err = lock_rec_enqueue_waiting(mode, rec, index, thr);
|
err = lock_rec_enqueue_waiting(mode, rec, index, thr);
|
||||||
|
|
||||||
if (srv_locks_unsafe_for_binlog
|
|
||||||
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) {
|
|
||||||
trx_register_new_rec_lock(trx, index);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!impl) {
|
if (!impl) {
|
||||||
/* Set the requested lock on the record */
|
/* Set the requested lock on the record */
|
||||||
|
|
||||||
lock_rec_add_to_queue(LOCK_REC | mode, rec, index,
|
lock_rec_add_to_queue(LOCK_REC | mode, rec, index,
|
||||||
trx);
|
trx);
|
||||||
if (srv_locks_unsafe_for_binlog
|
|
||||||
|| trx->isolation_level
|
|
||||||
== TRX_ISO_READ_COMMITTED) {
|
|
||||||
trx_register_new_rec_lock(trx, index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = DB_SUCCESS;
|
err = DB_SUCCESS;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ Created 10/4/1994 Heikki Tuuri
|
|||||||
#include "mtr0log.h"
|
#include "mtr0log.h"
|
||||||
#include "log0recv.h"
|
#include "log0recv.h"
|
||||||
#include "rem0cmp.h"
|
#include "rem0cmp.h"
|
||||||
|
#include "srv0srv.h"
|
||||||
|
#include "ut0ut.h"
|
||||||
|
|
||||||
static ulint page_rnd = 976722341;
|
static ulint page_rnd = 976722341;
|
||||||
|
|
||||||
@@ -23,6 +25,44 @@ static ulint page_rnd = 976722341;
|
|||||||
ulint page_cur_short_succ = 0;
|
ulint page_cur_short_succ = 0;
|
||||||
# endif /* UNIV_SEARCH_PERF_STAT */
|
# endif /* UNIV_SEARCH_PERF_STAT */
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
This is a linear congruential generator PRNG. Returns a pseudo random
|
||||||
|
number between 0 and 2^64-1 inclusive. The formula and the constants
|
||||||
|
being used are:
|
||||||
|
X[n+1] = (a * X[n] + c) mod m
|
||||||
|
where:
|
||||||
|
X[0] = ut_usectime()
|
||||||
|
a = 1103515245 (3^5 * 5 * 7 * 129749)
|
||||||
|
c = 12345 (3 * 5 * 823)
|
||||||
|
m = 18446744073709551616 (2^64)
|
||||||
|
*/
|
||||||
|
#define LCG_a 1103515245
|
||||||
|
#define LCG_c 12345
|
||||||
|
static
|
||||||
|
unsigned long long
|
||||||
|
page_cur_lcg_prng()
|
||||||
|
/*===============*/
|
||||||
|
/* out: number between 0 and 2^64-1 */
|
||||||
|
{
|
||||||
|
static unsigned long long lcg_current = 0;
|
||||||
|
static ibool initialized = FALSE;
|
||||||
|
ulint time_sec;
|
||||||
|
ulint time_ms;
|
||||||
|
|
||||||
|
if (!initialized) {
|
||||||
|
ut_usectime(&time_sec, &time_ms);
|
||||||
|
lcg_current = (unsigned long long) (time_sec * 1000000
|
||||||
|
+ time_ms);
|
||||||
|
initialized = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no need to "% 2^64" explicitly because lcg_current is
|
||||||
|
64 bit and this will be done anyway */
|
||||||
|
lcg_current = LCG_a * lcg_current + LCG_c;
|
||||||
|
|
||||||
|
return(lcg_current);
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Tries a search shortcut based on the last insert. */
|
Tries a search shortcut based on the last insert. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
@@ -493,9 +533,13 @@ page_cur_open_on_rnd_user_rec(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
page_rnd += 87584577;
|
if (srv_use_legacy_cardinality_algorithm) {
|
||||||
|
page_rnd += 87584577;
|
||||||
|
|
||||||
rnd = page_rnd % page_get_n_recs(page);
|
rnd = page_rnd % page_get_n_recs(page);
|
||||||
|
} else {
|
||||||
|
rnd = (ulint) page_cur_lcg_prng() % page_get_n_recs(page);
|
||||||
|
}
|
||||||
|
|
||||||
rec = page_get_infimum_rec(page);
|
rec = page_get_infimum_rec(page);
|
||||||
|
|
||||||
@@ -1437,3 +1481,30 @@ page_cur_delete_rec(
|
|||||||
page_dir_balance_slot(page, cur_slot_no);
|
page_dir_balance_slot(page, cur_slot_no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_COMPILE_TEST_FUNCS
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
Print the first n numbers, generated by page_cur_lcg_prng() to make sure
|
||||||
|
(visually) that it works properly. */
|
||||||
|
void
|
||||||
|
test_page_cur_lcg_prng(
|
||||||
|
/*===================*/
|
||||||
|
int n) /* in: print first n numbers */
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
unsigned long long rnd;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
rnd = page_cur_lcg_prng();
|
||||||
|
printf("%llu\t%%2=%llu %%3=%llu %%5=%llu %%7=%llu %%11=%llu\n",
|
||||||
|
rnd,
|
||||||
|
rnd % 2,
|
||||||
|
rnd % 3,
|
||||||
|
rnd % 5,
|
||||||
|
rnd % 7,
|
||||||
|
rnd % 11);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* UNIV_COMPILE_TEST_FUNCS */
|
||||||
|
|||||||
@@ -1476,12 +1476,9 @@ row_unlock_for_mysql(
|
|||||||
and clust_pcur, and we do not need to
|
and clust_pcur, and we do not need to
|
||||||
reposition the cursors. */
|
reposition the cursors. */
|
||||||
{
|
{
|
||||||
dict_index_t* index;
|
|
||||||
btr_pcur_t* pcur = prebuilt->pcur;
|
btr_pcur_t* pcur = prebuilt->pcur;
|
||||||
btr_pcur_t* clust_pcur = prebuilt->clust_pcur;
|
btr_pcur_t* clust_pcur = prebuilt->clust_pcur;
|
||||||
trx_t* trx = prebuilt->trx;
|
trx_t* trx = prebuilt->trx;
|
||||||
rec_t* rec;
|
|
||||||
mtr_t mtr;
|
|
||||||
|
|
||||||
ut_ad(prebuilt && trx);
|
ut_ad(prebuilt && trx);
|
||||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||||
@@ -1501,9 +1498,12 @@ row_unlock_for_mysql(
|
|||||||
|
|
||||||
trx->op_info = "unlock_row";
|
trx->op_info = "unlock_row";
|
||||||
|
|
||||||
index = btr_pcur_get_btr_cur(pcur)->index;
|
if (prebuilt->new_rec_locks >= 1) {
|
||||||
|
|
||||||
if (index != NULL && trx_new_rec_locks_contain(trx, index)) {
|
rec_t* rec;
|
||||||
|
dict_index_t* index;
|
||||||
|
dulint rec_trx_id;
|
||||||
|
mtr_t mtr;
|
||||||
|
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
@@ -1514,43 +1514,64 @@ row_unlock_for_mysql(
|
|||||||
}
|
}
|
||||||
|
|
||||||
rec = btr_pcur_get_rec(pcur);
|
rec = btr_pcur_get_rec(pcur);
|
||||||
|
index = btr_pcur_get_btr_cur(pcur)->index;
|
||||||
|
|
||||||
lock_rec_unlock(trx, rec, prebuilt->select_lock_type);
|
if (prebuilt->new_rec_locks >= 2) {
|
||||||
|
/* Restore the cursor position and find the record
|
||||||
|
in the clustered index. */
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
if (!has_latches_on_recs) {
|
||||||
|
btr_pcur_restore_position(BTR_SEARCH_LEAF,
|
||||||
|
clust_pcur, &mtr);
|
||||||
|
}
|
||||||
|
|
||||||
/* If the search was done through the clustered index, then
|
rec = btr_pcur_get_rec(clust_pcur);
|
||||||
we have not used clust_pcur at all, and we must NOT try to
|
index = btr_pcur_get_btr_cur(clust_pcur)->index;
|
||||||
reset locks on clust_pcur. The values in clust_pcur may be
|
|
||||||
garbage! */
|
|
||||||
|
|
||||||
if (index->type & DICT_CLUSTERED) {
|
|
||||||
|
|
||||||
goto func_exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
index = btr_pcur_get_btr_cur(clust_pcur)->index;
|
|
||||||
|
|
||||||
if (index != NULL && trx_new_rec_locks_contain(trx, index)) {
|
|
||||||
|
|
||||||
mtr_start(&mtr);
|
|
||||||
|
|
||||||
/* Restore the cursor position and find the record */
|
|
||||||
|
|
||||||
if (!has_latches_on_recs) {
|
|
||||||
btr_pcur_restore_position(BTR_SEARCH_LEAF, clust_pcur,
|
|
||||||
&mtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rec = btr_pcur_get_rec(clust_pcur);
|
/* If the record has been modified by this
|
||||||
|
transaction, do not unlock it. */
|
||||||
|
ut_a(index->type & DICT_CLUSTERED);
|
||||||
|
|
||||||
lock_rec_unlock(trx, rec, prebuilt->select_lock_type);
|
if (index->trx_id_offset) {
|
||||||
|
rec_trx_id = trx_read_trx_id(rec
|
||||||
|
+ index->trx_id_offset);
|
||||||
|
} else {
|
||||||
|
mem_heap_t* heap = NULL;
|
||||||
|
ulint offsets_[REC_OFFS_NORMAL_SIZE];
|
||||||
|
ulint* offsets = offsets_;
|
||||||
|
|
||||||
|
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
|
||||||
|
offsets = rec_get_offsets(rec, index, offsets,
|
||||||
|
ULINT_UNDEFINED, &heap);
|
||||||
|
|
||||||
|
rec_trx_id = row_get_rec_trx_id(rec, index, offsets);
|
||||||
|
|
||||||
|
if (UNIV_LIKELY_NULL(heap)) {
|
||||||
|
mem_heap_free(heap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ut_dulint_cmp(rec_trx_id, trx->id) != 0) {
|
||||||
|
/* We did not update the record: unlock it */
|
||||||
|
|
||||||
|
rec = btr_pcur_get_rec(pcur);
|
||||||
|
index = btr_pcur_get_btr_cur(pcur)->index;
|
||||||
|
|
||||||
|
lock_rec_unlock(trx, rec, prebuilt->select_lock_type);
|
||||||
|
|
||||||
|
if (prebuilt->new_rec_locks >= 2) {
|
||||||
|
rec = btr_pcur_get_rec(clust_pcur);
|
||||||
|
index = btr_pcur_get_btr_cur(clust_pcur)->index;
|
||||||
|
|
||||||
|
lock_rec_unlock(trx, rec,
|
||||||
|
prebuilt->select_lock_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
func_exit:
|
|
||||||
trx->op_info = "";
|
trx->op_info = "";
|
||||||
|
|
||||||
return(DB_SUCCESS);
|
return(DB_SUCCESS);
|
||||||
|
|||||||
@@ -2901,8 +2901,9 @@ row_sel_get_clust_rec_for_mysql(
|
|||||||
func_exit:
|
func_exit:
|
||||||
*out_rec = clust_rec;
|
*out_rec = clust_rec;
|
||||||
|
|
||||||
if (prebuilt->select_lock_type == LOCK_X) {
|
if (prebuilt->select_lock_type != LOCK_NONE) {
|
||||||
/* We may use the cursor in update: store its position */
|
/* We may use the cursor in update or in unlock_row():
|
||||||
|
store its position */
|
||||||
|
|
||||||
btr_pcur_store_position(prebuilt->clust_pcur, mtr);
|
btr_pcur_store_position(prebuilt->clust_pcur, mtr);
|
||||||
}
|
}
|
||||||
@@ -3303,13 +3304,7 @@ row_search_for_mysql(
|
|||||||
is set or session is using a READ COMMITED isolation level. Then
|
is set or session is using a READ COMMITED isolation level. Then
|
||||||
we are able to remove the record locks set here on an individual
|
we are able to remove the record locks set here on an individual
|
||||||
row. */
|
row. */
|
||||||
|
prebuilt->new_rec_locks = 0;
|
||||||
if ((srv_locks_unsafe_for_binlog
|
|
||||||
|| trx->isolation_level == TRX_ISO_READ_COMMITTED)
|
|
||||||
&& prebuilt->select_lock_type != LOCK_NONE) {
|
|
||||||
|
|
||||||
trx_reset_new_rec_lock_info(trx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/* PHASE 1: Try to pop the row from the prefetch cache */
|
/* PHASE 1: Try to pop the row from the prefetch cache */
|
||||||
@@ -3951,6 +3946,12 @@ no_gap_lock:
|
|||||||
switch (err) {
|
switch (err) {
|
||||||
rec_t* old_vers;
|
rec_t* old_vers;
|
||||||
case DB_SUCCESS:
|
case DB_SUCCESS:
|
||||||
|
if (srv_locks_unsafe_for_binlog
|
||||||
|
|| trx->isolation_level == TRX_ISO_READ_COMMITTED) {
|
||||||
|
/* Note that a record of
|
||||||
|
prebuilt->index was locked. */
|
||||||
|
prebuilt->new_rec_locks = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DB_LOCK_WAIT:
|
case DB_LOCK_WAIT:
|
||||||
if (UNIV_LIKELY(prebuilt->row_read_type
|
if (UNIV_LIKELY(prebuilt->row_read_type
|
||||||
@@ -3981,7 +3982,7 @@ no_gap_lock:
|
|||||||
if (UNIV_LIKELY(trx->wait_lock != NULL)) {
|
if (UNIV_LIKELY(trx->wait_lock != NULL)) {
|
||||||
lock_cancel_waiting_and_release(
|
lock_cancel_waiting_and_release(
|
||||||
trx->wait_lock);
|
trx->wait_lock);
|
||||||
trx_reset_new_rec_lock_info(trx);
|
prebuilt->new_rec_locks = 0;
|
||||||
} else {
|
} else {
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
|
|
||||||
@@ -3993,6 +3994,9 @@ no_gap_lock:
|
|||||||
ULINT_UNDEFINED,
|
ULINT_UNDEFINED,
|
||||||
&heap);
|
&heap);
|
||||||
err = DB_SUCCESS;
|
err = DB_SUCCESS;
|
||||||
|
/* Note that a record of
|
||||||
|
prebuilt->index was locked. */
|
||||||
|
prebuilt->new_rec_locks = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
@@ -4142,6 +4146,15 @@ requires_clust_rec:
|
|||||||
goto next_rec;
|
goto next_rec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((srv_locks_unsafe_for_binlog
|
||||||
|
|| trx->isolation_level == TRX_ISO_READ_COMMITTED)
|
||||||
|
&& prebuilt->select_lock_type != LOCK_NONE) {
|
||||||
|
/* Note that both the secondary index record
|
||||||
|
and the clustered index record were locked. */
|
||||||
|
ut_ad(prebuilt->new_rec_locks == 1);
|
||||||
|
prebuilt->new_rec_locks = 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) {
|
if (UNIV_UNLIKELY(rec_get_deleted_flag(clust_rec, comp))) {
|
||||||
|
|
||||||
/* The record is delete marked: we can skip it */
|
/* The record is delete marked: we can skip it */
|
||||||
@@ -4267,13 +4280,7 @@ next_rec:
|
|||||||
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
|
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
|
||||||
}
|
}
|
||||||
did_semi_consistent_read = FALSE;
|
did_semi_consistent_read = FALSE;
|
||||||
|
prebuilt->new_rec_locks = 0;
|
||||||
if (UNIV_UNLIKELY(srv_locks_unsafe_for_binlog
|
|
||||||
|| trx->isolation_level == TRX_ISO_READ_COMMITTED)
|
|
||||||
&& prebuilt->select_lock_type != LOCK_NONE) {
|
|
||||||
|
|
||||||
trx_reset_new_rec_lock_info(trx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
/* PHASE 5: Move the cursor to the next index record */
|
/* PHASE 5: Move the cursor to the next index record */
|
||||||
@@ -4379,7 +4386,7 @@ lock_wait_or_error:
|
|||||||
rec_loop we will again try to set a lock, and
|
rec_loop we will again try to set a lock, and
|
||||||
new_rec_lock_info in trx will be right at the end. */
|
new_rec_lock_info in trx will be right at the end. */
|
||||||
|
|
||||||
trx_reset_new_rec_lock_info(trx);
|
prebuilt->new_rec_locks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode = pcur->search_mode;
|
mode = pcur->search_mode;
|
||||||
|
|||||||
@@ -256,6 +256,12 @@ ulint srv_read_ahead_seq = 0;
|
|||||||
/* variable to count the number of random read-aheads */
|
/* variable to count the number of random read-aheads */
|
||||||
ulint srv_read_ahead_rnd = 0;
|
ulint srv_read_ahead_rnd = 0;
|
||||||
|
|
||||||
|
/* An option to enable the fix for "Bug#43660 SHOW INDEXES/ANALYZE does
|
||||||
|
NOT update cardinality for indexes of InnoDB table". By default we are
|
||||||
|
running with the fix disabled because MySQL 5.1 is frozen for such
|
||||||
|
behavioral changes. */
|
||||||
|
char srv_use_legacy_cardinality_algorithm = TRUE;
|
||||||
|
|
||||||
/* structure to pass status variables to MySQL */
|
/* structure to pass status variables to MySQL */
|
||||||
export_struc export_vars;
|
export_struc export_vars;
|
||||||
|
|
||||||
|
|||||||
@@ -192,8 +192,6 @@ trx_create(
|
|||||||
|
|
||||||
trx->n_autoinc_rows = 0;
|
trx->n_autoinc_rows = 0;
|
||||||
|
|
||||||
trx_reset_new_rec_lock_info(trx);
|
|
||||||
|
|
||||||
return(trx);
|
return(trx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1375,7 +1375,7 @@ BackupRestore::logEntry(const LogEntry & tup)
|
|||||||
NdbTransaction * trans = m_ndb->startTransaction();
|
NdbTransaction * trans = m_ndb->startTransaction();
|
||||||
if (trans == NULL)
|
if (trans == NULL)
|
||||||
{
|
{
|
||||||
// Deep shit, TODO: handle the error
|
// TODO: handle the error
|
||||||
err << "Cannot start transaction" << endl;
|
err << "Cannot start transaction" << endl;
|
||||||
exitHandler();
|
exitHandler();
|
||||||
} // if
|
} // if
|
||||||
@@ -1524,7 +1524,7 @@ BackupRestore::tuple(const TupleS & tup)
|
|||||||
NdbTransaction * trans = m_ndb->startTransaction();
|
NdbTransaction * trans = m_ndb->startTransaction();
|
||||||
if (trans == NULL)
|
if (trans == NULL)
|
||||||
{
|
{
|
||||||
// Deep shit, TODO: handle the error
|
// TODO: handle the error
|
||||||
ndbout << "Cannot start transaction" << endl;
|
ndbout << "Cannot start transaction" << endl;
|
||||||
exitHandler();
|
exitHandler();
|
||||||
} // if
|
} // if
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ BackupRestore::tuple(const TupleS & tup)
|
|||||||
NdbTransaction * trans = m_ndb->startTransaction();
|
NdbTransaction * trans = m_ndb->startTransaction();
|
||||||
if (trans == NULL)
|
if (trans == NULL)
|
||||||
{
|
{
|
||||||
// Deep shit, TODO: handle the error
|
// TODO: handle the error
|
||||||
ndbout << "Cannot start transaction" << endl;
|
ndbout << "Cannot start transaction" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} // if
|
} // if
|
||||||
@@ -463,7 +463,7 @@ BackupRestore::logEntry(const LogEntry & tup)
|
|||||||
NdbTransaction * trans = m_ndb->startTransaction();
|
NdbTransaction * trans = m_ndb->startTransaction();
|
||||||
if (trans == NULL)
|
if (trans == NULL)
|
||||||
{
|
{
|
||||||
// Deep shit, TODO: handle the error
|
// TODO: handle the error
|
||||||
ndbout << "Cannot start transaction" << endl;
|
ndbout << "Cannot start transaction" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
} // if
|
} // if
|
||||||
|
|||||||
Reference in New Issue
Block a user