Below is the list of changes that have just been committed into a local
5.1 repository of mattiasj. When mattiasj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-02-04 12:28:42+01:00, mattiasj@stripped +4 -0
Bug#33379: valgrind error in parts/partition_bit_myisam
Problem was that Field_bit used Field::hash() function that did not
know about using null-byte for storing bits.
Resulting in wrong length, which was caught by valgrind.
Soluiton: created a Field_bit::hash() that uses Field_bit::val_int()
and my_charset_bin-collation function hash_sort.
mysql-test/r/partition_datatype.result@stripped, 2008-02-04 12:28:38+01:00, mattiasj@stripped +14 -0
Bug#33379: valgrind error in parts/partition_bit_myisam
result file
enabled bit test
mysql-test/t/partition_datatype.test@stripped, 2008-02-04 12:28:38+01:00, mattiasj@stripped +10 -10
Bug#33379: valgrind error in parts/partition_bit_myisam
test file
enabled bit datatype test
sql/field.cc@stripped, 2008-02-04 12:28:38+01:00, mattiasj@stripped +18 -0
Bug#33379: valgrind error in parts/partition_bit_myisam
Problem was that Field_bit used Field::hash() function that did not
know about using null-byte for storing bits.
Resulting in wrong length.
Soluiton: created a Field_bit::hash() that uses Field_bit::val_int()
and my_charset_bin-collation function hash_sort.
sql/field.h@stripped, 2008-02-04 12:28:38+01:00, mattiasj@stripped +1 -0
Bug#33379: valgrind error in parts/partition_bit_myisam
Problem was that Field_bit used Field::hash() function that did not
know about using null-byte for storing bits.
Resulting in wrong length.
Soluiton: created a Field_bit::hash().
diff -Nrup a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result
--- a/mysql-test/r/partition_datatype.result 2007-11-12 14:51:12 +01:00
+++ b/mysql-test/r/partition_datatype.result 2008-02-04 12:28:38 +01:00
@@ -1,4 +1,11 @@
drop table if exists t1;
+# test with not null
+create table t1 (a bit not null) partition by key (a);
+insert into t1 values (b'1');
+select hex(a) from t1 where a = b'1';
+hex(a)
+1
+drop table t1;
create table t1 (a tinyint not null) partition by key (a);
insert into t1 values (2);
select * from t1 where a = 2;
@@ -124,6 +131,13 @@ insert into t1 values ('y');
select * from t1 where a = 'y';
a
y
+drop table t1;
+# test with null allowed
+create table t1 (a bit) partition by key (a);
+insert into t1 values (b'1');
+select hex(a) from t1 where a = b'1';
+hex(a)
+1
drop table t1;
create table t1 (a tinyint) partition by key (a);
insert into t1 values (2);
diff -Nrup a/mysql-test/t/partition_datatype.test b/mysql-test/t/partition_datatype.test
--- a/mysql-test/t/partition_datatype.test 2007-11-12 14:51:12 +01:00
+++ b/mysql-test/t/partition_datatype.test 2008-02-04 12:28:38 +01:00
@@ -11,11 +11,11 @@
drop table if exists t1;
--enable_warnings
-# FIXME: disabled this test because of valgrind error
-#create table t1 (a bit not null) partition by key (a);
-#insert into t1 values (b'1');
-#select * from t1 where a = b'1';
-#drop table t1;
+-- echo # test with not null
+create table t1 (a bit not null) partition by key (a);
+insert into t1 values (b'1');
+select hex(a) from t1 where a = b'1';
+drop table t1;
create table t1 (a tinyint not null) partition by key (a);
insert into t1 values (2);
select * from t1 where a = 2;
@@ -100,11 +100,11 @@ create table t1 (a set('y','n') not null
insert into t1 values ('y');
select * from t1 where a = 'y';
drop table t1;
-# FIXME: disabled this test because of valgrind error
-#create table t1 (a bit) partition by key (a);
-#insert into t1 values (b'1');
-#select * from t1 where a = b'1';
-#drop table t1;
+-- echo # test with null allowed
+create table t1 (a bit) partition by key (a);
+insert into t1 values (b'1');
+select hex(a) from t1 where a = b'1';
+drop table t1;
create table t1 (a tinyint) partition by key (a);
insert into t1 values (2);
select * from t1 where a = 2;
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc 2008-01-22 23:45:41 +01:00
+++ b/sql/field.cc 2008-02-04 12:28:38 +01:00
@@ -8793,6 +8793,24 @@ Field_bit::Field_bit(uchar *ptr_arg, uin
}
+void Field_bit::hash(ulong *nr, ulong *nr2)
+{
+ if (is_null())
+ {
+ *nr^= (*nr << 1) | 1;
+ }
+ else
+ {
+ CHARSET_INFO *cs= &my_charset_bin;
+ uint len= bytes_in_rec + (bit_len ? 1 : 0);
+ longlong value= Field_bit::val_int();
+ uchar *ptr2= (uchar*) &value;
+ ptr2+= sizeof(longlong) - len;
+ cs->coll->hash_sort(cs, ptr2, len, nr, nr2);
+ }
+}
+
+
size_t
Field_bit::do_last_null_byte() const
{
diff -Nrup a/sql/field.h b/sql/field.h
--- a/sql/field.h 2008-01-10 12:18:28 +01:00
+++ b/sql/field.h 2008-02-04 12:28:38 +01:00
@@ -1904,6 +1904,7 @@ public:
Field::move_field_offset(ptr_diff);
bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*);
}
+ void hash(ulong *nr, ulong *nr2);
private:
virtual size_t do_last_null_byte() const;