From: Date: May 13 2005 10:08pm Subject: bk commit into 4.0 tree (monty:1.2105) BUG#10045 List-Archive: http://lists.mysql.com/internals/24881 X-Bug: 10045 Message-Id: <20050513200831.D70713E199@narttu.mysql.com> Below is the list of changes that have just been committed into a local 4.0 repository of monty. When monty 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 1.2105 05/05/13 23:08:29 monty@stripped +3 -0 Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045) mysql-test/t/auto_increment.test 1.9 05/05/13 23:08:27 monty@stripped +12 -0 New test case mysql-test/r/auto_increment.result 1.11 05/05/13 23:08:27 monty@stripped +14 -0 New test case myisam/mi_key.c 1.22 05/05/13 23:08:27 monty@stripped +21 -10 Fixed wrong buffer usage for auto-increment key with blob part that caused CHECK TABLE to report that the table was wrong. (Bug #10045) # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: monty # Host: narttu.mysql.com # Root: /home/my/mysql-4.0 --- 1.21/myisam/mi_key.c 2004-08-01 14:25:58 +03:00 +++ 1.22/myisam/mi_key.c 2005-05-13 23:08:27 +03:00 @@ -255,8 +255,25 @@ } /* _mi_pack_key */ - /* Put a key in record */ - /* Used when only-keyread is wanted */ + +/* + Store found key in record + + SYNOPSIS + _mi_put_key_in_record() + info MyISAM handler + keynr Key number that was used + record Store key here + + Last read key is in info->lastkey + + NOTES + Used when only-keyread is wanted + + RETURN + 0 ok + 1 error +*/ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, byte *record) @@ -267,14 +284,8 @@ byte *blob_ptr; DBUG_ENTER("_mi_put_key_in_record"); - if (info->s->base.blobs && info->s->keyinfo[keynr].flag & HA_VAR_LENGTH_KEY) - { - if (!(blob_ptr= - mi_alloc_rec_buff(info, info->s->keyinfo[keynr].keylength, - &info->rec_buff))) - goto err; - } - key=(byte*) info->lastkey; + blob_ptr= info->lastkey2; /* Place to put blob parts */ + key=(byte*) info->lastkey; /* KEy that was read */ key_end=key+info->lastkey_length; for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++) { --- 1.10/mysql-test/r/auto_increment.result 2003-12-18 15:24:18 +02:00 +++ 1.11/mysql-test/r/auto_increment.result 2005-05-13 23:08:27 +03:00 @@ -131,3 +131,17 @@ 1 2 drop table t1; +CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10))); +INSERT INTO t1 (b) VALUES ('aaaa'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 (b) VALUES (''); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +INSERT INTO t1 (b) VALUES ('bbbb'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE IF EXISTS t1; --- 1.8/mysql-test/t/auto_increment.test 2003-12-18 14:40:16 +02:00 +++ 1.9/mysql-test/t/auto_increment.test 2005-05-13 23:08:27 +03:00 @@ -89,3 +89,15 @@ insert into t1 values (NULL); select * from t1; drop table t1; + +# +# BUG #10045: Problem with composite AUTO_INCREMENT + BLOB key + +CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10))); +INSERT INTO t1 (b) VALUES ('aaaa'); +CHECK TABLE t1; +INSERT INTO t1 (b) VALUES (''); +CHECK TABLE t1; +INSERT INTO t1 (b) VALUES ('bbbb'); +CHECK TABLE t1; +DROP TABLE IF EXISTS t1;