mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 4.1 into 5.0.
BitKeeper/etc/logging_ok: auto-union configure.in: Auto merged BitKeeper/deleted/.del-opt_ft.cc~2048ffa561f9c59: Auto merged BitKeeper/deleted/.del-opt_ft.h~24aac1d29304599a: Auto merged client/mysql.cc: Auto merged include/my_global.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged mysql-test/install_test_db.sh: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/null.test: Auto merged mysql-test/t/rpl_until.test: Auto merged mysql-test/t/subselect.test: Auto merged sql/Makefile.am: Auto merged sql/filesort.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_union.cc: Auto merged sql/sql_update.cc: Auto merged sql-common/client.c: Auto merged
This commit is contained in:
@ -308,6 +308,10 @@ TODO list:
|
||||
#include "../myisammrg/myrg_def.h"
|
||||
#endif
|
||||
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
#include "emb_qcache.h"
|
||||
#endif
|
||||
|
||||
#if defined(EXTRA_DEBUG) && !defined(DBUG_OFF)
|
||||
#define MUTEX_LOCK(M) { DBUG_PRINT("lock", ("mutex lock 0x%lx", (ulong)(M))); \
|
||||
pthread_mutex_lock(M);}
|
||||
@ -646,7 +650,7 @@ void query_cache_abort(NET *net)
|
||||
}
|
||||
|
||||
|
||||
void query_cache_end_of_result(NET *net)
|
||||
void query_cache_end_of_result(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("query_cache_end_of_result");
|
||||
|
||||
@ -655,11 +659,15 @@ void query_cache_end_of_result(NET *net)
|
||||
if (query_cache.query_cache_size == 0) DBUG_VOID_RETURN;
|
||||
#endif
|
||||
|
||||
if (net->query_cache_query != 0) // Quick check on unlocked structure
|
||||
if (thd->net.query_cache_query != 0) // Quick check on unlocked structure
|
||||
{
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
query_cache_insert(&thd->net, (byte*)thd,
|
||||
emb_count_querycache_size(thd));
|
||||
#endif
|
||||
STRUCT_LOCK(&query_cache.structure_guard_mutex);
|
||||
Query_cache_block *query_block = ((Query_cache_block*)
|
||||
net->query_cache_query);
|
||||
thd->net.query_cache_query);
|
||||
if (query_block)
|
||||
{
|
||||
DUMP(&query_cache);
|
||||
@ -691,7 +699,7 @@ void query_cache_end_of_result(NET *net)
|
||||
// Cache was flushed or resized and query was deleted => do nothing
|
||||
STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
|
||||
}
|
||||
net->query_cache_query=0;
|
||||
thd->net.query_cache_query=0;
|
||||
DBUG_EXECUTE("check_querycache",query_cache.check_integrity(0););
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
@ -1057,23 +1065,29 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
||||
/*
|
||||
Send cached result to client
|
||||
*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
do
|
||||
{
|
||||
DBUG_PRINT("qcache", ("Results (len %lu, used %lu, headers %lu)",
|
||||
result_block->length, result_block->used,
|
||||
result_block->headers_len()+
|
||||
ALIGN_SIZE(sizeof(Query_cache_result))));
|
||||
|
||||
result_block->length, result_block->used,
|
||||
result_block->headers_len()+
|
||||
ALIGN_SIZE(sizeof(Query_cache_result))));
|
||||
|
||||
Query_cache_result *result = result_block->result();
|
||||
#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
|
||||
if (net_real_write(&thd->net, result->data(),
|
||||
result_block->used -
|
||||
result_block->headers_len() -
|
||||
ALIGN_SIZE(sizeof(Query_cache_result))))
|
||||
break; // Client aborted
|
||||
#endif
|
||||
result_block = result_block->next;
|
||||
} while (result_block != first_result_block);
|
||||
#else
|
||||
{
|
||||
Querycache_stream qs(result_block, result_block->headers_len() +
|
||||
ALIGN_SIZE(sizeof(Query_cache_result)));
|
||||
emb_load_querycache_result(thd, &qs);
|
||||
}
|
||||
#endif /*!EMBEDDED_LIBRARY*/
|
||||
|
||||
thd->limit_found_rows = query->found_rows();
|
||||
|
||||
@ -1809,18 +1823,23 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block,
|
||||
Query_cache_block *block = *result_block;
|
||||
uint headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
|
||||
ALIGN_SIZE(sizeof(Query_cache_result)));
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
// Now fill list of blocks that created by allocate_data_chain
|
||||
do
|
||||
{
|
||||
block->type = type;
|
||||
ulong length = block->used - headers_len;
|
||||
DBUG_PRINT("qcache", ("write %lu byte in block 0x%lx",length,
|
||||
(ulong)block));
|
||||
(ulong)block));
|
||||
memcpy((void*)(((byte*) block)+headers_len), (void*) rest, length);
|
||||
rest += length;
|
||||
block = block->next;
|
||||
type = Query_cache_block::RES_CONT;
|
||||
} while (block != *result_block);
|
||||
#else
|
||||
Querycache_stream qs(*result_block, headers_len);
|
||||
emb_store_querycache_result(&qs, (THD*)data);
|
||||
#endif /*!EMBEDDED_LIBRARY*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user