[Commits] Rev 3678: Tests with locking fixed. in file:///home/bell/maria/bzr/work-maria-10.0-base-merge-5.5/

sanja at montyprogram.com sanja at montyprogram.com
Mon Aug 19 12:57:16 EEST 2013


At file:///home/bell/maria/bzr/work-maria-10.0-base-merge-5.5/

------------------------------------------------------------
revno: 3678
revision-id: sanja at montyprogram.com-20130819095715-w25dpzzcyh4cnkk4
parent: sanja at montyprogram.com-20130813103252-ny379kz8a6gkvkja
committer: sanja at montyprogram.com
branch nick: work-maria-10.0-base-merge-5.5
timestamp: Mon 2013-08-19 12:57:15 +0300
message:
  Tests with locking fixed.
  Fixed Items.
  Added test suite for MySQL BUG#1271 which old fix was removed.
-------------- next part --------------
=== modified file 'mysql-test/r/lock_multi.result'
--- a/mysql-test/r/lock_multi.result	2013-08-13 10:08:22 +0000
+++ b/mysql-test/r/lock_multi.result	2013-08-19 09:57:15 +0000
@@ -18,16 +18,22 @@ n
 4
 drop table t1;
 create table t1(n int);
-insert into t1 values (1);
+insert into t1 values (1),(2);
 select get_lock("mysqltest_lock", 100);
 get_lock("mysqltest_lock", 100)
 1
 select n from t1 where get_lock('mysqltest_lock', 100);
+update low_priority t1 set n = 4;
+select n from t1;
+n
+1
+2
 select release_lock("mysqltest_lock");
 release_lock("mysqltest_lock")
 1
 n
 1
+2
 select release_lock("mysqltest_lock");
 release_lock("mysqltest_lock")
 1

=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2013-05-08 09:36:17 +0000
+++ b/mysql-test/r/select.result	2013-08-19 09:57:15 +0000
@@ -5358,3 +5358,38 @@ WHERE c = a AND
 a	b	c
 DROP TABLE t1, t2;
 End of 5.3 tests
+#
+# mysql BUG#1271 Undefined variable in PASSWORD() 
+# function is not handled correctly
+#
+create table t1 (
+name VARCHAR(50) NOT NULL PRIMARY KEY,
+pw VARCHAR(41) NOT NULL);
+INSERT INTO t1 (name, pw) 
+VALUES ('tom', PASSWORD('my_pw'));
+SET @pass='my_pw';
+SET @wrong='incorrect';
+select * from t1;
+name	pw
+tom	*F305E8EC27734F687F2EB6EC03CF0F7AF27C18E1
+select length(PASSWORD(@pass));
+length(PASSWORD(@pass))
+41
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass);
+name
+tom
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong);
+name
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined);
+name
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass))
+tom
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong))
+NULL
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined))
+NULL
+drop table t1;
+End of 10.0 tests

=== modified file 'mysql-test/r/select_jcl6.result'
--- a/mysql-test/r/select_jcl6.result	2013-05-08 09:36:17 +0000
+++ b/mysql-test/r/select_jcl6.result	2013-08-19 09:57:15 +0000
@@ -5369,6 +5369,41 @@ WHERE c = a AND
 a	b	c
 DROP TABLE t1, t2;
 End of 5.3 tests
+#
+# mysql BUG#1271 Undefined variable in PASSWORD() 
+# function is not handled correctly
+#
+create table t1 (
+name VARCHAR(50) NOT NULL PRIMARY KEY,
+pw VARCHAR(41) NOT NULL);
+INSERT INTO t1 (name, pw) 
+VALUES ('tom', PASSWORD('my_pw'));
+SET @pass='my_pw';
+SET @wrong='incorrect';
+select * from t1;
+name	pw
+tom	*F305E8EC27734F687F2EB6EC03CF0F7AF27C18E1
+select length(PASSWORD(@pass));
+length(PASSWORD(@pass))
+41
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass);
+name
+tom
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong);
+name
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined);
+name
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass))
+tom
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong))
+NULL
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined))
+NULL
+drop table t1;
+End of 10.0 tests
 set join_cache_level=default;
 show variables like 'join_cache_level';
 Variable_name	Value

=== modified file 'mysql-test/r/select_pkeycache.result'
--- a/mysql-test/r/select_pkeycache.result	2013-05-08 09:36:17 +0000
+++ b/mysql-test/r/select_pkeycache.result	2013-08-19 09:57:15 +0000
@@ -5358,3 +5358,38 @@ WHERE c = a AND
 a	b	c
 DROP TABLE t1, t2;
 End of 5.3 tests
+#
+# mysql BUG#1271 Undefined variable in PASSWORD() 
+# function is not handled correctly
+#
+create table t1 (
+name VARCHAR(50) NOT NULL PRIMARY KEY,
+pw VARCHAR(41) NOT NULL);
+INSERT INTO t1 (name, pw) 
+VALUES ('tom', PASSWORD('my_pw'));
+SET @pass='my_pw';
+SET @wrong='incorrect';
+select * from t1;
+name	pw
+tom	*F305E8EC27734F687F2EB6EC03CF0F7AF27C18E1
+select length(PASSWORD(@pass));
+length(PASSWORD(@pass))
+41
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass);
+name
+tom
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong);
+name
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined);
+name
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass))
+tom
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong))
+NULL
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
+(SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined))
+NULL
+drop table t1;
+End of 10.0 tests

=== modified file 'mysql-test/r/sp_notembedded.result'
--- a/mysql-test/r/sp_notembedded.result	2013-01-15 18:13:32 +0000
+++ b/mysql-test/r/sp_notembedded.result	2013-08-19 09:57:15 +0000
@@ -169,7 +169,7 @@ drop procedure if exists p1;
 create table t1 (value varchar(15));
 create procedure p1() update t1 set value='updated' where value='old';
 call p1();
-insert into t1 (value) values ("old");
+insert into t1 (value) values ("old"),("irrelevant");
 select get_lock('b26162',120);
 get_lock('b26162',120)
 1
@@ -179,11 +179,13 @@ call p1();;
 select 'rl_contender', value from t1;
 rl_contender	value
 rl_contender	old
+rl_contender	irrelevant
 select release_lock('b26162');
 release_lock('b26162')
 1
 rl_acquirer	value
 rl_acquirer	old
+rl_acquirer	irrelevant
 drop procedure p1;
 drop table t1;
 set session low_priority_updates=default;

=== modified file 'mysql-test/r/user_var.result'
--- a/mysql-test/r/user_var.result	2013-03-27 22:41:02 +0000
+++ b/mysql-test/r/user_var.result	2013-08-19 09:57:15 +0000
@@ -126,14 +126,14 @@ select @a+0, @a:=@a+0+count(*), count(*)
 set @a=0;
 select @a, at a:="hello", at a, at a:=3, at a, at a:="hello again" from t1 group by i;
 @a	@a:="hello"	@a	@a:=3	@a	@a:="hello again"
-0	hello	0	3	0	hello again
-0	hello	0	3	0	hello again
-0	hello	0	3	0	hello again
+0	hello	0	3	3	hello again
+0	hello	0	3	3	hello again
+0	hello	0	3	3	hello again
 select @a, at a:="hello", at a, at a:=3, at a, at a:="hello again" from t1 group by i;
 @a	@a:="hello"	@a	@a:=3	@a	@a:="hello again"
-hello again	hello	hello again	3	hello again	hello again
-hello again	hello	hello again	3	hello again	hello again
-hello again	hello	hello again	3	hello again	hello again
+hello again	hello	hello	3	3	hello again
+hello again	hello	hello	3	3	hello again
+hello again	hello	hello	3	3	hello again
 drop table t1;
 set @a=_latin2'test';
 select charset(@a),collation(@a),coercibility(@a);

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2013-07-17 19:24:29 +0000
+++ b/mysql-test/r/variables.result	2013-08-19 09:57:15 +0000
@@ -1549,7 +1549,7 @@ one
 1
 explain SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using temporary; Using filesort
 2	SUBQUERY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
 SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
 one
@@ -1560,7 +1560,7 @@ one
 set sql_buffer_result=1;
 explain SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using temporary
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using temporary; Using filesort
 2	SUBQUERY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
 SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
 one

=== modified file 'mysql-test/t/lock_multi.test'
--- a/mysql-test/t/lock_multi.test	2013-08-13 10:08:22 +0000
+++ b/mysql-test/t/lock_multi.test	2013-08-19 09:57:15 +0000
@@ -57,7 +57,7 @@ drop table t1;
 
 connection locker;
 create table t1(n int);
-insert into t1 values (1);
+insert into t1 values (1),(2);
 connection locker2;
 select get_lock("mysqltest_lock", 100);
 connection locker;
@@ -69,12 +69,23 @@ let $wait_condition=
   select count(*) = 1 from information_schema.processlist
   where state = "User lock" and info = "select n from t1 where get_lock('mysqltest_lock', 100)";
 --source include/wait_condition.inc
+send
+update low_priority t1 set n = 4;
+connection reader;
+# Sleep a bit till the update of connection writer is in work and hangs
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Waiting for table level lock" and
+        info = "update low_priority t1 set n = 4";
+--source include/wait_condition.inc
+select n from t1;
 connection locker2;
 select release_lock("mysqltest_lock");
 connection locker;
 reap;
 select release_lock("mysqltest_lock");
 connection writer;
+reap;
 drop table t1;
 
 #

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2013-05-08 09:36:17 +0000
+++ b/mysql-test/t/select.test	2013-08-19 09:57:15 +0000
@@ -4518,3 +4518,35 @@ DROP TABLE t1, t2;
 
 --echo End of 5.3 tests
 
+--echo #
+--echo # mysql BUG#1271 Undefined variable in PASSWORD() 
+--echo # function is not handled correctly
+--echo #
+
+create table t1 (
+name VARCHAR(50) NOT NULL PRIMARY KEY,
+pw VARCHAR(41) NOT NULL);
+
+INSERT INTO t1 (name, pw) 
+VALUES ('tom', PASSWORD('my_pw'));
+
+SET @pass='my_pw';
+SET @wrong='incorrect';
+
+select * from t1;
+select length(PASSWORD(@pass));
+
+
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass);
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong);
+SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined);
+
+
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass));
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong));
+select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
+
+drop table t1;
+
+--echo End of 10.0 tests
+

=== modified file 'mysql-test/t/sp_notembedded.test'
--- a/mysql-test/t/sp_notembedded.test	2013-01-15 18:13:32 +0000
+++ b/mysql-test/t/sp_notembedded.test	2013-08-19 09:57:15 +0000
@@ -248,7 +248,7 @@ create procedure p1() update t1 set valu
 # load the procedure into sp cache and execute once
 call p1();
 
-insert into t1 (value) values ("old");
+insert into t1 (value) values ("old"),("irrelevant");
 
 connect (rl_holder, localhost, root,,);
 connect (rl_acquirer, localhost, root,,);

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2013-08-13 10:32:52 +0000
+++ b/sql/item_func.h	2013-08-19 09:57:15 +0000
@@ -1279,6 +1279,7 @@ public:
   {
     return Item_int_func::used_tables() | RAND_TABLE_BIT;
   }
+  bool is_expensive() { return 1; }
   longlong val_int();
   bool check_vcol_func_processor(uchar *int_arg) 
   {
@@ -1533,6 +1534,7 @@ class Item_func_get_lock :public Item_in
     return Item_int_func::used_tables() | RAND_TABLE_BIT;
   }
   bool const_item() const { return 0; }
+  bool is_expensive() { return 1; }
   bool check_vcol_func_processor(uchar *int_arg) 
   {
     return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -1551,6 +1553,7 @@ public:
     return Item_int_func::used_tables() | RAND_TABLE_BIT;
   }
   bool const_item() const { return 0; }
+  bool is_expensive() { return 1; }
   void fix_length_and_dec() { max_length=1; set_persist_maybe_null(1);}
   bool check_vcol_func_processor(uchar *int_arg) 
   {
@@ -1636,6 +1639,7 @@ public:
     return Item_func::used_tables() | RAND_TABLE_BIT;
   }
   bool const_item() const { return 0; }
+  bool is_expensive() { return 1; }
   String *str_result(String *str);
   my_decimal *val_decimal_result(my_decimal *);
   bool is_null_result();

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2013-07-17 19:24:29 +0000
+++ b/sql/sql_base.cc	2013-08-19 09:57:15 +0000
@@ -5665,7 +5665,10 @@ bool lock_tables(THD *thd, TABLE_LIST *t
               !thd->lex->requires_prelocking());
 
   if (!tables && !thd->lex->requires_prelocking())
+  {
+    DBUG_PRINT("info", ("No tables and no prelocking"));
     DBUG_RETURN(thd->decide_logging_format(tables));
+  }
 
   /*
     Check for thd->locked_tables_mode to avoid a redundant

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2013-08-12 18:12:43 +0000
+++ b/sql/sql_select.cc	2013-08-19 09:57:15 +0000
@@ -8957,10 +8957,6 @@ make_join_select(JOIN *join,SQL_SELECT *
     {                        /* there may be a select without a cond. */    
       if (join->table_count > 1)
         cond->update_used_tables();		// Tablenr may have changed
-      if (join->const_tables == join->table_count &&
-	  thd->lex->current_select->master_unit() ==
-	  &thd->lex->unit)		// not upper level SELECT
-        join->const_table_map|=RAND_TABLE_BIT;
 
       /*
         Extract expressions that depend on constant tables



More information about the commits mailing list