summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2006-01-04 17:49:45 +0300
committerkonstantin@mysql.com <>2006-01-04 17:49:45 +0300
commit6502e6bba75802acb2b5165e2c5878bfdd53d872 (patch)
treed0ba85a749cfceb9ceb00a014db23734e8656646 /sql/sql_cache.cc
parentb6faf80f200467e3893b9f9fb69e01eaae16f255 (diff)
parentf7d6fa6f1733e64f202e517d7391c868a53b125a (diff)
downloadmariadb-git-6502e6bba75802acb2b5165e2c5878bfdd53d872.tar.gz
Merge mysql.com:/opt/local/work/mysql-4.1-7209-new
into mysql.com:/opt/local/work/mysql-5.0-merge
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 0a01832bb39..cf3ba9c8c40 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -3050,6 +3050,7 @@ my_bool Query_cache::move_by_type(byte **border,
}
case Query_cache_block::TABLE:
{
+ HASH_SEARCH_STATE record_idx;
DBUG_PRINT("qcache", ("block 0x%lx TABLE", (ulong) block));
if (*border == 0)
break;
@@ -3067,7 +3068,7 @@ my_bool Query_cache::move_by_type(byte **border,
byte *key;
uint key_length;
key=query_cache_table_get_key((byte*) block, &key_length, 0);
- hash_search(&tables, (byte*) key, key_length);
+ hash_first(&tables, (byte*) key, key_length, &record_idx);
block->destroy();
new_block->init(len);
@@ -3101,7 +3102,7 @@ my_bool Query_cache::move_by_type(byte **border,
/* Fix pointer to table name */
new_block->table()->table(new_block->table()->db() + tablename_offset);
/* Fix hash to point at moved block */
- hash_replace(&tables, tables.current_record, (byte*) new_block);
+ hash_replace(&tables, &record_idx, (byte*) new_block);
DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx",
len, (ulong) new_block, (ulong) *border));
@@ -3109,6 +3110,7 @@ my_bool Query_cache::move_by_type(byte **border,
}
case Query_cache_block::QUERY:
{
+ HASH_SEARCH_STATE record_idx;
DBUG_PRINT("qcache", ("block 0x%lx QUERY", (ulong) block));
if (*border == 0)
break;
@@ -3126,7 +3128,7 @@ my_bool Query_cache::move_by_type(byte **border,
byte *key;
uint key_length;
key=query_cache_query_get_key((byte*) block, &key_length, 0);
- hash_search(&queries, (byte*) key, key_length);
+ hash_first(&queries, (byte*) key, key_length, &record_idx);
// Move table of used tables
memmove((char*) new_block->table(0), (char*) block->table(0),
ALIGN_SIZE(n_tables*sizeof(Query_cache_block_table)));
@@ -3194,7 +3196,7 @@ my_bool Query_cache::move_by_type(byte **border,
net->query_cache_query= (gptr) new_block;
}
/* Fix hash to point at moved block */
- hash_replace(&queries, queries.current_record, (byte*) new_block);
+ hash_replace(&queries, &record_idx, (byte*) new_block);
DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx",
len, (ulong) new_block, (ulong) *border));
break;