Commit e17073c4 authored by igor@rurik.mysql.com's avatar igor@rurik.mysql.com

Merge rurik.mysql.com:/home/igor/mysql-4.1

into rurik.mysql.com:/home/igor/dev/mysql-4.1-0
parents 2b111770 9edff6c5
...@@ -277,3 +277,13 @@ Key_blocks_unused KEY_BLOCKS_UNUSED ...@@ -277,3 +277,13 @@ Key_blocks_unused KEY_BLOCKS_UNUSED
set global keycache2.key_buffer_size=0; set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100; set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0; set global keycache3.key_buffer_size=0;
create table t1 (mytext text, FULLTEXT (mytext));
insert t1 values ('aaabbb');
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
set GLOBAL key_cache_block_size=2048;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
...@@ -156,3 +156,14 @@ set global keycache2.key_buffer_size=0; ...@@ -156,3 +156,14 @@ set global keycache2.key_buffer_size=0;
# Test to set up a too small size for a key cache (bug #2064) # Test to set up a too small size for a key cache (bug #2064)
set global keycache3.key_buffer_size=100; set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0; set global keycache3.key_buffer_size=0;
# Test case for buf 6447
create table t1 (mytext text, FULLTEXT (mytext));
insert t1 values ('aaabbb');
check table t1;
set GLOBAL key_cache_block_size=2048;
check table t1;
drop table t1;
...@@ -1699,11 +1699,12 @@ byte *key_cache_read(KEY_CACHE *keycache, ...@@ -1699,11 +1699,12 @@ byte *key_cache_read(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock); keycache_pthread_mutex_unlock(&keycache->cache_lock);
goto no_key_cache; goto no_key_cache;
} }
read_length= length > keycache->key_cache_block_size ?
keycache->key_cache_block_size : length;
KEYCACHE_DBUG_ASSERT(read_length > 0);
offset= (uint) (filepos & (keycache->key_cache_block_size-1)); offset= (uint) (filepos & (keycache->key_cache_block_size-1));
filepos-= offset; filepos-= offset;
read_length= length;
set_if_smaller(read_length, keycache->key_cache_block_size-offset);
KEYCACHE_DBUG_ASSERT(read_length > 0);
#ifndef THREAD #ifndef THREAD
if (block_length > keycache->key_cache_block_size || offset) if (block_length > keycache->key_cache_block_size || offset)
return_buffer=0; return_buffer=0;
...@@ -1773,7 +1774,7 @@ byte *key_cache_read(KEY_CACHE *keycache, ...@@ -1773,7 +1774,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
return (block->buffer); return (block->buffer);
#endif #endif
buff+= read_length; buff+= read_length;
filepos+= read_length; filepos+= read_length+offset;
} while ((length-= read_length)); } while ((length-= read_length));
DBUG_RETURN(start); DBUG_RETURN(start);
...@@ -1835,12 +1836,12 @@ int key_cache_insert(KEY_CACHE *keycache, ...@@ -1835,12 +1836,12 @@ int key_cache_insert(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock); keycache_pthread_mutex_unlock(&keycache->cache_lock);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
read_length= length > keycache->key_cache_block_size ?
keycache->key_cache_block_size : length;
KEYCACHE_DBUG_ASSERT(read_length > 0);
offset= (uint) (filepos & (keycache->key_cache_block_size-1)); offset= (uint) (filepos & (keycache->key_cache_block_size-1));
/* Read data into key cache from buff in key_cache_block_size incr. */ /* Read data into key cache from buff in key_cache_block_size incr. */
filepos-= offset; filepos-= offset;
read_length= length;
set_if_smaller(read_length, keycache->key_cache_block_size-offset);
KEYCACHE_DBUG_ASSERT(read_length > 0);
inc_counter_for_resize_op(keycache); inc_counter_for_resize_op(keycache);
keycache->global_cache_r_requests++; keycache->global_cache_r_requests++;
...@@ -1882,7 +1883,7 @@ int key_cache_insert(KEY_CACHE *keycache, ...@@ -1882,7 +1883,7 @@ int key_cache_insert(KEY_CACHE *keycache,
DBUG_RETURN(1); DBUG_RETURN(1);
buff+= read_length; buff+= read_length;
filepos+= read_length; filepos+= read_length+offset;
} while ((length-= read_length)); } while ((length-= read_length));
} }
...@@ -1959,12 +1960,12 @@ int key_cache_write(KEY_CACHE *keycache, ...@@ -1959,12 +1960,12 @@ int key_cache_write(KEY_CACHE *keycache,
keycache_pthread_mutex_unlock(&keycache->cache_lock); keycache_pthread_mutex_unlock(&keycache->cache_lock);
goto no_key_cache; goto no_key_cache;
} }
read_length= length > keycache->key_cache_block_size ?
keycache->key_cache_block_size : length;
KEYCACHE_DBUG_ASSERT(read_length > 0);
offset= (uint) (filepos & (keycache->key_cache_block_size-1)); offset= (uint) (filepos & (keycache->key_cache_block_size-1));
/* Write data in key_cache_block_size increments */ /* Write data in key_cache_block_size increments */
filepos-= offset; filepos-= offset;
read_length= length;
set_if_smaller(read_length, keycache->key_cache_block_size-offset);
KEYCACHE_DBUG_ASSERT(read_length > 0);
inc_counter_for_resize_op(keycache); inc_counter_for_resize_op(keycache);
keycache->global_cache_w_requests++; keycache->global_cache_w_requests++;
...@@ -2032,7 +2033,7 @@ int key_cache_write(KEY_CACHE *keycache, ...@@ -2032,7 +2033,7 @@ int key_cache_write(KEY_CACHE *keycache,
next_block: next_block:
buff+= read_length; buff+= read_length;
filepos+= read_length; filepos+= read_length+offset;
offset= 0; offset= 0;
} while ((length-= read_length)); } while ((length-= read_length));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment