List:Commits« Previous MessageNext Message »
From:Venkata Sidagam Date:February 9 2012 12:18pm
Subject:bzr push into mysql-trunk branch (venkata.sidagam:3867 to 3868) Bug#11755870
View as plain text  
 3868 Venkata Sidagam	2012-02-09
      Bug #11755870-47704: HASH INDEX ON VARCHAR PREFIX NOT WORKING CORRECTLY.
      
      Brief description: Insert some rows to MEMORY table with HASH key on varchar field.
      A select on specific existing tuple is showing empty set.
      
      Problem Analysis/solution: In hp_key_cmp() when the seg->type == HA_KEYTYPE_VARTEXT1
      the char_length_rec is the length of pos string and it is compared with key string for
      char_length_key bytes. Here both char_length_rec and char_length_key will be of different
      values when we have hash index on column prefix. So the comparition is failing and 
      the result set is empty.
      
      So the fix is, if char_length_rec has more value than the char_length_key make 
      char_length_rec as same as char_length_key
     @ storage/heap/hp_hash.c
        Modified hp_key_cmp() function

    modified:
      mysql-test/r/heap.result
      mysql-test/t/heap.test
      storage/heap/hp_hash.c
 3867 Dmitry Shulga	2012-02-09
      Patch for bug#11764747 (formerly known as 57612): SET GLOBAL READ_ONLY=1 cannot
      progress when a table is locked with LOCK TABLES.
      
      The reason for the bug was that mysql server makes a flush of all open tables
      during handling of statement 'SET GLOBAL READ_ONLY=1'. Therefore if some of
      these tables were locked by "LOCK TABLE ... READ" from a different connection,
      then execution of statement 'SET GLOBAL READ_ONLY=1' would be waiting for
      the lock for such table even if the table was locked in a compatible read mode.
      
      Flushing of all open tables before setting of read_only system variable
      is inherited from 5.1 implementation since this was the only possible approach
      to ensure that there isn't any pending write operations on open tables.
      
      Start from version 5.5 and above such behaviour is guaranteed by the fact
      that we acquire global_read_lock before setting read_only flag. Since
      acquiring of global_read_lock is successful only when there isn't any 
      active write operation then we can remove flushing of open tables from
      processing of SET GLOBAL READ_ONLY=1.
      
      This modification changes the server behavior so that read locks held
      by other connections (LOCK TABLE ... READ) no longer will block attempts
      to enable read_only.
     @ mysql-test/t/read_only.test
        Modified testcase in order to takes into account the changed behaviour
        in processing of 'set read_only' statement.
     @ sql/sys_vars.cc
        Removed flushing of open tables from processing of
        SET GLOBAL READ_ONLY=1.

    modified:
      mysql-test/r/read_only.result
      mysql-test/t/read_only.test
      sql/sys_vars.cc
=== modified file 'mysql-test/r/heap.result'
--- a/mysql-test/r/heap.result	2011-09-27 12:17:43 +0000
+++ b/mysql-test/r/heap.result	2012-02-09 12:17:37 +0000
@@ -775,3 +775,17 @@ id	select_type	table	type	possible_keys
 3	DERIVED	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
 DROP TABLE t1,t2,h1;
 DROP VIEW v1;
+CREATE TABLE t1 (
+c1 VARCHAR(10) NOT NULL,
+KEY i1 (c1(3))
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+SELECT * FROM t1 WHERE c1='bar2';
+c1
+bar2
+#should show one tuple!
+SELECT * FROM t1 IGNORE INDEX (i1) WHERE c1='bar2';
+c1
+bar2
+#should show one tuple!
+DROP TABLE t1;

=== modified file 'mysql-test/t/heap.test'
--- a/mysql-test/t/heap.test	2011-09-27 12:17:43 +0000
+++ b/mysql-test/t/heap.test	2012-02-09 12:17:37 +0000
@@ -516,3 +516,19 @@ WHERE ('h', 0) NOT IN ( SELECT * FROM v1
 
 DROP TABLE t1,t2,h1;
 DROP VIEW v1;
+
+#
+# BUG 11755870 - 47704: HASH INDEX ON VARCHAR PREFIX NOT WORKING CORRECTLY.
+#
+CREATE TABLE t1 (
+    c1 VARCHAR(10) NOT NULL,
+    KEY i1 (c1(3))
+) ENGINE=MEMORY DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3');
+
+SELECT * FROM t1 WHERE c1='bar2';
+--echo #should show one tuple!
+
+SELECT * FROM t1 IGNORE INDEX (i1) WHERE c1='bar2';
+--echo #should show one tuple!
+DROP TABLE t1;

=== modified file 'storage/heap/hp_hash.c'
--- a/storage/heap/hp_hash.c	2011-07-21 12:54:54 +0000
+++ b/storage/heap/hp_hash.c	2012-02-09 12:17:37 +0000
@@ -652,6 +652,10 @@ int hp_key_cmp(HP_KEYDEF *keydef, const
         char_length2= my_charpos(cs, pos, pos + char_length_rec, char_length2);
         set_if_smaller(char_length_rec, char_length2);
       }
+      else
+      {
+        set_if_smaller(char_length_rec, seg->length);
+      }
 
       if (cs->coll->strnncollsp(seg->charset,
                                 (uchar*) pos, char_length_rec,

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (venkata.sidagam:3867 to 3868) Bug#11755870Venkata Sidagam10 Feb