From 010733cb1323c7a88f8d15d0834dd98258274bca Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 26 Oct 2010 16:58:52 +0200 Subject: Make the skip-on-windows check as the first one, as the master-slave include fails on windows. --- mysql-test/suite/rpl/t/rpl_loaddata_symlink.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test index 63e65834e5b..69b481bddd1 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_symlink.test @@ -3,8 +3,8 @@ # This test verifies if loading data infile will work fine # if the path of the load data file is a symbolic link. # ---source include/master-slave.inc --source include/not_windows.inc +--source include/master-slave.inc --source include/have_binlog_format_statement.inc create table t1(a int not null auto_increment, b int, primary key(a) ); -- cgit v1.2.1 From 2e02037288fcf179f498780de24773c59191d801 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 20 Oct 2010 21:42:17 +0200 Subject: Show the number of warm keycache blocks in SHOW STATUS --- sql/mysqld.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 64cefa0f928..97b405b6354 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7929,6 +7929,7 @@ SHOW_VAR status_vars[]= { {"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG}, {"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG}, {"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG}, + {"Key_blocks_warm", (char*) offsetof(KEY_CACHE, warm_blocks), SHOW_KEY_CACHE_LONG}, {"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG}, {"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG}, {"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG}, -- cgit v1.2.1 From 1d8ad7e54ce672b2bfa28cc1e0cdef3aee3e8eb1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 22 Oct 2010 10:32:54 +0200 Subject: workaround for MySQL BUG#57491 --- client/mysqltest.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 6dd6252c64a..60b7501b0cd 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -722,6 +722,10 @@ void handle_no_error(struct st_command*); #ifdef EMBEDDED_LIBRARY +/* workaround for MySQL BUG#57491 */ +#undef MY_WME +#define MY_WME 0 + /* attributes of the query thread */ pthread_attr_t cn_thd_attrib; -- cgit v1.2.1 From 4cb9a326cfc286a3e57f5f3901b14ad9064d8557 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 27 Oct 2010 10:41:45 +0200 Subject: Fix test failure (timeout) in --valgrind tests in Buildbot. The main.ps_ddl test does SELECT * FROM mysql.general_log; that can be really expensive with --valgrind if previous test cases put lots of data in the general log since last server restart. Fix by truncating the log at test start. --- mysql-test/r/ps_ddl.result | 1 + mysql-test/t/ps_ddl.test | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result index 375f31ef9c4..a5e71e114ca 100644 --- a/mysql-test/r/ps_ddl.result +++ b/mysql-test/r/ps_ddl.result @@ -4,6 +4,7 @@ drop procedure if exists p_verify_reprepare_count; drop procedure if exists p1; drop function if exists f1; drop view if exists v1, v2; +TRUNCATE TABLE mysql.general_log; create procedure p_verify_reprepare_count(expected int) begin declare old_reprepare_count int default @reprepare_count; diff --git a/mysql-test/t/ps_ddl.test b/mysql-test/t/ps_ddl.test index 1543c757908..10a96285451 100644 --- a/mysql-test/t/ps_ddl.test +++ b/mysql-test/t/ps_ddl.test @@ -58,6 +58,10 @@ drop function if exists f1; drop view if exists v1, v2; --enable_warnings +# Avoid selecting from a huge table possibly left over from previous tests, +# as this really hurts --valgrind testing. +TRUNCATE TABLE mysql.general_log; + delimiter |; create procedure p_verify_reprepare_count(expected int) begin -- cgit v1.2.1 From c6b19ea001965b350df1248c33f709127d2c7e47 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 29 Oct 2010 09:56:45 +0200 Subject: mysqltest: Fix reversed error check, causing truncated output when testcase fails. Also fix missing zero termination in DBUG_PRINT, causing garbage output in --debug output. --- client/mysqltest.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 60b7501b0cd..fbd76445e37 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -609,14 +609,14 @@ public: lines++; int show_offset= 0; - char buf[256]; + char buf[256+1]; /* + zero termination for DBUG_PRINT */ size_t bytes; bool found_bof= false; /* Search backward in file until "lines" newline has been found */ while (lines && !found_bof) { - show_offset-= sizeof(buf); + show_offset-= sizeof(buf)-1; while(fseek(m_file, show_offset, SEEK_END) != 0 && show_offset < 0) { found_bof= true; @@ -624,7 +624,7 @@ public: show_offset++; } - if ((bytes= fread(buf, 1, sizeof(buf), m_file)) <= 0) + if ((bytes= fread(buf, 1, sizeof(buf)-1, m_file)) <= 0) { // ferror=0 will happen here if no queries executed yet if (ferror(m_file)) @@ -634,6 +634,7 @@ public: DBUG_VOID_RETURN; } + IF_DBUG(buf[bytes]= '\0';) DBUG_PRINT("info", ("Read %lu bytes from file, buf: %s", (unsigned long)bytes, buf)); @@ -678,8 +679,8 @@ public: } } - while ((bytes= fread(buf, 1, sizeof(buf), m_file)) > 0) - if (fwrite(buf, 1, bytes, stderr)) + while ((bytes= fread(buf, 1, sizeof(buf)-1, m_file)) > 0) + if (bytes != fwrite(buf, 1, bytes, stderr)) die("Failed to write to '%s', errno: %d", m_file_name, errno); -- cgit v1.2.1 From 716f7843757f96649cca1f5dc3df5d9659b17da9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 29 Oct 2010 20:29:43 +0200 Subject: sane implementation of Key_% status variables. --- include/keycache.h | 12 ---- mysys/mf_keycache.c | 159 ---------------------------------------------- sql/mysql_priv.h | 3 +- sql/mysqld.cc | 47 ++++++++++++-- sql/sql_show.cc | 38 ----------- sql/sql_test.cc | 14 ++-- storage/myisam/mi_test2.c | 15 +++-- 7 files changed, 59 insertions(+), 229 deletions(-) diff --git a/include/keycache.h b/include/keycache.h index 25a204cede2..21189fe6c6d 100644 --- a/include/keycache.h +++ b/include/keycache.h @@ -107,9 +107,6 @@ typedef void (*GET_KEY_CACHE_STATISTICS) (void *keycache_cb, uint partition_no, KEY_CACHE_STATISTICS *key_cache_stats); -typedef - ulonglong (*GET_KEY_CACHE_STAT_VALUE) - (void *keycache_cb, uint var_no); /* An object of the type KEY_CACHE_FUNCS contains pointers to all functions @@ -134,7 +131,6 @@ typedef struct st_key_cache_funcs RESET_KEY_CACHE_COUNTERS reset_counters; END_KEY_CACHE end; GET_KEY_CACHE_STATISTICS get_stats; - GET_KEY_CACHE_STAT_VALUE get_stat_val; } KEY_CACHE_FUNCS; @@ -153,13 +149,6 @@ typedef struct st_key_cache my_bool in_init; /* Set to 1 in MySQL during init/resize */ uint partitions; /* actual number of partitions */ size_t key_cache_mem_size; /* specified size of the cache memory */ - ulong blocks_used; /* maximum number of concurrently used blocks */ - ulong blocks_unused; /* number of currently unused blocks */ - ulong global_blocks_changed; /* number of currently dirty blocks */ - ulonglong global_cache_w_requests;/* number of write requests (write hits) */ - ulonglong global_cache_write; /* number of writes from cache to files */ - ulonglong global_cache_r_requests;/* number of read requests (read hits) */ - ulonglong global_cache_read; /* number of reads from files to cache */ } KEY_CACHE; @@ -193,7 +182,6 @@ extern void end_key_cache(KEY_CACHE *keycache, my_bool cleanup); extern void get_key_cache_statistics(KEY_CACHE *keycache, uint partition_no, KEY_CACHE_STATISTICS *key_cache_stats); -extern ulonglong get_key_cache_stat_value(KEY_CACHE *keycache, uint var_no); /* Functions to handle multiple key caches */ extern my_bool multi_keycache_init(void); diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 08c160910c7..9c96d387aa0 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -4914,61 +4914,6 @@ void get_simple_key_cache_statistics(SIMPLE_KEY_CACHE_CB *keycache, } -/* - Offsets of the statistical values in the control block for a simple key cache - The first NO_LONG_KEY_CACHE_STAT_VARIABLES=3 are of the ulong type while the - remaining are of the ulonglong type. - */ -static size_t simple_key_cache_stat_var_offsets[]= -{ - offsetof(SIMPLE_KEY_CACHE_CB, blocks_used), - offsetof(SIMPLE_KEY_CACHE_CB, blocks_unused), - offsetof(SIMPLE_KEY_CACHE_CB, global_blocks_changed), - offsetof(SIMPLE_KEY_CACHE_CB, global_cache_w_requests), - offsetof(SIMPLE_KEY_CACHE_CB, global_cache_write), - offsetof(SIMPLE_KEY_CACHE_CB, global_cache_r_requests), - offsetof(SIMPLE_KEY_CACHE_CB, global_cache_read) -}; - - -/* - Get the value of a statistical variable for a simple key cache - - SYNOPSIS - get_simple_key_cache_stat_value() - keycache pointer to the control block of a simple key cache - var_no the ordered number of a statistical variable - - DESCRIPTION - This function is the implementation of the get_simple_key_cache_stat_value - interface function that is employed by simple (non-partitioned) key caches. - The function takes the parameter keycache as a pointer to the - control block structure of the type SIMPLE_KEY_CACHE_CB for a simple key - cache. This function returns the value of the statistical variable var_no - for this key cache. The variables are numbered starting from 0 to 6. - - RETURN - The value of the specified statistical variable - -*/ - -static -ulonglong get_simple_key_cache_stat_value(SIMPLE_KEY_CACHE_CB *keycache, - uint var_no) -{ - size_t var_ofs= simple_key_cache_stat_var_offsets[var_no]; - ulonglong res= 0; - DBUG_ENTER("get_simple_key_cache_stat_value"); - - if (var_no < 3) - res= (ulonglong) (*(long *) ((char *) keycache + var_ofs)); - else - res= *(ulonglong *) ((char *) keycache + var_ofs); - - DBUG_RETURN(res); -} - - /* The array of pointer to the key cache interface functions used for simple key caches. Any simple key cache objects including those incorporated into @@ -4990,7 +4935,6 @@ static KEY_CACHE_FUNCS simple_key_cache_funcs = (RESET_KEY_CACHE_COUNTERS) reset_simple_key_cache_counters, (END_KEY_CACHE) end_simple_key_cache, (GET_KEY_CACHE_STATISTICS) get_simple_key_cache_statistics, - (GET_KEY_CACHE_STAT_VALUE) get_simple_key_cache_stat_value }; @@ -5861,61 +5805,6 @@ get_partitioned_key_cache_statistics(PARTITIONED_KEY_CACHE_CB *keycache, DBUG_VOID_RETURN; } -/* - Get the value of a statistical variable for a partitioned key cache - - SYNOPSIS - get_partitioned_key_cache_stat_value() - keycache pointer to the control block of a partitioned key cache - var_no the ordered number of a statistical variable - - DESCRIPTION - This function is the implementation of the get_key_cache_stat_value - interface function that is employed by partitioned key caches. - The function takes the parameter keycache as a pointer to the - control block structure of the type PARTITIONED_KEY_CACHE_CB for a - partitioned key cache. - This function returns the value of the statistical variable var_no - for this key cache. The variables are numbered starting from 0 to 6. - The returned value is calculated as the sum of the values of the - statistical variable with number var_no for all simple key caches that - comprise the partitioned key cache. - - RETURN - The value of the specified statistical variable -*/ - -static -ulonglong -get_partitioned_key_cache_stat_value(PARTITIONED_KEY_CACHE_CB *keycache, - uint var_no) -{ - uint i; - uint partitions= keycache->partitions; - size_t var_ofs= simple_key_cache_stat_var_offsets[var_no]; - ulonglong res= 0; - DBUG_ENTER("get_partitioned_key_cache_stat_value"); - - if (var_no < NUM_LONG_KEY_CACHE_STAT_VARIABLES) - { - for (i = 0; i < partitions; i++) - { - SIMPLE_KEY_CACHE_CB *partition= keycache->partition_array[i]; - res+= (ulonglong) (*(long *) ((char *) partition + var_ofs)); - } - } - else - { - for (i = 0; i < partitions; i++) - { - SIMPLE_KEY_CACHE_CB *partition= keycache->partition_array[i]; - res+= *(ulonglong *) ((char *) partition + var_ofs); - } - } - DBUG_RETURN(res); -} - - /* The array of pointers to the key cache interface functions used by partitioned key caches. Any partitioned key cache object caches exploits @@ -5938,7 +5827,6 @@ static KEY_CACHE_FUNCS partitioned_key_cache_funcs = (RESET_KEY_CACHE_COUNTERS) reset_partitioned_key_cache_counters, (END_KEY_CACHE) end_partitioned_key_cache, (GET_KEY_CACHE_STATISTICS) get_partitioned_key_cache_statistics, - (GET_KEY_CACHE_STAT_VALUE) get_partitioned_key_cache_stat_value }; @@ -6246,8 +6134,6 @@ uchar *key_cache_read(KEY_CACHE *keycache, block_length, return_buffer); /* We can't use mutex here as the key cache may not be initialized */ - keycache->global_cache_r_requests++; - keycache->global_cache_read++; if (my_pread(file, (uchar*) buff, length, filepos, MYF(MY_NABP))) return (uchar *) 0; @@ -6356,8 +6242,6 @@ int key_cache_write(KEY_CACHE *keycache, block_length, force_write); /* We can't use mutex here as the key cache may not be initialized */ - keycache->global_cache_w_requests++; - keycache->global_cache_write++; if (my_pwrite(file, buff, length, filepos, MYF(MY_NABP | MY_WAIT_IF_FULL))) return 1; @@ -6474,49 +6358,6 @@ void get_key_cache_statistics(KEY_CACHE *keycache, uint partition_no, } } - -/* - Get the value of a statistical variable for a key cache - - SYNOPSIS - get_key_cache_stat_value() - keycache pointer to the key cache to get statistics for - var_no the ordered number of a statistical variable - - DESCRIPTION - This function returns the value of the statistical variable var_no for - the key cache keycache. The variables are numbered starting from 0 to 6. - - RETURN - The value of the specified statistical variable. - - NOTES - Currently for any key cache the function can return values for the - following 7 statistical variables: - - Name Number - - blocks_used 0 - blocks_unused 1 - blocks_changed 2 - read_requests 3 - reads 4 - write_requests 5 - writes 6 -*/ - -ulonglong get_key_cache_stat_value(KEY_CACHE *keycache, uint var_no) -{ - if (keycache->key_cache_inited) - { - return keycache->interface_funcs->get_stat_val(keycache->keycache_cb, - var_no); - } - else - return 0; -} - - /* Repartition a key cache diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8815f60d9e2..c40b19eef75 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -33,8 +33,7 @@ that is defined in mysql/plugin.h it has to be before mysql/plugin.h is included. */ -#define SHOW_always_last SHOW_KEY_CACHE_LONG, \ - SHOW_KEY_CACHE_LONGLONG, SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \ +#define SHOW_always_last SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, \ SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \ SHOW_LONG_NOFLUSH, SHOW_LONGLONG_STATUS diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 422bd753c98..b824b8ad680 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7948,6 +7948,45 @@ static int show_ssl_get_cipher_list(THD *thd, SHOW_VAR *var, char *buff) #endif /* HAVE_OPENSSL */ +static int show_default_keycache(THD *thd, SHOW_VAR *var, char *buff) +{ + struct st_data { + KEY_CACHE_STATISTICS stats; + SHOW_VAR var[8]; + } *data; + SHOW_VAR *v; + + data=(st_data *)buff; + v= data->var; + + var->type= SHOW_ARRAY; + var->value= (char*)v; + + get_key_cache_statistics(dflt_key_cache, 0, &data->stats); + +#define set_one_keycache_var(X,Y) \ + v->name= X; \ + v->type= SHOW_LONGLONG; \ + v->value= (char*)&data->stats.Y; \ + v++; + + set_one_keycache_var("blocks_not_flushed", blocks_changed); + set_one_keycache_var("blocks_unused", blocks_unused); + set_one_keycache_var("blocks_used", blocks_used); + set_one_keycache_var("read_requests", read_requests); + set_one_keycache_var("reads", reads); + set_one_keycache_var("write_requests", write_requests); + set_one_keycache_var("writes", writes); + + v->name= 0; + + DBUG_ASSERT((char*)(v+1) <= buff + SHOW_VAR_FUNC_BUFF_SIZE); + +#undef set_one_keycache_var + + return 0; +} + /* Variables shown by SHOW STATUS in alphabetical order @@ -7990,13 +8029,7 @@ SHOW_VAR status_vars[]= { {"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS}, {"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS}, {"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS}, - {"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG}, - {"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG}, - {"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG}, - {"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG}, - {"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG}, - {"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG}, - {"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG}, + {"Key", (char*) &show_default_keycache, SHOW_FUNC}, {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, {"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH}, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 437a9607d14..8f1f938d36e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2292,34 +2292,6 @@ void remove_status_vars(SHOW_VAR *list) -static void update_key_cache_stat_var(KEY_CACHE *key_cache, size_t ofs) -{ - uint var_no; - if (ofs == offsetof(KEY_CACHE, blocks_used) || - ofs == offsetof(KEY_CACHE, blocks_unused) || - ofs == offsetof(KEY_CACHE, global_blocks_changed)) - { - var_no= (ofs-offsetof(KEY_CACHE, blocks_used))/sizeof(ulong); - *(ulong *)((char *) key_cache + ofs)= - (ulong) get_key_cache_stat_value(key_cache, var_no); - return; - } - - if (ofs == offsetof(KEY_CACHE, global_cache_r_requests) || - ofs == offsetof(KEY_CACHE, global_cache_read) || - ofs == offsetof(KEY_CACHE, global_cache_w_requests) || - ofs == offsetof(KEY_CACHE, global_cache_write)) - { - var_no= NUM_LONG_KEY_CACHE_STAT_VARIABLES + - (ofs-offsetof(KEY_CACHE, global_cache_w_requests))/ - sizeof(ulonglong); - *(ulonglong *)((char *) key_cache + ofs)= - get_key_cache_stat_value(key_cache, var_no); - return; - } -} - - static bool show_status_array(THD *thd, const char *wild, SHOW_VAR *variables, enum enum_var_type value_type, @@ -2451,16 +2423,6 @@ static bool show_status_array(THD *thd, const char *wild, end= strend(pos); break; } - case SHOW_KEY_CACHE_LONG: - update_key_cache_stat_var(dflt_key_cache, (size_t) value); - value= (char*) dflt_key_cache + (ulong)value; - end= int10_to_str(*(long*) value, buff, 10); - break; - case SHOW_KEY_CACHE_LONGLONG: - update_key_cache_stat_var(dflt_key_cache, (size_t) value); - value= (char*) dflt_key_cache + (ulong)value; - end= longlong10_to_str(*(longlong*) value, buff, 10); - break; case SHOW_UNDEF: break; // Return empty string case SHOW_SYS: // Cannot happen diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 5c9077f86ea..541fcc155af 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -441,6 +441,9 @@ static int print_key_cache_status(const char *name, KEY_CACHE *key_cache) } else { + KEY_CACHE_STATISTICS stats; + get_key_cache_statistics(key_cache, 0, &stats); + printf("%s\n\ Buffer_size: %10lu\n\ Block_size: %10lu\n\ @@ -457,11 +460,12 @@ reads: %10s\n\n", (ulong) key_cache->param_buff_size, key_cache->param_block_size, key_cache->param_division_limit, key_cache->param_age_threshold, key_cache->param_partitions, - key_cache->blocks_used,key_cache->global_blocks_changed, - llstr(key_cache->global_cache_w_requests,llbuff1), - llstr(key_cache->global_cache_write,llbuff2), - llstr(key_cache->global_cache_r_requests,llbuff3), - llstr(key_cache->global_cache_read,llbuff4)); + (ulong)stats.blocks_used, + (ulong)stats.blocks_changed, + llstr(stats.write_requests,llbuff1), + llstr(stats.writes,llbuff2), + llstr(stats.read_requests,llbuff3), + llstr(stats.reads,llbuff4)); } return 0; } diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 527c5e03a27..c463f0e3daa 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -812,6 +812,8 @@ end: mi_panic(HA_PANIC_CLOSE); /* Should close log */ if (!silent) { + KEY_CACHE_STATISTICS stats; + printf("\nFollowing test have been made:\n"); printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,opt_delete); if (rec_pointer_size) @@ -834,6 +836,7 @@ end: puts("Locking used"); if (use_blob) puts("blobs used"); + get_key_cache_statistics(dflt_key_cache, 0, &stats); printf("key cache status: \n\ blocks used:%10lu\n\ not flushed:%10lu\n\ @@ -841,12 +844,12 @@ w_requests: %10lu\n\ writes: %10lu\n\ r_requests: %10lu\n\ reads: %10lu\n", - dflt_key_cache->blocks_used, - dflt_key_cache->global_blocks_changed, - (ulong) dflt_key_cache->global_cache_w_requests, - (ulong) dflt_key_cache->global_cache_write, - (ulong) dflt_key_cache->global_cache_r_requests, - (ulong) dflt_key_cache->global_cache_read); + (ulong) stats.blocks_used, + (ulong) stats.blocks_changed, + (ulong) stats.write_requests, + (ulong) stats.writes, + (ulong) stats.read_requests, + (ulong) stats.reads); } end_key_cache(dflt_key_cache,1); if (blob_buffer) -- cgit v1.2.1 From 5789f96c624d00aeef137602ab0c4828620748e8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 30 Oct 2010 19:54:38 +0200 Subject: fix LIKE in a vcol function, broken by a fix for mysql bug#54568. don't set view_prepare_mode when opening a base table (either in SHOW CREATE or in I_S.TABLES) --- mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc | 2 +- mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result | 4 ++-- mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result | 4 ++-- sql/table.cc | 5 +++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc b/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc index daf59c38a7e..4f6b960f9d0 100644 --- a/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc +++ b/mysql-test/suite/vcol/inc/vcol_supported_sql_funcs_main.inc @@ -407,7 +407,7 @@ let $rows = 1; --source suite/vcol/inc/vcol_supported_sql_funcs.inc --echo # LIKE -let $cols = a varchar(10), b bool as (a like 'H%o'); +let $cols = a varchar(10), b bool as (a like 'H%!o' escape '!'); let $values1 = 'Hello',default; let $values2 = 'MySQL',default; let $rows = 2; diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result index 2bc652a7da2..83f755a2e7f 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result @@ -968,12 +968,12 @@ drop table t1; set sql_warnings = 0; # LIKE set sql_warnings = 1; -create table t1 (a varchar(10), b bool as (a like 'H%o')); +create table t1 (a varchar(10), b bool as (a like 'H%!o' escape '!')); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%o') VIRTUAL + `b` tinyint(1) AS (a like 'H%!o' escape '!') VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result index a94e220180c..844aae38af2 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result @@ -968,12 +968,12 @@ drop table t1; set sql_warnings = 0; # LIKE set sql_warnings = 1; -create table t1 (a varchar(10), b bool as (a like 'H%o')); +create table t1 (a varchar(10), b bool as (a like 'H%!o' escape '!')); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%o') VIRTUAL + `b` tinyint(1) AS (a like 'H%!o' escape '!') VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); diff --git a/sql/table.cc b/sql/table.cc index 8b0d02407c9..7a2581d5ab8 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2074,6 +2074,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, bool error_reported= FALSE; uchar *record, *bitmaps; Field **field_ptr, **vfield_ptr; + bool save_view_prepare_mode= thd->lex->view_prepare_mode; DBUG_ENTER("open_table_from_share"); DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str, share->table_name.str, (long) outparam)); @@ -2081,6 +2082,8 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, /* Parsing of partitioning information from .frm needs thd->lex set up. */ DBUG_ASSERT(thd->lex->is_lex_started); + thd->lex->view_prepare_mode= FALSE; // not a view + error= 1; bzero((char*) outparam, sizeof(*outparam)); outparam->in_use= thd; @@ -2412,6 +2415,7 @@ partititon_err: HA_HAS_OWN_BINLOGGING); thd->status_var.opened_tables++; + thd->lex->view_prepare_mode= save_view_prepare_mode; DBUG_RETURN (0); err: @@ -2424,6 +2428,7 @@ partititon_err: #endif outparam->file= 0; // For easier error checking outparam->db_stat=0; + thd->lex->view_prepare_mode= save_view_prepare_mode; free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN (error); -- cgit v1.2.1