From bdf490541dc3715142fbe9a76465f040f13fb875 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Feb 2004 22:44:54 +0200 Subject: fixed comparation of tables/database names with --lower_case_table_names (BUG#2880) mysql-test/r/lowercase_table.result: test of multi-update/multi-delete mysql-test/t/lowercase_table.test: test of multi-update/multi-delete sql/sql_cache.cc: correct databese names comparation sql/sql_parse.cc: correct table names comparation in multi-delete --- sql/sql_cache.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 7c31281c926..80a3cca315e 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1228,7 +1228,12 @@ void Query_cache::invalidate(char *db) do { next= curr->next; - if (strcmp(db, (char*)(curr->table()->db())) == 0) + /* + table_alias_charset used here because it depends of + lower_case_table_names variable + */ + if (my_strcasecmp(table_alias_charset, db, + (char*)(curr->table()->db())) == 0) invalidate_table(curr); /* invalidate_table can freed block on which point 'next' (if @@ -2562,20 +2567,15 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, tables_used->db, tables_used->table->db_type)); *tables_type|= tables_used->table->file->table_cache_type(); + /* + table_alias_charset used here because it depends of + lower_case_table_names variable + */ if (tables_used->table->db_type == DB_TYPE_MRG_ISAM || tables_used->table->tmp_table != NO_TMP_TABLE || (tables_used->db_length == 5 && -#ifdef FN_NO_CASE_SENCE - my_strnncoll(system_charset_info, (uchar*)tables_used->db, 6, - (uchar*)"mysql",6) == 0 -#else - tables_used->db[0]=='m' && - tables_used->db[1]=='y' && - tables_used->db[2]=='s' && - tables_used->db[3]=='q' && - tables_used->db[4]=='l' -#endif - )) + my_strnncoll(table_alias_charset, (uchar*)tables_used->db, 6, + (uchar*)"mysql",6) == 0)) { DBUG_PRINT("qcache", ("select not cacheable: used MRG_ISAM, temporary or system table(s)")); -- cgit v1.2.1 From d4f43e511ceb9a9f010f2a504a735699a8872b9b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Mar 2004 18:32:55 +0200 Subject: invalidation of locking for write tables (BUG#2693) fixed linking query_prealloc_size to query cache presence mysql-test/r/query_cache.result: test of QC invalidation by LOCK command mysql-test/t/query_cache.test: test of QC invalidation by LOCK command sql/mysqld.cc: new variable query_cache_wlock_invalidate fixed query_prealloc_size with QC absence sql/set_var.cc: new variable query_cache_wlock_invalidate sql/sql_cache.cc: new method for table invalidation sql/sql_cache.h: new method for table invalidation sql/sql_class.h: new variable query_cache_wlock_invalidate sql/sql_parse.cc: layout fixed --- sql/sql_cache.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 63d4e4222b4..77bdcb79a8d 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1090,6 +1090,37 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used) DBUG_VOID_RETURN; } + +/* + Invalidate locked for write + + SYNOPSIS + Query_cache::invalidate_locked_for_write() + tables_used - table list + + NOTE + can be used only for opened tables +*/ +void Query_cache::invalidate_locked_for_write(TABLE_LIST *tables_used) +{ + DBUG_ENTER("Query_cache::invalidate (changed table list)"); + if (query_cache_size > 0 && tables_used) + { + STRUCT_LOCK(&structure_guard_mutex); + if (query_cache_size > 0) + { + DUMP(this); + for (; tables_used; tables_used= tables_used->next) + { + if (tables_used->lock_type & (TL_WRITE_LOW_PRIORITY | TL_WRITE)) + invalidate_table(tables_used->table); + } + } + STRUCT_UNLOCK(&structure_guard_mutex); + } + DBUG_VOID_RETURN; +} + /* Remove all cached queries that uses the given table */ -- cgit v1.2.1 From 91bac76e039a317858aa2dc95bcfc2475321fbfd Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 21 Mar 2004 11:48:51 +0200 Subject: fixed BUG in query cahe statistic counting mysql-test/r/grant_cache.result: right results in query cache mysql-test/t/grant_cache.test: proving new results sql/sql_cache.cc: fixed statistic calculating in query cahe --- sql/sql_cache.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 77bdcb79a8d..5118421464b 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -589,7 +589,6 @@ void query_cache_insert(NET *net, const char *packet, ulong length) if (!query_cache.append_result_data(&result, length, (gptr) packet, query_block)) { - query_cache.refused++; DBUG_PRINT("warning", ("Can't append data")); header->result(result); DBUG_PRINT("qcache", ("free query 0x%lx", (ulong) query_block)); @@ -845,7 +844,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) } } else - statistic_increment(refused, &structure_guard_mutex); + if (thd->lex.sql_command == SQLCOM_SELECT) + statistic_increment(refused, &structure_guard_mutex); end: DBUG_VOID_RETURN; @@ -981,7 +981,6 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) DBUG_PRINT("qcache", ("probably no SELECT access to %s.%s => return to normal processing", table_list.db, table_list.alias)); - refused++; // This is actually a hit STRUCT_UNLOCK(&structure_guard_mutex); thd->safe_to_cache_query=0; // Don't try to cache this BLOCK_UNLOCK_RD(query_block); @@ -1610,6 +1609,12 @@ void Query_cache::free_query(Query_cache_block *query_block) */ if (result_block != 0) { + if (result_block->type != Query_cache_block::RESULT) + { + // removing unfinished query + refused++; + inserts--; + } Query_cache_block *block = result_block; do { @@ -1618,6 +1623,12 @@ void Query_cache::free_query(Query_cache_block *query_block) free_memory_block(current); } while (block != result_block); } + else + { + // removing unfinished query + refused++; + inserts--; + } query->unlock_n_destroy(); free_memory_block(query_block); -- cgit v1.2.1 From 560fc0379bead7a21537df20b80beb8b73cc7c48 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Mar 2004 15:43:13 +0200 Subject: aliases should be compared with my_strcasecmp (BUG#3251) some db comparison code cleupup removed compiler warnings mysql-test/r/lowercase_table.result: test for BUG#3251 mysql-test/t/lowercase_table.test: test for BUG#3251 sql/item.cc: simple strcmp can be used for db name comparison sql/set_var.h: changed initialisation order to satisfy compiler sql/sql_cache.cc: simple strcmp can be used for db name comparison sql/sql_db.cc: better use special cherset for files sql/sql_parse.cc: simple strcmp can be used for db name comparison aliases should be compared with my_strcasecmp sql/sql_select.cc: aliases should be compared with my_strcasecmp --- sql/sql_cache.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index afeee044799..40d9b1b42d8 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1259,12 +1259,7 @@ void Query_cache::invalidate(char *db) do { next= curr->next; - /* - table_alias_charset used here because it depends of - lower_case_table_names variable - */ - if (my_strcasecmp(table_alias_charset, db, - (char*)(curr->table()->db())) == 0) + if (strcmp(db, (char*)(curr->table()->db())) == 0) invalidate_table(curr); /* invalidate_table can freed block on which point 'next' (if -- cgit v1.2.1 From ceeaa24d187b228fd6e8b1ac1e667d341155640f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2004 02:32:41 +0300 Subject: false/true -> FALSE/TRUE Fixes after last merge mysql-test/r/bdb-crash.result: fixed bad merge mysql-test/r/myisam.result: after merge fix mysql-test/r/order_by.result: fixed bad merge mysql-test/t/order_by.test: after merge fix sql/field_conv.cc: false/true -> FALSE/TRUE sql/handler.cc: false/true -> FALSE/TRUE sql/item.cc: false/true -> FALSE/TRUE sql/item_cmpfunc.cc: false/true -> FALSE/TRUE sql/item_sum.cc: false/true -> FALSE/TRUE sql/slave.cc: false/true -> FALSE/TRUE sql/sql_acl.cc: false/true -> FALSE/TRUE sql/sql_cache.cc: after merge fix sql/sql_help.cc: false/true -> FALSE/TRUE sql/sql_olap.cc: false/true -> FALSE/TRUE sql/sql_parse.cc: false/true -> FALSE/TRUE sql/sql_select.cc: fix after bad merge sql/sql_table.cc: fix after bad merge sql/sql_test.cc: false/true -> FALSE/TRUE --- sql/sql_cache.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 52b0b05a757..66422a5ed3a 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -883,9 +883,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) DBUG_PRINT("qcache", ("Another thread process same query")); } } - else - if (thd->lex.sql_command == SQLCOM_SELECT) - statistic_increment(refused, &structure_guard_mutex); + else if (thd->lex->sql_command == SQLCOM_SELECT) + statistic_increment(refused, &structure_guard_mutex); end: DBUG_VOID_RETURN; -- cgit v1.2.1 From 35a21a9c105c3f241d0cd3c64c3242a7fdcc1fa3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2004 18:47:04 +0300 Subject: query cache statistic fixed --- sql/sql_cache.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 66422a5ed3a..4e111df9263 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -795,6 +795,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) if (ask_handler_allowance(thd, tables_used)) { + refused++; STRUCT_UNLOCK(&structure_guard_mutex); DBUG_VOID_RETURN; } -- cgit v1.2.1 From 963debbe778fb17dc6d99cc33020c63c5f7cb819 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 30 Mar 2004 23:38:56 +0300 Subject: null processing for character_set_results (BUG#3296) mysql-test/r/query_cache.result: test suite for BUG#3296 mysql-test/t/query_cache.test: test suite for BUG#3296 sql/sql_cache.cc: null processing for character_set_results --- sql/sql_cache.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 4e111df9263..39061a6501b 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -780,7 +780,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used) flags.character_set_client_num= thd->variables.character_set_client->number; flags.character_set_results_num= - thd->variables.character_set_results->number; + (thd->variables.character_set_results ? + thd->variables.character_set_results->number : + UINT_MAX); flags.collation_connection_num= thd->variables.collation_connection->number; flags.limit= thd->variables.select_limit; @@ -965,7 +967,9 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) 1 : 0); flags.character_set_client_num= thd->variables.character_set_client->number; flags.character_set_results_num= - thd->variables.character_set_results->number; + (thd->variables.character_set_results ? + thd->variables.character_set_results->number : + UINT_MAX); flags.collation_connection_num= thd->variables.collation_connection->number; flags.limit= thd->variables.select_limit; memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), -- cgit v1.2.1 From 7873b89fc50d420a5f538a5b60faf79131f86c4f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Apr 2004 13:56:05 +0300 Subject: Fixed many compiler warnings Fixed bugs in group_concat with ORDER BY and DISTINCT (Bugs #2695, #3381 and #3319) Fixed crash when doing rollback in slave and the io thread catched up with the sql thread Set locked_in_memory properly include/mysql_com.h: Fixed compiler warning libmysqld/emb_qcache.cc: Removed not used variable libmysqld/lib_sql.cc: Removed not used variable myisam/mi_locking.c: Added comment myisam/mi_rnext.c: Fixed bug in concurrent insert myisam/mi_rprev.c: Simple optimization mysql-test/r/func_gconcat.result: New tests mysql-test/t/func_gconcat.test: New tests mysql-test/t/func_group.test: Cleanup sql-common/client.c: Removed compiler warning sql/derror.cc: Better comments sql/field.cc: Removed not used function/variable sql/field.h: Removed not needed variable sql/ha_innodb.cc: Removed not used function sql/item.cc: Fixed compiler warning sql/item_cmpfunc.cc: Fixed compiler warning sql/item_func.cc: Fixed compiler warning sql/item_geofunc.cc: Fixed compiler warning sql/item_sum.cc: Fixed bugs in group_concat and added more comments (Bugs #2695, #3381 and #3319) - field->abs_offset was not needed - Wrong assumption of field order in temporary table - Some not used variables removed - Added ORDER BY fields after argument fields so that code in sql_select.cc can move all fields to point to temporary tables, if needed. - Optimized loops sql/item_sum.h: Bug fixing and cleanup of group_concat() sql/log.cc: Removed wrong comment sql/log_event.cc: Removed compiler warning sql/mysqld.cc: Set locked_in_memory properly sql/protocol.cc: Removed compiler warning sql/set_var.cc: Code cleanup sql/slave.cc: Fixed crash when doing rollback in slave and the io thread catched up with the sql thread sql/sql_cache.cc: Removed compiler warnings sql/sql_derived.cc: Removed not used variable sql/sql_insert.cc: Removed compiler warnings sql/sql_lex.cc: Removed not used lable sql/sql_lex.h: Removed compiler warnings sql/sql_parse.cc: Removed compiler warnings sql/sql_prepare.cc: Removed compiler warnings sql/sql_select.cc: Removed not used variables Added function comments sql/sql_show.cc: Removed compiler warnings sql/sql_yacc.yy: Fix for ORDER BY handling in GROUP_CONCAT() --- sql/sql_cache.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/sql_cache.cc') diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 39061a6501b..e1a15eff475 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1860,11 +1860,11 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block, { // It is success (nobody can prevent us write data) STRUCT_UNLOCK(&structure_guard_mutex); - byte *rest = (byte*) data; - Query_cache_block *block = *result_block; uint headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) + ALIGN_SIZE(sizeof(Query_cache_result))); #ifndef EMBEDDED_LIBRARY + Query_cache_block *block= *result_block; + byte *rest= (byte*) data; // Now fill list of blocks that created by allocate_data_chain do { -- cgit v1.2.1