From 6ae9eb48d517a096ef5de054b71706f9c5351e65 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 May 2005 12:21:15 -0700 Subject: [PATCH 1/3] Increase limit of partial key length in MEMORY storage engine to the same as a full key. (Bug #10566) mysql-test/r/heap.result: Update results mysql-test/t/heap.test: Add test for bug #10566 sql/ha_heap.h: Add max_supported_key_part_length() method. --- mysql-test/r/heap.result | 5 +++++ mysql-test/t/heap.test | 9 +++++++++ sql/ha_heap.h | 1 + 3 files changed, 15 insertions(+) diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 29207a4ae98..53dec294ef8 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -291,3 +291,8 @@ a b 1 7 1 8 drop table t1; +create table t1 (c char(255), primary key(c(90))); +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1 +drop table t1; diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index e082993a58e..c0977819487 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -224,3 +224,12 @@ insert t1 (a) values (1); insert t1 (a) values (1); select * from t1; drop table t1; + +# +# Bug #10566: Verify that we can create a prefixed key with length > 255 +# +create table t1 (c char(255), primary key(c(90))); +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +--error 1062 +insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); +drop table t1; diff --git a/sql/ha_heap.h b/sql/ha_heap.h index 60e2e84c5d2..33de0156074 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -53,6 +53,7 @@ public: } const key_map *keys_to_use_for_scanning() { return &btree_keys; } uint max_supported_keys() const { return MAX_KEY; } + uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; } double scan_time() { return (double) (records+deleted) / 20.0+10; } double read_time(uint index, uint ranges, ha_rows rows) { return (double) rows / 20.0+1; } From e6ec99442dc14c4a23460da00979776b152c588a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Jun 2005 11:30:59 -0700 Subject: [PATCH 2/3] Fix hashcmp() to handle special case of zero length, which resulted in the hostname cache being ineffective. Based on patch from Jeremy Cole of Yahoo! (Bug #10931) mysys/hash.c: Fix hashcmp() to handle length == 0 as in 4.0, and document the function, including this special case. --- mysys/hash.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/mysys/hash.c b/mysys/hash.c index b829f19dfc8..ffebdf76144 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -262,7 +262,25 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink) return; } - /* Compare a key in a record to a whole key. Return 0 if identical */ +/* + Compare a key in a record to a whole key. Return 0 if identical + + SYNOPSIS + hashcmp() + hash hash table + pos position of hash record to use in comparison + key key for comparison + length length of key + + NOTES: + If length is 0, comparison is done using the length of the + record being compared against. + + RETURN + < 0 key of record < key + = 0 key of record == key + > 0 key of record > key + */ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) { @@ -270,7 +288,7 @@ static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1); return ((length && length != rec_keylength) || my_strnncoll(hash->charset, (uchar*) rec_key, rec_keylength, - (uchar*) key, length)); + (uchar*) key, rec_keylength)); } From 344f13d6f1a774ef15f7c62f88cb58ed5bca9a7f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Jun 2005 18:57:39 -0700 Subject: [PATCH 3/3] Make sure we don't mistake a "grep mysqld" for a mysqld process when checking if the server is running in mysqld_safe. (Bug #11122) configure.in: Add "grep -v grep" to FIND_PROC so we don't mistake "grep mysqld" for a mysqld process. --- configure.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index e685e811c2f..d454d23b38c 100644 --- a/configure.in +++ b/configure.in @@ -501,33 +501,33 @@ PS=$ac_cv_path_PS # Linux style if $PS p $$ 2> /dev/null | grep $0 > /dev/null then - FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null" + FIND_PROC="$PS p \$\$PID | grep -v grep | grep mysqld > /dev/null" # Solaris elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null then - FIND_PROC="$PS -p \$\$PID | grep mysqld > /dev/null" + FIND_PROC="$PS -p \$\$PID | grep -v grep | grep mysqld > /dev/null" # BSD style elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null then - FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null" + FIND_PROC="$PS -uaxww | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null" # SysV style elif $PS -ef 2> /dev/null | grep $0 > /dev/null then - FIND_PROC="$PS -ef | grep mysqld | grep \" \$\$PID \" > /dev/null" + FIND_PROC="$PS -ef | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null" # Do anybody use this? elif $PS $$ 2> /dev/null | grep $0 > /dev/null then - FIND_PROC="$PS \$\$PID | grep mysqld > /dev/null" + FIND_PROC="$PS \$\$PID | grep -v grep | grep mysqld > /dev/null" else case $SYSTEM_TYPE in *freebsd*) - FIND_PROC="$PS p \$\$PID | grep mysqld > /dev/null" + FIND_PROC="$PS p \$\$PID | grep -v grep | grep mysqld > /dev/null" ;; *darwin*) - FIND_PROC="$PS -uaxww | grep mysqld | grep \" \$\$PID \" > /dev/null" + FIND_PROC="$PS -uaxww | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null" ;; *cygwin*) - FIND_PROC="$PS -e | grep mysqld | grep \" \$\$PID \" > /dev/null" + FIND_PROC="$PS -e | grep -v grep | grep mysqld | grep \" \$\$PID \" > /dev/null" ;; *netware* | *modesto*) FIND_PROC=