mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Merge trift2.:/MySQL/M51/mysql-5.1
into trift2.:/MySQL/M51/push-5.1
This commit is contained in:
commit
d77ab7a009
105 changed files with 39604 additions and 1951 deletions
|
@ -379,6 +379,7 @@ client/mysqltestmanager-pwgen
|
|||
client/mysqltestmanagerc
|
||||
client/mysys_priv.h
|
||||
client/readline.cpp
|
||||
client/rpl_constants.h
|
||||
client/select_test
|
||||
client/sql_string.cpp
|
||||
client/ssl_test
|
||||
|
@ -1347,10 +1348,15 @@ mysql-test/suite/funcs_1/r/myisam_trig_03e.warnings
|
|||
mysql-test/suite/funcs_1/r/myisam_views.warnings
|
||||
mysql-test/suite/funcs_1/r/ndb_trig_03e.warnings
|
||||
mysql-test/suite/funcs_1/r/ndb_views.warnings
|
||||
mysql-test/suite/partitions/r/dif
|
||||
mysql-test/suite/partitions/r/diff
|
||||
mysql-test/suite/partitions/r/partition.result
|
||||
mysql-test/suite/partitions/r/partition_bit_ndb.warnings
|
||||
mysql-test/suite/partitions/r/partition_special_innodb.warnings
|
||||
mysql-test/suite/partitions/r/partition_special_myisam.warnings
|
||||
mysql-test/suite/partitions/r/partition_t55.out
|
||||
mysql-test/suite/partitions/r/partition_t55.refout
|
||||
mysql-test/suite/partitions/t/partition.test
|
||||
mysql-test/t/index_merge.load
|
||||
mysql-test/t/tmp.test
|
||||
mysql-test/var
|
||||
|
@ -2956,4 +2962,3 @@ win/vs71cache.txt
|
|||
win/vs8cache.txt
|
||||
zlib/*.ds?
|
||||
zlib/*.vcproj
|
||||
client/rpl_constants.h
|
||||
|
|
|
@ -10,16 +10,25 @@ AC_SUBST([zlib_dir])
|
|||
mysql_cv_compress="yes"
|
||||
])
|
||||
|
||||
dnl Auxiliary macro to check for zlib at given path
|
||||
dnl Auxiliary macro to check for zlib at given path.
|
||||
dnl We are strict with the server, as "archive" engine
|
||||
dnl needs zlibCompileFlags(), but for client only we
|
||||
dnl are less strict, and take the zlib we find.
|
||||
|
||||
AC_DEFUN([MYSQL_CHECK_ZLIB_DIR], [
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
CPPFLAGS="$ZLIB_INCLUDES $CPPFLAGS"
|
||||
LIBS="$LIBS $ZLIB_LIBS"
|
||||
if test X"$with_server" = Xno
|
||||
then
|
||||
zlibsym=zlibVersion
|
||||
else
|
||||
zlibsym=zlibCompileFlags
|
||||
fi
|
||||
AC_CACHE_VAL([mysql_cv_compress],
|
||||
[AC_TRY_LINK([#include <zlib.h>],
|
||||
[return zlibCompileFlags();],
|
||||
[return $zlibsym();],
|
||||
[mysql_cv_compress="yes"
|
||||
AC_MSG_RESULT([ok])],
|
||||
[mysql_cv_compress="no"])
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
. updated with each new version --- THIS IS INTENDED!
|
||||
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
funcs_1 checked with version: 5.1.16
|
||||
funcs_1 checked with version: 5.1.17
|
||||
Warnings:
|
||||
Warning 1548 Leading spaces are removed from name ' '
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
################################################################################
|
||||
# t/partition_supported_sql_funcs.inc # #
|
||||
# t/partition_supported_sql_funcs.inc # # #
|
||||
# Purpose: #
|
||||
# Tests around sql functions #
|
||||
# Tests frame for allowed sql functions #
|
||||
# #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
|
@ -83,24 +83,23 @@ eval insert into t3 values ($val1);
|
|||
eval insert into t3 values ($val2);
|
||||
eval insert into t3 values ($val3);
|
||||
|
||||
eval insert into t4 values (1,$val1);
|
||||
eval insert into t4 values (2,$val2);
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t4;
|
||||
|
||||
eval insert into t5 values (1,$val1);
|
||||
eval insert into t5 values (2,$val2);
|
||||
eval insert into t5 values (3,$val3);
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t5;
|
||||
|
||||
eval insert into t6 values (1,$val2);
|
||||
eval insert into t6 values (2,$val3);
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t6;
|
||||
|
||||
eval select $sqlfunc from t1;
|
||||
eval select $sqlfunc from t1 order by col1;
|
||||
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t3;
|
||||
select * from t4;
|
||||
select * from t5;
|
||||
select * from t6;
|
||||
select * from t1 order by col1;
|
||||
select * from t2 order by col1;
|
||||
select * from t3 order by col1;
|
||||
select * from t4 order by colint;
|
||||
select * from t5 order by colint;
|
||||
select * from t6 order by colint;
|
||||
|
||||
if ($do_long_tests)
|
||||
{
|
||||
|
@ -111,12 +110,12 @@ if ($do_long_tests)
|
|||
eval update t5 set col1=$val4 where col1=$val1;
|
||||
eval update t6 set col1=$val4 where col1=$val1;
|
||||
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
select * from t3;
|
||||
select * from t4;
|
||||
select * from t5;
|
||||
select * from t6;
|
||||
select * from t1 order by col1;
|
||||
select * from t2 order by col1;
|
||||
select * from t3 order by col1;
|
||||
select * from t4 order by colint;
|
||||
select * from t5 order by colint;
|
||||
select * from t6 order by colint;
|
||||
}
|
||||
|
||||
--echo -------------------------------------------------------------------------
|
||||
|
@ -175,46 +174,63 @@ partition by range(colint)
|
|||
(partition p0 values less than ($valsqlfunc),
|
||||
partition p1 values less than maxvalue);
|
||||
|
||||
select * from t11;
|
||||
select * from t22;
|
||||
select * from t33;
|
||||
select * from t44;
|
||||
select * from t55;
|
||||
select * from t66;
|
||||
select * from t11 order by col1;
|
||||
select * from t22 order by col1;
|
||||
select * from t33 order by col1;
|
||||
select * from t44 order by colint;
|
||||
select * from t55 order by colint;
|
||||
select * from t66 order by colint;
|
||||
|
||||
if ($do_long_tests)
|
||||
{
|
||||
--echo ---------------------------
|
||||
--echo ---- some alter table begin
|
||||
--echo ---------------------------
|
||||
eval alter table t11
|
||||
reorganize partition p0,p1 into
|
||||
(partition s1 values less than maxvalue);
|
||||
select * from t11;
|
||||
select * from t11 order by col1;
|
||||
|
||||
eval alter table t11
|
||||
reorganize partition s1 into
|
||||
(partition p0 values less than (15),
|
||||
partition p1 values less than maxvalue);
|
||||
select * from t11;
|
||||
select * from t11 order by col1;
|
||||
|
||||
eval alter table t55
|
||||
partition by list(colint)
|
||||
subpartition by hash($sqlfunc) subpartitions 5
|
||||
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
|
||||
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
|
||||
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
|
||||
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
|
||||
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
|
||||
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
|
||||
);
|
||||
show create table t55;
|
||||
select * from t55 order by colint;
|
||||
|
||||
eval alter table t66
|
||||
reorganize partition p0,p1 into
|
||||
(partition s1 values less than maxvalue);
|
||||
select * from t66;
|
||||
select * from t66 order by colint;
|
||||
|
||||
eval alter table t66
|
||||
reorganize partition s1 into
|
||||
(partition p0 values less than ($valsqlfunc),
|
||||
partition p1 values less than maxvalue);
|
||||
select * from t66;
|
||||
select * from t66 order by colint;
|
||||
|
||||
eval alter table t66
|
||||
reorganize partition p0,p1 into
|
||||
(partition s1 values less than maxvalue);
|
||||
select * from t66;
|
||||
select * from t66 order by colint;
|
||||
|
||||
eval alter table t66
|
||||
add partition s0
|
||||
(partition p0 values less than ($valsqlfunc);
|
||||
select * fromt t66;
|
||||
eval alter table t66
|
||||
reorganize partition s1 into
|
||||
(partition p0 values less than ($valsqlfunc),
|
||||
partition p1 values less than maxvalue);
|
||||
select * from t66 order by colint;
|
||||
|
||||
let $t1=t1;
|
||||
let $t2=t2;
|
||||
|
@ -233,6 +249,9 @@ if ($do_long_tests)
|
|||
let $t6=t66;
|
||||
--source suite/partitions/include/partition_supported_sql_funcs_delete.inc
|
||||
# --source include/partition_supported_sql_funcs_delete.inc
|
||||
--echo -------------------------
|
||||
--echo ---- some alter table end
|
||||
--echo -------------------------
|
||||
}
|
||||
--disable_warnings
|
||||
drop table if exists t1 ;
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
################################################################################
|
||||
# t/partition_supported_sql_funcs_delete.inc # # #
|
||||
# Purpose: #
|
||||
# Delete access of the tests frame for allowed sql functions #
|
||||
# #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: HH #
|
||||
# Original Date: 2006-11-22 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
--echo -------------------------------------------------------------------------
|
||||
--echo --- Delete rows and partitions of tables with $sqlfunc
|
||||
--echo -------------------------------------------------------------------------
|
||||
|
@ -9,25 +22,25 @@ eval delete from $t4 where col1=$val2;
|
|||
eval delete from $t5 where col1=$val2;
|
||||
eval delete from $t6 where col1=$val2;
|
||||
|
||||
eval select * from $t1;
|
||||
eval select * from $t2;
|
||||
eval select * from $t3;
|
||||
eval select * from $t4;
|
||||
eval select * from $t5;
|
||||
eval select * from $t1 order by col1;
|
||||
eval select * from $t2 order by col1;
|
||||
eval select * from $t3 order by col1;
|
||||
eval select * from $t4 order by colint;
|
||||
eval select * from $t5 order by colint;
|
||||
|
||||
eval insert into $t1 values ($val2);
|
||||
eval insert into $t2 values ($val2);
|
||||
eval insert into $t3 values ($val2);
|
||||
eval insert into $t4 values (4,$val2);
|
||||
eval insert into $t5 values (4,$val2);
|
||||
eval insert into $t6 values (4,$val2);
|
||||
eval insert into $t4 values (60,$val2);
|
||||
eval insert into $t5 values (60,$val2);
|
||||
eval insert into $t6 values (60,$val2);
|
||||
|
||||
eval select * from $t1;
|
||||
eval select * from $t2;
|
||||
eval select * from $t3;
|
||||
eval select * from $t4;
|
||||
eval select * from $t5;
|
||||
eval select * from $t6;
|
||||
eval select * from $t1 order by col1;
|
||||
eval select * from $t2 order by col1;
|
||||
eval select * from $t3 order by col1;
|
||||
eval select * from $t4 order by colint;
|
||||
eval select * from $t5 order by colint;
|
||||
eval select * from $t6 order by colint;
|
||||
|
||||
eval alter table $t1 drop partition p0;
|
||||
eval alter table $t2 drop partition p0;
|
||||
|
@ -35,9 +48,9 @@ eval alter table $t4 drop partition p0;
|
|||
eval alter table $t5 drop partition p0;
|
||||
eval alter table $t6 drop partition p0;
|
||||
|
||||
eval select * from $t1;
|
||||
eval select * from $t2;
|
||||
eval select * from $t3;
|
||||
eval select * from $t4;
|
||||
eval select * from $t5;
|
||||
eval select * from $t6;
|
||||
eval select * from $t1 order by col1;
|
||||
eval select * from $t2 order by col1;
|
||||
eval select * from $t3 order by col1;
|
||||
eval select * from $t4 order by colint;
|
||||
eval select * from $t5 order by colint;
|
||||
eval select * from $t6 order by colint;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
1 1
|
||||
2 9
|
||||
3 3
|
||||
4 8
|
|
@ -0,0 +1,4 @@
|
|||
1 2006-02-03
|
||||
2 2006-01-17
|
||||
3 2006-01-25
|
||||
4 2006-02-05
|
|
@ -0,0 +1,4 @@
|
|||
1 5.1230
|
||||
2 13.345
|
||||
3 17.987
|
||||
4 15.654
|
|
@ -0,0 +1,45 @@
|
|||
1 5
|
||||
2 13
|
||||
3 15
|
||||
4 17
|
||||
5 23
|
||||
6 34
|
||||
7 56
|
||||
8 56
|
||||
9 45
|
||||
10 34
|
||||
11 78
|
||||
12 89
|
||||
13 67
|
||||
14 46
|
||||
15 34
|
||||
16 324
|
||||
17 345
|
||||
18 34
|
||||
19 78
|
||||
20 567
|
||||
21 4
|
||||
22 435
|
||||
23 34
|
||||
24 45
|
||||
25 4565
|
||||
26 4
|
||||
27 3
|
||||
28 2
|
||||
29 3
|
||||
30 5
|
||||
31 6
|
||||
32 8
|
||||
33 9
|
||||
34 745
|
||||
35 34
|
||||
36 34
|
||||
37 324
|
||||
38 67
|
||||
39 78
|
||||
40 89
|
||||
41 90
|
||||
42 78967
|
||||
50 56
|
||||
51 34
|
||||
55 123
|
|
@ -0,0 +1,4 @@
|
|||
1 09:09:15.000002
|
||||
2 04:30:01.000018
|
||||
3 00:59:22.000024
|
||||
4 05:30:34.000037
|
|
@ -2,7 +2,7 @@
|
|||
# t/partition_supported_sql_funcs_main.inc #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around sql functions #
|
||||
# Tests which SQL functions are allowed in partinioning clauses. #
|
||||
# #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
|
@ -11,12 +11,28 @@
|
|||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
# #
|
||||
# This test uses a test frame (partition_supported_sql_funcs.inc) for every #
|
||||
# SQL function allowed in the partitioning parts of CREATE and ALTE TABLE. #
|
||||
# The variales represent the #
|
||||
# - SQL function isself with a column (sqlfunc) and a literal (valsqlsunc), #
|
||||
# - the type of the column (coltype), #
|
||||
# - a file with test values of the coltype (infile) and #
|
||||
# - single test values (val1 to val4). #
|
||||
# The test frame includes CREATE/ALTER TABLE and some access statements. #
|
||||
# Column types are int, float(7,4), char(1), date and time depending on the #
|
||||
# SQL function. The test frame uses the include file #
|
||||
# "partition_supported_sql_funcs_delete.inc" testing the deletion of #
|
||||
# partitions. #
|
||||
# The CREATE and ALTER TABLE statement do not cover the complete partitions #
|
||||
# functions, but will ashure that the SQL functions are basically working. #
|
||||
################################################################################
|
||||
|
||||
|
||||
let $sqlfunc = abs(col1);
|
||||
let $valsqlfunc = abs(15);
|
||||
let $coltype = int;
|
||||
let $infile = partition_supported_sql_funcs_int_int.in;
|
||||
let $val1 = 5 ;
|
||||
let $val2 = 13 ;
|
||||
let $val3 = 17 ;
|
||||
|
@ -27,6 +43,7 @@ let $val4 = 15 ;
|
|||
let $sqlfunc = ascii(col1);
|
||||
let $valsqlfunc = ascii('5');
|
||||
let $coltype = char(1);
|
||||
let $infile = partition_supported_sql_funcs_int_ch1.in;
|
||||
let $val1 = '1';
|
||||
let $val2 = '9';
|
||||
let $val3 = '3';
|
||||
|
@ -37,6 +54,7 @@ let $val4 = '8';
|
|||
let $sqlfunc = cast(ceiling(col1) as signed integer);
|
||||
let $valsqlfunc = cast(ceiling(15) as signed integer);
|
||||
let $coltype = float(7,4);
|
||||
let $infile = partition_supported_sql_funcs_int_float.in;
|
||||
let $val1 = 5.1230;
|
||||
let $val2 = 13.345;
|
||||
let $val3 = 17.987;
|
||||
|
@ -47,6 +65,7 @@ let $val4 = 15.654 ;
|
|||
let $sqlfunc = cast(floor(col1) as signed);
|
||||
let $valsqlfunc = cast(floor(15.123) as signed);
|
||||
let $coltype = float(7,4);
|
||||
let $infile = partition_supported_sql_funcs_int_float.in;
|
||||
let $val1 = 5.1230;
|
||||
let $val2 = 13.345;
|
||||
let $val3 = 17.987;
|
||||
|
@ -57,6 +76,7 @@ let $val4 = 15.654 ;
|
|||
let $sqlfunc = cast(mod(col1,10) as signed);
|
||||
let $valsqlfunc = cast(mod(15,10) as signed);
|
||||
let $coltype = float(7,4);
|
||||
let $infile = partition_supported_sql_funcs_int_float.in;
|
||||
let $val1 = 5.0000;
|
||||
let $val2 = 19;
|
||||
let $val3 = 17;
|
||||
|
@ -67,6 +87,7 @@ let $val4 = 15 ;
|
|||
let $sqlfunc = ord(col1);
|
||||
let $valsqlfunc = ord('a');
|
||||
let $coltype = char(3);
|
||||
let $infile = partition_supported_sql_funcs_int_ch1.in;
|
||||
let $val1 = '1';
|
||||
let $val2 = '9';
|
||||
let $val3 = '3';
|
||||
|
@ -77,6 +98,7 @@ let $val4 = '8';
|
|||
let $sqlfunc = day(col1);
|
||||
let $valsqlfunc = day('2006-12-21');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-02-03';
|
||||
let $val2 = '2006-01-17';
|
||||
let $val3 = '2006-01-25';
|
||||
|
@ -87,6 +109,7 @@ let $val4 = '2006-02-05';
|
|||
let $sqlfunc = dayofmonth(col1);
|
||||
let $valsqlfunc = dayofmonth('2006-12-24');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-02-03';
|
||||
let $val2 = '2006-01-17';
|
||||
let $val3 = '2006-01-25';
|
||||
|
@ -97,6 +120,7 @@ let $val4 = '2006-02-05';
|
|||
let $sqlfunc = dayofweek(col1);
|
||||
let $valsqlfunc = dayofweek('2006-12-24');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-02-17';
|
||||
let $val3 = '2006-01-25';
|
||||
|
@ -107,6 +131,7 @@ let $val4 = '2006-02-05';
|
|||
let $sqlfunc = dayofyear(col1);
|
||||
let $valsqlfunc = dayofyear('2006-12-25');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-01-17';
|
||||
let $val3 = '2006-02-25';
|
||||
|
@ -120,6 +145,7 @@ let $coltype = char(30);
|
|||
let $sqlfunc = extract(month from col1);
|
||||
let $valsqlfunc = extract(year from '1998-11-23');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-02-17';
|
||||
let $val3 = '2006-01-25';
|
||||
|
@ -130,6 +156,7 @@ let $val4 = '2006-02-05';
|
|||
let $sqlfunc = hour(col1);
|
||||
let $valsqlfunc = hour('18:30');
|
||||
let $coltype = time;
|
||||
let $infile = partition_supported_sql_funcs_int_time.in;
|
||||
let $val1 = '09:09';
|
||||
let $val2 = '14:30';
|
||||
let $val3 = '21:59';
|
||||
|
@ -140,6 +167,7 @@ let $val4 = '10:30';
|
|||
let $sqlfunc = microsecond(col1);
|
||||
let $valsqlfunc = microsecond('10:30:10.000010');
|
||||
let $coltype = time;
|
||||
let $infile = partition_supported_sql_funcs_int_time.in;
|
||||
let $val1 = '09:09:15.000002';
|
||||
let $val2 = '04:30:01.000018';
|
||||
let $val3 = '00:59:22.000024';
|
||||
|
@ -160,6 +188,7 @@ let $val4 = '10:24:23';
|
|||
let $sqlfunc = second(col1);
|
||||
let $valsqlfunc = second('18:30:14');
|
||||
let $coltype = time;
|
||||
let $infile = partition_supported_sql_funcs_int_time.in;
|
||||
let $val1 = '09:09:09';
|
||||
let $val2 = '14:30:20';
|
||||
let $val3 = '21:59:22';
|
||||
|
@ -173,6 +202,7 @@ let $coltype = char(30);
|
|||
let $sqlfunc = month(col1);
|
||||
let $valsqlfunc = month('2006-10-14');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-12-17';
|
||||
let $val3 = '2006-05-25';
|
||||
|
@ -183,6 +213,7 @@ let $val4 = '2006-11-06';
|
|||
let $sqlfunc = quarter(col1);
|
||||
let $valsqlfunc = quarter('2006-10-14');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-12-17';
|
||||
let $val3 = '2006-09-25';
|
||||
|
@ -193,6 +224,7 @@ let $val4 = '2006-07-30';
|
|||
let $sqlfunc = time_to_sec(col1)-(time_to_sec(col1)-20);
|
||||
let $valsqlfunc = time_to_sec('18:30:14')-(time_to_sec('17:59:59'));
|
||||
let $coltype = time;
|
||||
let $infile = partition_supported_sql_funcs_int_time.in;
|
||||
let $val1 = '09:09:15';
|
||||
let $val2 = '14:30:45';
|
||||
let $val3 = '21:59:22';
|
||||
|
@ -203,6 +235,7 @@ let $val4 = '10:33:11';
|
|||
let $sqlfunc = to_days(col1)-to_days('2006-01-01');
|
||||
let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-02-03';
|
||||
let $val2 = '2006-01-17';
|
||||
let $val3 = '2006-01-25';
|
||||
|
@ -213,6 +246,7 @@ let $val4 = '2006-02-06';
|
|||
let $sqlfunc = weekday(col1);
|
||||
let $valsqlfunc = weekday('2006-10-14');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-12-03';
|
||||
let $val2 = '2006-11-17';
|
||||
let $val3 = '2006-05-25';
|
||||
|
@ -223,6 +257,7 @@ let $val4 = '2006-02-06';
|
|||
let $sqlfunc = weekofyear(col1);
|
||||
let $valsqlfunc = weekofyear('2006-02-14');
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-03-17';
|
||||
let $val3 = '2006-05-25';
|
||||
|
@ -233,6 +268,7 @@ let $val4 = '2006-09-06';
|
|||
let $sqlfunc = year(col1)-1990;
|
||||
let $valsqlfunc = year('2005-10-14')-1990;
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '1996-01-03';
|
||||
let $val2 = '2000-02-17';
|
||||
let $val3 = '2004-05-25';
|
||||
|
@ -243,6 +279,7 @@ let $val4 = '2002-02-15';
|
|||
let $sqlfunc = yearweek(col1)-200600;
|
||||
let $valsqlfunc = yearweek('2006-10-14')-200600;
|
||||
let $coltype = date;
|
||||
let $infile = partition_supported_sql_funcs_int_date.in;
|
||||
let $val1 = '2006-01-03';
|
||||
let $val2 = '2006-08-17';
|
||||
let $val3 = '2006-03-25';
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
13724
mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result
Normal file
13724
mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result
Normal file
File diff suppressed because it is too large
Load diff
68
mysql-test/suite/partitions/r/partition_t55.out
Normal file
68
mysql-test/suite/partitions/r/partition_t55.out
Normal file
|
@ -0,0 +1,68 @@
|
|||
show create table t55;
|
||||
Table Create Table
|
||||
t55 CREATE TABLE `t55` (
|
||||
`colint` int(11) DEFAULT NULL,
|
||||
`col1` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
|
||||
27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYI
|
||||
36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYI
|
||||
36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYI
|
||||
0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYI
|
||||
27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYI
|
||||
18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYI
|
||||
45 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYI
|
||||
0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYI
|
||||
0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYI
|
||||
0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYI
|
||||
0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYI
|
||||
0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYI
|
||||
9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYD
|
||||
1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYI
|
||||
8594 MYSQL_TEST_DIR/var/master-data/test/t55.frm
|
||||
408 MYSQL_TEST_DIR/var/master-data/test/t55.par
|
|
@ -13,4 +13,4 @@ partition_alter2_ndb : cannot create t1
|
|||
partition_char_innodb : crash. Bug? More investigations
|
||||
partition_sessions : needs system_3_init.inc
|
||||
partition_engine_ndb : cannot create t1
|
||||
|
||||
partition_supported_sql_func_ndb : cannot create t1
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# t/partition_supported_sql_funcs_innodb.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around sql functions #
|
||||
# INNODB branch #
|
||||
# Tests which SQL functions are allowed in partinioning clauses with #
|
||||
# INNODB. #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: HH #
|
||||
|
@ -18,16 +18,12 @@
|
|||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#
|
||||
# Please read the README at the end of include/partition.pre before changing
|
||||
# any of the variables.
|
||||
#
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# General not engine specific settings and requirements
|
||||
|
||||
##### Options, for debugging support #####
|
||||
let $debug= 0;
|
||||
let $do_long_tests= 0;
|
||||
let $do_long_tests= 1;
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# t/partition_supported_sql_funcs_myisam.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests around sql functions #
|
||||
# MyISAM branch #
|
||||
# Tests which SQL functions are allowed in partinioning clauses with #
|
||||
# MYISAM. #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: HH #
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
##### Options, for debugging support #####
|
||||
let $debug= 0;
|
||||
let $do_long_tests= 0;
|
||||
let $do_long_tests= 1;
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
################################################################################
|
||||
# t/partition_supported_sql_funcs_myisam.test #
|
||||
# #
|
||||
# Purpose: #
|
||||
# Tests which SQL functions are allowed in partinioning clauses with #
|
||||
# NDB. #
|
||||
# #
|
||||
#------------------------------------------------------------------------------#
|
||||
# Original Author: HH #
|
||||
# Original Date: 2006-11-22 #
|
||||
# Change Author: #
|
||||
# Change Date: #
|
||||
# Change: #
|
||||
################################################################################
|
||||
|
||||
#
|
||||
# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE !
|
||||
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
|
||||
# THE SOURCED FILES ONLY.
|
||||
#------------------------------------------------------------------------------#
|
||||
# General not engine specific settings and requirements
|
||||
|
||||
##### Options, for debugging support #####
|
||||
let $debug= 0;
|
||||
let $do_long_tests= 1;
|
||||
|
||||
# The server must support partitioning.
|
||||
--source include/have_partition.inc
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
# Engine specific settings and requirements
|
||||
|
||||
--source include/have_ndb.inc
|
||||
##### Storage engine to be tested
|
||||
let $engine= 'NDB';
|
||||
|
||||
#------------------------------------------------------------------------------#
|
||||
--source suite/partitions/include/partition_supported_sql_funcs_main.inc
|
||||
# --source include/partition_supported_sql_funcs_main.inc
|
||||
|
83
mysql-test/suite/row_lock/include/row_lock.inc
Normal file
83
mysql-test/suite/row_lock/include/row_lock.inc
Normal file
|
@ -0,0 +1,83 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
eval $indext2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP TABLE t1, t2;
|
||||
|
94
mysql-test/suite/row_lock/include/row_lock_big_tab.inc
Normal file
94
mysql-test/suite/row_lock/include/row_lock_big_tab.inc
Normal file
|
@ -0,0 +1,94 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
eval $indext2;
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT count(*)/2 INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT count(*)/2 INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
DELIMITER ;|
|
||||
CALL fill_t1 (10);
|
||||
CALL fill_t2 (10);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
# With the two separate selects (without join) the differs from
|
||||
# that select with join.
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT k from t1 WHERE k < half_t1();
|
||||
SELECT k from t1 WHERE k >= half_t1();
|
||||
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE t1, t2;
|
||||
#DROP VIEW v1;
|
||||
|
93
mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
Normal file
93
mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
Normal file
|
@ -0,0 +1,93 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
eval $indext2;
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
DELIMITER ;|
|
||||
eval CALL fill_t1 ($nbrows);
|
||||
eval CALL fill_t2 ($nbrows);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
# With the two separate selects (without join) the differs from
|
||||
# that select with join.
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
|
||||
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
|
||||
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
|
||||
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
93
mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
Normal file
93
mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
Normal file
|
@ -0,0 +1,93 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
eval $indext2;
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
DELIMITER ;|
|
||||
eval CALL fill_t1 ($nbrows);
|
||||
eval CALL fill_t2 ($nbrows);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
# With the two separate selects (without join) the differs from
|
||||
# that select with join.
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE;
|
||||
DELETE FROM t1 WHERE t1.k % 2 = 1;
|
||||
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
|
||||
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
|
||||
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
|
||||
SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
96
mysql-test/suite/row_lock/include/row_lock_trig.inc
Normal file
96
mysql-test/suite/row_lock/include/row_lock_trig.inc
Normal file
|
@ -0,0 +1,96 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
eval $indext2;
|
||||
DELIMITER |;
|
||||
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
# With the two separate selects (without join) the differs from
|
||||
# that select with join.
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP TABLE t1, t2;
|
||||
#DROP VIEW v1;
|
||||
|
89
mysql-test/suite/row_lock/include/row_lock_view.inc
Normal file
89
mysql-test/suite/row_lock/include/row_lock_view.inc
Normal file
|
@ -0,0 +1,89 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
eval $indext2;
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
# With the two separate selects (without join) the differs from
|
||||
# that select with join.
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE v1 SET i=325 where i=125;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE v1 SET i=323 where i=123;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE v1 SET i=326 where i=126;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE v1 SET i=324 where i=124;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE t1, t2;
|
||||
#DROP VIEW v1;
|
||||
|
92
mysql-test/suite/row_lock/include/row_lock_view_mix.inc
Normal file
92
mysql-test/suite/row_lock/include/row_lock_view_mix.inc
Normal file
|
@ -0,0 +1,92 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
eval $indext2;
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
# With the two separate selects (without join) the differs from
|
||||
# that select with join.
|
||||
|
||||
# Both transaction are able to update the tables
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
#UPDATE v1 SET i=325 where i=125;
|
||||
#SELECT * FROM v1 ORDER BY i,l;
|
||||
#SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE v1 SET i=323 where i=123;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE v1 SET i=324 where i=124;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE t1, t2;
|
||||
#DROP VIEW v1;
|
||||
|
126
mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
Normal file
126
mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
Normal file
|
@ -0,0 +1,126 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP PROCEDURE IF EXISTS stp_t;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
CONNECT (root2, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
INSERT INTO t1 VALUES (5,127,5,127);
|
||||
INSERT INTO t1 VALUES (6,128,6,128);
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
INSERT INTO t2 VALUES (5,127,5,127);
|
||||
INSERT INTO t2 VALUES (6,128,6,128);
|
||||
eval $indext2;
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
DELIMITER |;
|
||||
|
||||
CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
|
||||
BEGIN
|
||||
UPDATE t2 SET i = p2 WHERE i = p1;
|
||||
UPDATE v1 SET i = p2 WHERE i = p1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
END;
|
||||
|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
CALL stp_t (125, 225);
|
||||
|
||||
--echo connection root2;
|
||||
CONNECTION root2;
|
||||
CALL stp_t (127, 227);
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
CALL stp_t (123, 223);
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
CALL stp_t (126, 226);
|
||||
|
||||
--echo connection root2;
|
||||
CONNECTION root2;
|
||||
CALL stp_t (128, 228);
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
CALL stp_t (124, 224);
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root2;
|
||||
CONNECTION root2;
|
||||
DELETE FROM t1 WHERE t1.i=228;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
COMMIT;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
|
||||
--echo connection root2;
|
||||
CONNECTION root2;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root2;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
--disable_warnings
|
||||
DROP VIEW v1;
|
||||
DROP PROCEDURE stp_t;
|
||||
DROP TABLE t1, t2;
|
||||
--enable_warnings
|
99
mysql-test/suite/row_lock/include/row_lock_view_trig.inc
Normal file
99
mysql-test/suite/row_lock/include/row_lock_view_trig.inc
Normal file
|
@ -0,0 +1,99 @@
|
|||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
SET autocommit=0;
|
||||
# Create additional connections used through test
|
||||
CONNECT (root1, localhost, root,,);
|
||||
SET autocommit=0;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
eval $indext1;
|
||||
eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
eval $indext2;
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
DELIMITER |;
|
||||
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
eval EXPLAIN $select;
|
||||
eval $select;
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
COMMIT;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
|
||||
--echo connection root1;
|
||||
CONNECTION root1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
DISCONNECT root1;
|
||||
--echo connection default;
|
||||
CONNECTION default;
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
|
142
mysql-test/suite/row_lock/r/innodb_row_lock_1.result
Normal file
142
mysql-test/suite/row_lock/r/innodb_row_lock_1.result
Normal file
|
@ -0,0 +1,142 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
32
mysql-test/suite/row_lock/r/innodb_row_lock_2.result
Normal file
32
mysql-test/suite/row_lock/r/innodb_row_lock_2.result
Normal file
|
@ -0,0 +1,32 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
32
mysql-test/suite/row_lock/r/innodb_row_lock_3.result
Normal file
32
mysql-test/suite/row_lock/r/innodb_row_lock_3.result
Normal file
|
@ -0,0 +1,32 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
142
mysql-test/suite/row_lock/r/innodb_row_lock_4.result
Normal file
142
mysql-test/suite/row_lock/r/innodb_row_lock_4.result
Normal file
|
@ -0,0 +1,142 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
32
mysql-test/suite/row_lock/r/innodb_row_lock_5.result
Normal file
32
mysql-test/suite/row_lock/r/innodb_row_lock_5.result
Normal file
|
@ -0,0 +1,32 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
97
mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
Normal file
97
mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
Normal file
|
@ -0,0 +1,97 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT count(*)/2 INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT count(*)/2 INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CALL fill_t1 (10);
|
||||
CALL fill_t2 (10);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
connection root1;
|
||||
SELECT k from t1 WHERE k < half_t1();
|
||||
k
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT k from t1 WHERE k >= half_t1();
|
||||
k
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 1111 0 100
|
||||
1 1111 1 101
|
||||
2 1111 2 102
|
||||
3 1111 3 103
|
||||
4 1111 4 104
|
||||
5 105 5 105
|
||||
6 106 6 106
|
||||
7 107 7 107
|
||||
8 108 8 108
|
||||
9 109 9 109
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 2222 0 100
|
||||
1 2222 1 101
|
||||
2 2222 2 102
|
||||
3 2222 3 103
|
||||
4 2222 4 104
|
||||
5 105 5 105
|
||||
6 106 6 106
|
||||
7 107 7 107
|
||||
8 108 8 108
|
||||
9 109 9 109
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
|
145
mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
Normal file
145
mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
Normal file
|
@ -0,0 +1,145 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CALL fill_t1 (40);
|
||||
CALL fill_t2 (40);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
|
||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
i i
|
||||
100 100
|
||||
102 102
|
||||
104 104
|
||||
106 106
|
||||
108 108
|
||||
110 110
|
||||
112 112
|
||||
114 114
|
||||
116 116
|
||||
118 118
|
||||
120 120
|
||||
122 122
|
||||
124 124
|
||||
126 126
|
||||
128 128
|
||||
130 130
|
||||
132 132
|
||||
134 134
|
||||
136 136
|
||||
138 138
|
||||
connection root1;
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
i i
|
||||
101 101
|
||||
103 103
|
||||
105 105
|
||||
107 107
|
||||
109 109
|
||||
111 111
|
||||
113 113
|
||||
115 115
|
||||
117 117
|
||||
119 119
|
||||
121 121
|
||||
123 123
|
||||
125 125
|
||||
127 127
|
||||
129 129
|
||||
131 131
|
||||
133 133
|
||||
135 135
|
||||
137 137
|
||||
139 139
|
||||
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
|
||||
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 1111 1 101
|
||||
2 102 2 102
|
||||
3 1111 3 103
|
||||
4 104 4 104
|
||||
5 1111 5 105
|
||||
6 106 6 106
|
||||
7 1111 7 107
|
||||
8 108 8 108
|
||||
9 1111 9 109
|
||||
10 110 10 110
|
||||
11 1111 11 111
|
||||
12 112 12 112
|
||||
13 1111 13 113
|
||||
14 114 14 114
|
||||
15 1111 15 115
|
||||
16 116 16 116
|
||||
17 1111 17 117
|
||||
18 118 18 118
|
||||
19 1111 19 119
|
||||
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 2222 1 101
|
||||
2 102 2 102
|
||||
3 2222 3 103
|
||||
4 104 4 104
|
||||
5 2222 5 105
|
||||
6 106 6 106
|
||||
7 2222 7 107
|
||||
8 108 8 108
|
||||
9 2222 9 109
|
||||
10 110 10 110
|
||||
11 2222 11 111
|
||||
12 112 12 112
|
||||
13 2222 13 113
|
||||
14 114 14 114
|
||||
15 2222 15 115
|
||||
16 116 16 116
|
||||
17 2222 17 117
|
||||
18 118 18 118
|
||||
19 2222 19 119
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
|
113
mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
Normal file
113
mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
Normal file
|
@ -0,0 +1,113 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CALL fill_t1 (40);
|
||||
CALL fill_t2 (40);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
|
||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
i i
|
||||
100 100
|
||||
102 102
|
||||
104 104
|
||||
106 106
|
||||
108 108
|
||||
110 110
|
||||
112 112
|
||||
114 114
|
||||
116 116
|
||||
118 118
|
||||
120 120
|
||||
122 122
|
||||
124 124
|
||||
126 126
|
||||
128 128
|
||||
130 130
|
||||
132 132
|
||||
134 134
|
||||
136 136
|
||||
138 138
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.k % 2 = 1;
|
||||
SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
2 102 2 102
|
||||
4 104 4 104
|
||||
6 106 6 106
|
||||
8 108 8 108
|
||||
10 110 10 110
|
||||
12 112 12 112
|
||||
14 114 14 114
|
||||
16 116 16 116
|
||||
18 118 18 118
|
||||
SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 105 5 105
|
||||
6 106 6 106
|
||||
7 107 7 107
|
||||
8 108 8 108
|
||||
9 109 9 109
|
||||
10 110 10 110
|
||||
11 111 11 111
|
||||
12 112 12 112
|
||||
13 113 13 113
|
||||
14 114 14 114
|
||||
15 115 15 115
|
||||
16 116 16 116
|
||||
17 117 17 117
|
||||
18 118 18 118
|
||||
19 119 19 119
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
|
151
mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
Normal file
151
mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
Normal file
|
@ -0,0 +1,151 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 225
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 225
|
||||
4 126 4 226
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 225
|
||||
4 126 4 226
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
37
mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
Normal file
37
mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
Normal file
|
@ -0,0 +1,37 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
34
mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
Normal file
34
mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
Normal file
|
@ -0,0 +1,34 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE v1 SET i=325 where i=125;
|
40
mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
Normal file
40
mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
Normal file
|
@ -0,0 +1,40 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
|
||||
SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE v1 SET i=325 where i=125;
|
|
@ -0,0 +1,48 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=323 where i=123;
|
|
@ -0,0 +1,40 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
|
||||
SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
|
@ -0,0 +1,312 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
INSERT INTO t1 VALUES (5,127,5,127);
|
||||
INSERT INTO t1 VALUES (6,128,6,128);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
INSERT INTO t2 VALUES (5,127,5,127);
|
||||
INSERT INTO t2 VALUES (6,128,6,128);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
|
||||
BEGIN
|
||||
UPDATE t2 SET i = p2 WHERE i = p1;
|
||||
UPDATE v1 SET i = p2 WHERE i = p1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
CALL stp_t (125, 225);
|
||||
i
|
||||
123
|
||||
124
|
||||
126
|
||||
127
|
||||
128
|
||||
225
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
CALL stp_t (127, 227);
|
||||
i
|
||||
123
|
||||
124
|
||||
125
|
||||
126
|
||||
128
|
||||
227
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 128 6 128
|
||||
connection default;
|
||||
CALL stp_t (123, 223);
|
||||
i
|
||||
124
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root1;
|
||||
CALL stp_t (126, 226);
|
||||
i
|
||||
123
|
||||
124
|
||||
127
|
||||
128
|
||||
225
|
||||
226
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
CALL stp_t (128, 228);
|
||||
i
|
||||
123
|
||||
124
|
||||
125
|
||||
126
|
||||
227
|
||||
228
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
connection default;
|
||||
CALL stp_t (124, 224);
|
||||
i
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
224
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
DELETE FROM t1 WHERE t1.i=228;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection root1;
|
||||
COMMIT;
|
||||
connection default;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
123
|
||||
124
|
||||
125
|
||||
126
|
||||
227
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,47 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
INSERT INTO t1 VALUES (5,127,5,127);
|
||||
INSERT INTO t1 VALUES (6,128,6,128);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
INSERT INTO t2 VALUES (5,127,5,127);
|
||||
INSERT INTO t2 VALUES (6,128,6,128);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
|
||||
BEGIN
|
||||
UPDATE t2 SET i = p2 WHERE i = p1;
|
||||
UPDATE v1 SET i = p2 WHERE i = p1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
CALL stp_t (125, 225);
|
183
mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
Normal file
183
mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
Normal file
|
@ -0,0 +1,183 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
123
|
||||
124
|
||||
126
|
||||
225
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
124
|
||||
125
|
||||
126
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
123
|
||||
124
|
||||
225
|
||||
226
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
224
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,38 @@
|
|||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
139
mysql-test/suite/row_lock/r/ndb_row_lock_1.result
Normal file
139
mysql-test/suite/row_lock/r/ndb_row_lock_1.result
Normal file
|
@ -0,0 +1,139 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
31
mysql-test/suite/row_lock/r/ndb_row_lock_2.result
Normal file
31
mysql-test/suite/row_lock/r/ndb_row_lock_2.result
Normal file
|
@ -0,0 +1,31 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
30
mysql-test/suite/row_lock/r/ndb_row_lock_3.result
Normal file
30
mysql-test/suite/row_lock/r/ndb_row_lock_3.result
Normal file
|
@ -0,0 +1,30 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
139
mysql-test/suite/row_lock/r/ndb_row_lock_4.result
Normal file
139
mysql-test/suite/row_lock/r/ndb_row_lock_4.result
Normal file
|
@ -0,0 +1,139 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
30
mysql-test/suite/row_lock/r/ndb_row_lock_5.result
Normal file
30
mysql-test/suite/row_lock/r/ndb_row_lock_5.result
Normal file
|
@ -0,0 +1,30 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
177
mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
Normal file
177
mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
Normal file
|
@ -0,0 +1,177 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT count(*)/2 INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT count(*)/2 INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CALL fill_t1 (10);
|
||||
CALL fill_t2 (10);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
i i
|
||||
connection root1;
|
||||
SELECT k from t1 WHERE k < half_t1();
|
||||
k
|
||||
0
|
||||
3
|
||||
1
|
||||
2
|
||||
4
|
||||
SELECT k from t1 WHERE k >= half_t1();
|
||||
k
|
||||
6
|
||||
7
|
||||
9
|
||||
5
|
||||
8
|
||||
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 1111 0 100
|
||||
1 1111 1 101
|
||||
2 1111 2 102
|
||||
3 1111 3 103
|
||||
4 1111 4 104
|
||||
5 105 5 105
|
||||
6 106 6 106
|
||||
7 107 7 107
|
||||
8 108 8 108
|
||||
9 109 9 109
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 2222 0 100
|
||||
1 2222 1 101
|
||||
2 2222 2 102
|
||||
3 2222 3 103
|
||||
4 2222 4 104
|
||||
5 105 5 105
|
||||
6 106 6 106
|
||||
7 107 7 107
|
||||
8 108 8 108
|
||||
9 109 9 109
|
||||
connection default;
|
||||
UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 3333 5 105
|
||||
6 3333 6 106
|
||||
7 3333 7 107
|
||||
8 3333 8 108
|
||||
9 3333 9 109
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 4444 5 105
|
||||
6 4444 6 106
|
||||
7 4444 7 107
|
||||
8 4444 8 108
|
||||
9 4444 9 109
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 3333 5 105
|
||||
6 3333 6 106
|
||||
7 3333 7 107
|
||||
8 3333 8 108
|
||||
9 3333 9 109
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 4444 5 105
|
||||
6 4444 6 106
|
||||
7 4444 7 107
|
||||
8 4444 8 108
|
||||
9 4444 9 109
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 3333 5 105
|
||||
6 3333 6 106
|
||||
7 3333 7 107
|
||||
8 3333 8 108
|
||||
9 3333 9 109
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
0 100 0 100
|
||||
1 101 1 101
|
||||
2 102 2 102
|
||||
3 103 3 103
|
||||
4 104 4 104
|
||||
5 4444 5 105
|
||||
6 4444 6 106
|
||||
7 4444 7 107
|
||||
8 4444 8 108
|
||||
9 4444 9 109
|
||||
connection default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 'test.v1'
|
||||
DROP TABLE t1, t2;
|
357
mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
Normal file
357
mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
Normal file
|
@ -0,0 +1,357 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CALL fill_t1 (200);
|
||||
CALL fill_t2 (200);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
|
||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
|
||||
i i
|
||||
135 135
|
||||
119 119
|
||||
211 211
|
||||
184 184
|
||||
232 232
|
||||
105 105
|
||||
188 188
|
||||
216 216
|
||||
255 255
|
||||
154 154
|
||||
197 197
|
||||
279 279
|
||||
218 218
|
||||
127 127
|
||||
203 203
|
||||
281 281
|
||||
194 194
|
||||
161 161
|
||||
276 276
|
||||
122 122
|
||||
139 139
|
||||
183 183
|
||||
114 114
|
||||
247 247
|
||||
144 144
|
||||
148 148
|
||||
174 174
|
||||
267 267
|
||||
142 142
|
||||
168 168
|
||||
226 226
|
||||
258 258
|
||||
231 231
|
||||
146 146
|
||||
253 253
|
||||
189 189
|
||||
230 230
|
||||
290 290
|
||||
178 178
|
||||
158 158
|
||||
130 130
|
||||
214 214
|
||||
133 133
|
||||
229 229
|
||||
294 294
|
||||
295 295
|
||||
108 108
|
||||
112 112
|
||||
297 297
|
||||
151 151
|
||||
251 251
|
||||
270 270
|
||||
291 291
|
||||
159 159
|
||||
132 132
|
||||
121 121
|
||||
244 244
|
||||
272 272
|
||||
293 293
|
||||
186 186
|
||||
111 111
|
||||
166 166
|
||||
201 201
|
||||
175 175
|
||||
180 180
|
||||
209 209
|
||||
192 192
|
||||
246 246
|
||||
195 195
|
||||
107 107
|
||||
233 233
|
||||
239 239
|
||||
103 103
|
||||
109 109
|
||||
128 128
|
||||
266 266
|
||||
143 143
|
||||
160 160
|
||||
187 187
|
||||
243 243
|
||||
273 273
|
||||
259 259
|
||||
110 110
|
||||
176 176
|
||||
141 141
|
||||
170 170
|
||||
215 215
|
||||
191 191
|
||||
200 200
|
||||
271 271
|
||||
162 162
|
||||
260 260
|
||||
106 106
|
||||
150 150
|
||||
126 126
|
||||
147 147
|
||||
155 155
|
||||
193 193
|
||||
207 207
|
||||
287 287
|
||||
235 235
|
||||
252 252
|
||||
129 129
|
||||
205 205
|
||||
268 268
|
||||
278 278
|
||||
116 116
|
||||
137 137
|
||||
199 199
|
||||
217 217
|
||||
234 234
|
||||
190 190
|
||||
236 236
|
||||
257 257
|
||||
100 100
|
||||
210 210
|
||||
212 212
|
||||
264 264
|
||||
221 221
|
||||
241 241
|
||||
256 256
|
||||
262 262
|
||||
265 265
|
||||
269 269
|
||||
277 277
|
||||
173 173
|
||||
177 177
|
||||
208 208
|
||||
219 219
|
||||
285 285
|
||||
101 101
|
||||
164 164
|
||||
113 113
|
||||
125 125
|
||||
202 202
|
||||
140 140
|
||||
156 156
|
||||
282 282
|
||||
181 181
|
||||
206 206
|
||||
299 299
|
||||
102 102
|
||||
145 145
|
||||
227 227
|
||||
196 196
|
||||
138 138
|
||||
198 198
|
||||
204 204
|
||||
237 237
|
||||
171 171
|
||||
284 284
|
||||
263 263
|
||||
292 292
|
||||
104 104
|
||||
149 149
|
||||
250 250
|
||||
296 296
|
||||
228 228
|
||||
280 280
|
||||
242 242
|
||||
248 248
|
||||
185 185
|
||||
220 220
|
||||
245 245
|
||||
275 275
|
||||
118 118
|
||||
120 120
|
||||
152 152
|
||||
153 153
|
||||
157 157
|
||||
182 182
|
||||
179 179
|
||||
254 254
|
||||
288 288
|
||||
172 172
|
||||
283 283
|
||||
286 286
|
||||
115 115
|
||||
238 238
|
||||
289 289
|
||||
131 131
|
||||
223 223
|
||||
134 134
|
||||
136 136
|
||||
222 222
|
||||
225 225
|
||||
261 261
|
||||
274 274
|
||||
123 123
|
||||
163 163
|
||||
224 224
|
||||
117 117
|
||||
298 298
|
||||
169 169
|
||||
124 124
|
||||
167 167
|
||||
240 240
|
||||
249 249
|
||||
165 165
|
||||
213 213
|
||||
connection root1;
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
i i
|
||||
209 209
|
||||
195 195
|
||||
107 107
|
||||
233 233
|
||||
239 239
|
||||
103 103
|
||||
109 109
|
||||
143 143
|
||||
187 187
|
||||
243 243
|
||||
273 273
|
||||
259 259
|
||||
141 141
|
||||
215 215
|
||||
191 191
|
||||
271 271
|
||||
147 147
|
||||
155 155
|
||||
193 193
|
||||
207 207
|
||||
287 287
|
||||
235 235
|
||||
129 129
|
||||
205 205
|
||||
137 137
|
||||
199 199
|
||||
217 217
|
||||
257 257
|
||||
221 221
|
||||
241 241
|
||||
265 265
|
||||
269 269
|
||||
277 277
|
||||
173 173
|
||||
177 177
|
||||
135 135
|
||||
119 119
|
||||
211 211
|
||||
105 105
|
||||
255 255
|
||||
197 197
|
||||
279 279
|
||||
127 127
|
||||
203 203
|
||||
281 281
|
||||
161 161
|
||||
139 139
|
||||
183 183
|
||||
247 247
|
||||
267 267
|
||||
231 231
|
||||
253 253
|
||||
189 189
|
||||
133 133
|
||||
229 229
|
||||
295 295
|
||||
297 297
|
||||
151 151
|
||||
251 251
|
||||
291 291
|
||||
159 159
|
||||
121 121
|
||||
293 293
|
||||
111 111
|
||||
201 201
|
||||
175 175
|
||||
185 185
|
||||
245 245
|
||||
275 275
|
||||
153 153
|
||||
157 157
|
||||
179 179
|
||||
283 283
|
||||
115 115
|
||||
289 289
|
||||
131 131
|
||||
223 223
|
||||
225 225
|
||||
261 261
|
||||
123 123
|
||||
163 163
|
||||
117 117
|
||||
169 169
|
||||
167 167
|
||||
249 249
|
||||
165 165
|
||||
213 213
|
||||
219 219
|
||||
285 285
|
||||
101 101
|
||||
113 113
|
||||
125 125
|
||||
181 181
|
||||
299 299
|
||||
145 145
|
||||
227 227
|
||||
237 237
|
||||
171 171
|
||||
263 263
|
||||
149 149
|
||||
UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
|
255
mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
Normal file
255
mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
Normal file
|
@ -0,0 +1,255 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE PROCEDURE fill_t1 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t1() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t1;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CREATE PROCEDURE fill_t2 (IN upb int)
|
||||
BEGIN
|
||||
DECLARE cnt int DEFAULT 0;
|
||||
WHILE cnt < upb DO
|
||||
INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
|
||||
SET cnt= cnt+1;
|
||||
END WHILE;
|
||||
END;
|
||||
|
|
||||
CREATE FUNCTION half_t2() RETURNS int
|
||||
BEGIN
|
||||
DECLARE res int DEFAULT 0;
|
||||
SELECT MOD(k,2) INTO res FROM t2;
|
||||
RETURN res;
|
||||
END;
|
||||
|
|
||||
CALL fill_t1 (200);
|
||||
CALL fill_t2 (200);
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
|
||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
|
||||
i i
|
||||
135 135
|
||||
119 119
|
||||
211 211
|
||||
184 184
|
||||
232 232
|
||||
105 105
|
||||
188 188
|
||||
216 216
|
||||
255 255
|
||||
154 154
|
||||
197 197
|
||||
279 279
|
||||
218 218
|
||||
127 127
|
||||
203 203
|
||||
281 281
|
||||
194 194
|
||||
161 161
|
||||
276 276
|
||||
122 122
|
||||
139 139
|
||||
183 183
|
||||
114 114
|
||||
247 247
|
||||
144 144
|
||||
148 148
|
||||
174 174
|
||||
267 267
|
||||
142 142
|
||||
168 168
|
||||
226 226
|
||||
258 258
|
||||
231 231
|
||||
146 146
|
||||
253 253
|
||||
189 189
|
||||
230 230
|
||||
290 290
|
||||
178 178
|
||||
158 158
|
||||
130 130
|
||||
214 214
|
||||
133 133
|
||||
229 229
|
||||
294 294
|
||||
295 295
|
||||
108 108
|
||||
112 112
|
||||
297 297
|
||||
151 151
|
||||
251 251
|
||||
270 270
|
||||
291 291
|
||||
159 159
|
||||
132 132
|
||||
121 121
|
||||
244 244
|
||||
272 272
|
||||
293 293
|
||||
186 186
|
||||
111 111
|
||||
166 166
|
||||
201 201
|
||||
175 175
|
||||
180 180
|
||||
209 209
|
||||
192 192
|
||||
246 246
|
||||
195 195
|
||||
107 107
|
||||
233 233
|
||||
239 239
|
||||
103 103
|
||||
109 109
|
||||
128 128
|
||||
266 266
|
||||
143 143
|
||||
160 160
|
||||
187 187
|
||||
243 243
|
||||
273 273
|
||||
259 259
|
||||
110 110
|
||||
176 176
|
||||
141 141
|
||||
170 170
|
||||
215 215
|
||||
191 191
|
||||
200 200
|
||||
271 271
|
||||
162 162
|
||||
260 260
|
||||
106 106
|
||||
150 150
|
||||
126 126
|
||||
147 147
|
||||
155 155
|
||||
193 193
|
||||
207 207
|
||||
287 287
|
||||
235 235
|
||||
252 252
|
||||
129 129
|
||||
205 205
|
||||
268 268
|
||||
278 278
|
||||
116 116
|
||||
137 137
|
||||
199 199
|
||||
217 217
|
||||
234 234
|
||||
190 190
|
||||
236 236
|
||||
257 257
|
||||
100 100
|
||||
210 210
|
||||
212 212
|
||||
264 264
|
||||
221 221
|
||||
241 241
|
||||
256 256
|
||||
262 262
|
||||
265 265
|
||||
269 269
|
||||
277 277
|
||||
173 173
|
||||
177 177
|
||||
208 208
|
||||
219 219
|
||||
285 285
|
||||
101 101
|
||||
164 164
|
||||
113 113
|
||||
125 125
|
||||
202 202
|
||||
140 140
|
||||
156 156
|
||||
282 282
|
||||
181 181
|
||||
206 206
|
||||
299 299
|
||||
102 102
|
||||
145 145
|
||||
227 227
|
||||
196 196
|
||||
138 138
|
||||
198 198
|
||||
204 204
|
||||
237 237
|
||||
171 171
|
||||
284 284
|
||||
263 263
|
||||
292 292
|
||||
104 104
|
||||
149 149
|
||||
250 250
|
||||
296 296
|
||||
228 228
|
||||
280 280
|
||||
242 242
|
||||
248 248
|
||||
185 185
|
||||
220 220
|
||||
245 245
|
||||
275 275
|
||||
118 118
|
||||
120 120
|
||||
152 152
|
||||
153 153
|
||||
157 157
|
||||
182 182
|
||||
179 179
|
||||
254 254
|
||||
288 288
|
||||
172 172
|
||||
283 283
|
||||
286 286
|
||||
115 115
|
||||
238 238
|
||||
289 289
|
||||
131 131
|
||||
223 223
|
||||
134 134
|
||||
136 136
|
||||
222 222
|
||||
225 225
|
||||
261 261
|
||||
274 274
|
||||
123 123
|
||||
163 163
|
||||
224 224
|
||||
117 117
|
||||
298 298
|
||||
169 169
|
||||
124 124
|
||||
167 167
|
||||
240 240
|
||||
249 249
|
||||
165 165
|
||||
213 213
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.k % 2 = 1;
|
148
mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
Normal file
148
mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
Normal file
|
@ -0,0 +1,148 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 225
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 225
|
||||
4 126 4 226
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 225
|
||||
4 126 4 226
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 223
|
||||
2 124 2 224
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
35
mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
Normal file
35
mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
Normal file
|
@ -0,0 +1,35 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
194
mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
Normal file
194
mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
Normal file
|
@ -0,0 +1,194 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE v1 SET i=325 where i=125;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
123 123
|
||||
123 124
|
||||
123 125
|
||||
123 126
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
325 123
|
||||
325 124
|
||||
325 125
|
||||
325 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 325 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=323 where i=123;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
125 123
|
||||
125 124
|
||||
125 125
|
||||
125 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
323 123
|
||||
323 124
|
||||
323 125
|
||||
323 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE v1 SET i=326 where i=126;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
123 123
|
||||
123 124
|
||||
123 125
|
||||
123 126
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
325 123
|
||||
325 124
|
||||
325 125
|
||||
325 126
|
||||
326 123
|
||||
326 124
|
||||
326 125
|
||||
326 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 325 3 125
|
||||
4 326 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=324 where i=124;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
125 123
|
||||
125 124
|
||||
125 125
|
||||
125 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
323 123
|
||||
323 124
|
||||
323 125
|
||||
323 126
|
||||
324 123
|
||||
324 124
|
||||
324 125
|
||||
324 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 325 3 125
|
||||
4 326 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE t1, t2;
|
200
mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
Normal file
200
mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
Normal file
|
@ -0,0 +1,200 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4
|
||||
SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE v1 SET i=325 where i=125;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
123 123
|
||||
123 124
|
||||
123 125
|
||||
123 126
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
325 123
|
||||
325 124
|
||||
325 125
|
||||
325 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 325 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=323 where i=123;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
125 123
|
||||
125 124
|
||||
125 125
|
||||
125 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
323 123
|
||||
323 124
|
||||
323 125
|
||||
323 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE v1 SET i=326 where i=126;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
123 123
|
||||
123 124
|
||||
123 125
|
||||
123 126
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
325 123
|
||||
325 124
|
||||
325 125
|
||||
325 126
|
||||
326 123
|
||||
326 124
|
||||
326 125
|
||||
326 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 325 3 125
|
||||
4 326 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=324 where i=124;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
125 123
|
||||
125 124
|
||||
125 125
|
||||
125 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
323 123
|
||||
323 124
|
||||
323 125
|
||||
323 126
|
||||
324 123
|
||||
324 124
|
||||
324 125
|
||||
324 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 325 3 125
|
||||
4 326 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE t1, t2;
|
169
mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
Normal file
169
mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
Normal file
|
@ -0,0 +1,169 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
|
||||
SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
i i
|
||||
123 123
|
||||
124 124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=323 where i=123;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
124 123
|
||||
124 124
|
||||
124 125
|
||||
124 126
|
||||
125 123
|
||||
125 124
|
||||
125 125
|
||||
125 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
323 123
|
||||
323 124
|
||||
323 125
|
||||
323 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE v1 SET i=324 where i=124;
|
||||
SELECT * FROM v1 ORDER BY i,l;
|
||||
i l
|
||||
125 123
|
||||
125 124
|
||||
125 125
|
||||
125 126
|
||||
126 123
|
||||
126 124
|
||||
126 125
|
||||
126 126
|
||||
323 123
|
||||
323 124
|
||||
323 125
|
||||
323 126
|
||||
324 123
|
||||
324 124
|
||||
324 125
|
||||
324 126
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 323 1 123
|
||||
2 324 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP TABLE t1, t2;
|
38
mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
Normal file
38
mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
Normal file
|
@ -0,0 +1,38 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4
|
||||
SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
|
309
mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
Normal file
309
mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
Normal file
|
@ -0,0 +1,309 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP PROCEDURE IF EXISTS stp_t;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
INSERT INTO t1 VALUES (5,127,5,127);
|
||||
INSERT INTO t1 VALUES (6,128,6,128);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
INSERT INTO t2 VALUES (5,127,5,127);
|
||||
INSERT INTO t2 VALUES (6,128,6,128);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
|
||||
BEGIN
|
||||
UPDATE t2 SET i = p2 WHERE i = p1;
|
||||
UPDATE v1 SET i = p2 WHERE i = p1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
CALL stp_t (125, 225);
|
||||
i
|
||||
123
|
||||
124
|
||||
126
|
||||
127
|
||||
128
|
||||
225
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
CALL stp_t (127, 227);
|
||||
i
|
||||
123
|
||||
124
|
||||
125
|
||||
126
|
||||
128
|
||||
227
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 128 6 128
|
||||
connection default;
|
||||
CALL stp_t (123, 223);
|
||||
i
|
||||
124
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root1;
|
||||
CALL stp_t (126, 226);
|
||||
i
|
||||
123
|
||||
124
|
||||
127
|
||||
128
|
||||
225
|
||||
226
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
CALL stp_t (128, 228);
|
||||
i
|
||||
123
|
||||
124
|
||||
125
|
||||
126
|
||||
227
|
||||
228
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
connection default;
|
||||
CALL stp_t (124, 224);
|
||||
i
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
224
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
DELETE FROM t1 WHERE t1.i=228;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection root1;
|
||||
COMMIT;
|
||||
connection default;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
127
|
||||
128
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 127 5 127
|
||||
6 128 6 128
|
||||
connection root2;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
227
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
5 227 5 127
|
||||
6 228 6 128
|
||||
connection default;
|
||||
DROP VIEW v1;
|
||||
DROP PROCEDURE stp_t;
|
||||
DROP TABLE t1, t2;
|
|
@ -0,0 +1,46 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP PROCEDURE IF EXISTS stp_t;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
INSERT INTO t1 VALUES (5,127,5,127);
|
||||
INSERT INTO t1 VALUES (6,128,6,128);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
INSERT INTO t2 VALUES (5,127,5,127);
|
||||
INSERT INTO t2 VALUES (6,128,6,128);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
|
||||
BEGIN
|
||||
UPDATE t2 SET i = p2 WHERE i = p1;
|
||||
UPDATE v1 SET i = p2 WHERE i = p1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
CALL stp_t (125, 225);
|
180
mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
Normal file
180
mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
Normal file
|
@ -0,0 +1,180 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
123
|
||||
124
|
||||
126
|
||||
225
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=223 WHERE t2.i=123;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
124
|
||||
125
|
||||
126
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 124 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=226 WHERE t2.i=126;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
123
|
||||
124
|
||||
225
|
||||
226
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
UPDATE t2 SET t2.i=224 WHERE t2.i=124;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
224
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
DELETE FROM t1 WHERE t1.i=226;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 123 1 123
|
||||
2 124 2 124
|
||||
3 225 3 125
|
||||
4 226 4 126
|
||||
connection default;
|
||||
DELETE FROM t1 WHERE t1.i=224;
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
COMMIT;
|
||||
connection root1;
|
||||
ROLLBACK;
|
||||
connection default;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection root1;
|
||||
SELECT * FROM v1 ORDER BY i;
|
||||
i
|
||||
125
|
||||
126
|
||||
223
|
||||
SELECT * FROM t1 ORDER BY t1.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
SELECT * FROM t2 ORDER BY t2.k;
|
||||
k i j l
|
||||
1 223 1 123
|
||||
2 224 2 124
|
||||
3 125 3 125
|
||||
4 126 4 126
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
DROP VIEW v1;
|
36
mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
Normal file
36
mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
Normal file
|
@ -0,0 +1,36 @@
|
|||
DROP TABLE IF EXISTS t1, t2;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
SET autocommit=0;
|
||||
SET autocommit=0;
|
||||
connection default;
|
||||
CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,123,1,123);
|
||||
INSERT INTO t1 VALUES (2,124,2,124);
|
||||
INSERT INTO t1 VALUES (3,125,3,125);
|
||||
INSERT INTO t1 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t1 (i);
|
||||
CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
|
||||
INSERT INTO t2 VALUES (1,123,1,123);
|
||||
INSERT INTO t2 VALUES (2,124,2,124);
|
||||
INSERT INTO t2 VALUES (3,125,3,125);
|
||||
INSERT INTO t2 VALUES (4,126,4,126);
|
||||
#CREATE INDEX ixi ON t2 (i);
|
||||
CREATE VIEW v1 AS SELECT t1.i from t1;
|
||||
CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
|
||||
FOR EACH ROW BEGIN
|
||||
UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
|
||||
END;
|
||||
|
|
||||
COMMIT;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||
SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
i
|
||||
123
|
||||
124
|
||||
connection root1;
|
||||
UPDATE t2 SET t2.i=225 WHERE t2.i=125;
|
9
mysql-test/suite/row_lock/readme.txt
Normal file
9
mysql-test/suite/row_lock/readme.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
All row lock test with InnoDB have to be executed with the options
|
||||
|
||||
--innodb_lock_wait_timeout=1
|
||||
--innodb_locks_unsafe_for_binlog
|
||||
|
||||
for example
|
||||
|
||||
perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2
|
||||
|
36
mysql-test/suite/row_lock/summary_of_sel_test.txt
Normal file
36
mysql-test/suite/row_lock/summary_of_sel_test.txt
Normal file
|
@ -0,0 +1,36 @@
|
|||
Test plan:
|
||||
Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result.
|
||||
|
||||
The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully.
|
||||
|
||||
First session
|
||||
execute an explain to every select and one of the following selects on the first half of table t1:
|
||||
- select <non index columns> ... where ... for update;
|
||||
- select <non index columns> ... where ... lock in share mode;
|
||||
- select <indexed columns> ... where ... for update;
|
||||
- select <indexed columns> ... where ... lock in share mode;
|
||||
- select <indexed columns> ... ignore index ... where ... for update;
|
||||
- select <indexed columns> ... ignore index ... where ... lock in share mode;
|
||||
- select ... where (select...) ... for update;
|
||||
- select ... where (select...) ... lock in share mode;
|
||||
- (select ... where) union (select ... where) for update;
|
||||
- (select ... where) union (select ... where) lock in...;
|
||||
- select <view> ... where ... for update;
|
||||
- select <view> ... where ... lock in ...;
|
||||
- select <join> ... where ... for update;
|
||||
- select <join> ... where ... lock in ...;
|
||||
Then executes
|
||||
- update
|
||||
- delete
|
||||
- trigger accessing table t1
|
||||
- stored procedure accessing table t1
|
||||
- stored function accessing table t1
|
||||
|
||||
Second session
|
||||
executes the same on the last half of table t1
|
||||
|
||||
call of mysqld with option
|
||||
--innodb_locks_unsafe_for_binlog
|
||||
|
||||
As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan.
|
||||
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_1.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_1.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_2.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_2.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_3.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_3.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_4.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_4.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_5.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_5.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_big_tab.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
10
mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
Normal file
10
mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
Normal file
|
@ -0,0 +1,10 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $nbrows= 40;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_big_tab_1.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
10
mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
Normal file
10
mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
Normal file
|
@ -0,0 +1,10 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $nbrows= 40;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_big_tab_2.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_trig.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_trig.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
9
mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
Normal file
9
mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_mix.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
10
mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
Normal file
10
mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
Normal file
|
@ -0,0 +1,10 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_mix.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_storedp.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_storedp.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_trig.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
|
@ -0,0 +1,9 @@
|
|||
--source include/have_innodb.inc
|
||||
SELECT @@global.innodb_table_locks into @table_locks;
|
||||
SET @@global.innodb_table_locks= OFF;
|
||||
let $engine= InnoDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_trig.inc
|
||||
SET @@global.innodb_table_locks= @table_locks;
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_1.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_1.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_2.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_2.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_3.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_3.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_4.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_4.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_5.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_5.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_big_tab.inc
|
7
mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
Normal file
7
mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
Normal file
|
@ -0,0 +1,7 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $nbrows= 200;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_big_tab_1.inc
|
7
mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
Normal file
7
mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
Normal file
|
@ -0,0 +1,7 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $nbrows= 200;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_big_tab_2.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_trig.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_trig.inc
|
7
mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
Normal file
7
mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
Normal file
|
@ -0,0 +1,7 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view.inc
|
||||
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_mix.inc
|
6
mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
Normal file
6
mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_mix.inc
|
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_storedp.inc
|
|
@ -0,0 +1,6 @@
|
|||
--source include/have_ndb.inc
|
||||
let $engine= NDB;
|
||||
let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
|
||||
let $indext1= #CREATE INDEX ixi ON t1 (i);
|
||||
let $indext2= #CREATE INDEX ixi ON t2 (i);
|
||||
--source suite/row_lock/include/row_lock_view_storedp.inc
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue