diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/filesort.cc | 12 | ||||
-rw-r--r-- | sql/gen_lex_hash.cc | 4 | ||||
-rw-r--r-- | sql/handler.h | 2 | ||||
-rw-r--r-- | sql/item_func.cc | 1 | ||||
-rw-r--r-- | sql/item_func.h | 1 | ||||
-rw-r--r-- | sql/log.cc | 5 | ||||
-rw-r--r-- | sql/mysql_priv.h | 4 | ||||
-rw-r--r-- | sql/mysqld.cc | 113 | ||||
-rw-r--r-- | sql/set_var.cc | 40 | ||||
-rw-r--r-- | sql/set_var.h | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 5 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 1 | ||||
-rw-r--r-- | sql/sql_sort.h | 11 | ||||
-rw-r--r-- | sql/sql_test.cc | 4 | ||||
-rw-r--r-- | sql/uniques.cc | 2 | ||||
-rw-r--r-- | sql/unireg.cc | 6 |
17 files changed, 162 insertions, 54 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc index 2f9a96472ca..4b0170a0db0 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -1064,7 +1064,7 @@ uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length) { - uchar *reuse_end= reuse->base + reuse->max_keys * key_length; + byte *reuse_end= reuse->base + reuse->max_keys * key_length; for (uint i= 0; i < queue->elements; ++i) { BUFFPEK *bp= (BUFFPEK *) queue_element(queue, i); @@ -1135,7 +1135,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, offset= rec_length-res_length; maxcount= (ulong) (param->keys/((uint) (Tb-Fb) +1)); to_start_filepos= my_b_tell(to_file); - strpos= (uchar*) sort_buffer; + strpos= sort_buffer; org_max_rows=max_rows= param->max_rows; /* The following will fire if there is not enough space in sort_buffer */ @@ -1147,10 +1147,10 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, DBUG_RETURN(1); /* purecov: inspected */ for (buffpek= Fb ; buffpek <= Tb ; buffpek++) { - buffpek->base= strpos; + buffpek->base= (byte*) strpos; buffpek->max_keys= maxcount; strpos+= (uint) (error= (int) read_to_buffer(from_file, buffpek, - rec_length)); + rec_length)); if (error == -1) goto err; /* purecov: inspected */ buffpek->max_keys= buffpek->mem_count; // If less data in buffers than expected @@ -1239,7 +1239,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, } } buffpek= (BUFFPEK*) queue_top(&queue); - buffpek->base= sort_buffer; + buffpek->base= (byte*) sort_buffer; buffpek->max_keys= param->keys; /* @@ -1274,7 +1274,7 @@ int merge_buffers(SORTPARAM *param, IO_CACHE *from_file, else { register uchar *end; - strpos= buffpek->key+offset; + strpos= (uchar*) buffpek->key+offset; for (end= strpos+buffpek->mem_count*rec_length ; strpos != end ; strpos+= rec_length) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 2d78999017a..7a78bcf591e 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -481,8 +481,8 @@ int main(int argc,char **argv) printf("\nstatic unsigned int symbols_max_len=%d;\n\n", max_len2); printf("\ -static inline SYMBOL *get_hash_symbol(const char *s,\n\ - unsigned int len,bool function)\n\ +static SYMBOL *get_hash_symbol(const char *s,\n\ + unsigned int len,bool function)\n\ {\n\ register uchar *hash_map;\n\ register const char *cur_str= s;\n\ diff --git a/sql/handler.h b/sql/handler.h index 82970cc1ac6..b6fd807194e 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -20,6 +20,7 @@ #pragma interface /* gcc class implementation */ #endif +#include <my_handler.h> #include <ft_global.h> #include <keycache.h> @@ -259,6 +260,7 @@ enum legacy_db_type DB_TYPE_TABLE_FUNCTION, DB_TYPE_MEMCACHE, DB_TYPE_FALCON, + DB_TYPE_MARIA, DB_TYPE_FIRST_DYNAMIC=42, DB_TYPE_DEFAULT=127 // Must be last }; diff --git a/sql/item_func.cc b/sql/item_func.cc index aa344a343de..8f3ffd00e34 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -26,6 +26,7 @@ #include <hash.h> #include <time.h> #include <ft_global.h> +#include <my_bit.h> #include "sp_head.h" #include "sp_rcontext.h" diff --git a/sql/item_func.h b/sql/item_func.h index 3306b059097..29dd524d849 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1326,7 +1326,6 @@ public: /* for fulltext search */ -#include <ft_global.h> class Item_func_match :public Item_real_func { diff --git a/sql/log.cc b/sql/log.cc index e25f008e90c..8de6e8d7d22 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2397,6 +2397,11 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, my_seek(index_file_nr,0L,MY_SEEK_END,MYF(0)), 0, MYF(MY_WME | MY_WAIT_IF_FULL))) { + /* + TODO: all operations creating/deleting the index file or a log, should + call my_sync_dir() or my_sync_dir_by_file() to be durable. + TODO: file creation should be done with my_create() not my_open(). + */ if (index_file_nr >= 0) my_close(index_file_nr,MYF(0)); return TRUE; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index bf6bd374ef8..755f7c80fc2 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1592,7 +1592,7 @@ extern ulong max_connections,max_connect_errors, connect_timeout; extern ulong slave_net_timeout, slave_trans_retries; extern uint max_user_connections; extern ulong what_to_log,flush_time; -extern ulong query_buff_size, thread_stack; +extern ulong query_buff_size; extern ulong max_prepared_stmt_count, prepared_stmt_count; extern ulong binlog_cache_size, max_binlog_cache_size, open_files_limit; extern ulong max_binlog_size, max_relay_log_size; @@ -1694,7 +1694,7 @@ extern SHOW_COMP_OPTION have_innodb; extern SHOW_COMP_OPTION have_csv_db; extern SHOW_COMP_OPTION have_ndbcluster; extern SHOW_COMP_OPTION have_partition_db; - +extern SHOW_COMP_OPTION have_maria_db; extern handlerton *partition_hton; extern handlerton *myisam_hton; extern handlerton *heap_hton; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a6525c1c78c..4b722479516 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -16,6 +16,7 @@ #include "mysql_priv.h" #include <m_ctype.h> #include <my_dir.h> +#include <my_bit.h> #include "slave.h" #include "sql_repl.h" #include "rpl_filter.h" @@ -26,6 +27,9 @@ #include "events.h" #include "../storage/myisam/ha_myisam.h" +#ifdef WITH_MARIA_STORAGE_ENGINE +#include "../storage/maria/ha_maria.h" +#endif #include "rpl_injector.h" @@ -469,7 +473,7 @@ uint volatile thread_count, thread_running; ulonglong thd_startup_options; ulong back_log, connect_timeout, concurrency, server_id; ulong table_cache_size, table_def_size; -ulong thread_stack, what_to_log; +ulong what_to_log; ulong query_buff_size, slow_launch_time, slave_open_temp_tables; ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_net_timeout, slave_trans_retries; @@ -531,6 +535,7 @@ char *mysqld_unix_port, *opt_mysql_tmpdir; const char **errmesg; /* Error messages */ const char *myisam_recover_options_str="OFF"; const char *myisam_stats_method_str="nulls_unequal"; +const char *maria_stats_method_str="nulls_unequal"; /* name of reference on left espression in rewritten IN subquery */ const char *in_left_expr_name= "<left expr>"; @@ -2224,7 +2229,7 @@ the thread stack. Please read http://www.mysql.com/doc/en/Linux.html\n\n", { fprintf(stderr,"thd: 0x%lx\n",(long) thd); print_stacktrace(thd ? (gptr) thd->thread_stack : (gptr) 0, - thread_stack); + my_thread_stack_size); } if (thd) { @@ -2368,9 +2373,9 @@ static void start_signal_handler(void) Peculiar things with ia64 platforms - it seems we only have half the stack size in reality, so we have to double it here */ - pthread_attr_setstacksize(&thr_attr,thread_stack*2); + pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2); #else - pthread_attr_setstacksize(&thr_attr,thread_stack); + pthread_attr_setstacksize(&thr_attr,my_thread_stack_size); #endif #endif @@ -3616,9 +3621,9 @@ int main(int argc, char **argv) Peculiar things with ia64 platforms - it seems we only have half the stack size in reality, so we have to double it here */ - pthread_attr_setstacksize(&connection_attrib,thread_stack*2); + pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size*2); #else - pthread_attr_setstacksize(&connection_attrib,thread_stack); + pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size); #endif #ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE { @@ -3629,15 +3634,15 @@ int main(int argc, char **argv) stack_size/= 2; #endif /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ - if (stack_size && stack_size < thread_stack) + if (stack_size && stack_size < my_thread_stack_size) { if (global_system_variables.log_warnings) sql_print_warning("Asked for %lu thread stack, but got %ld", - thread_stack, (long) stack_size); + my_thread_stack_size, (long) stack_size); #if defined(__ia64__) || defined(__ia64) - thread_stack= stack_size*2; + my_thread_stack_size= stack_size*2; #else - thread_stack= stack_size; + my_thread_stack_size= stack_size; #endif } } @@ -4886,10 +4891,17 @@ enum options_mysqld OPT_MAX_LENGTH_FOR_SORT_DATA, OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE, OPT_MAX_ERROR_COUNT, OPT_MULTI_RANGE_COUNT, OPT_MYISAM_DATA_POINTER_SIZE, + OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE, - OPT_MYISAM_USE_MMAP, + OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS, OPT_MYISAM_STATS_METHOD, + + OPT_MARIA_BLOCK_SIZE, + OPT_MARIA_MAX_SORT_FILE_SIZE, OPT_MARIA_SORT_BUFFER_SIZE, + OPT_MARIA_USE_MMAP, OPT_MARIA_REPAIR_THREADS, + OPT_MARIA_STATS_METHOD, + OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT, OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT, OPT_OPEN_FILES_LIMIT, @@ -4903,7 +4915,7 @@ enum options_mysqld OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE, OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK, - OPT_WAIT_TIMEOUT, OPT_MYISAM_REPAIR_THREADS, + OPT_WAIT_TIMEOUT, OPT_INNODB_MIRRORED_LOG_GROUPS, OPT_INNODB_LOG_FILES_IN_GROUP, OPT_INNODB_LOG_FILE_SIZE, @@ -6042,6 +6054,49 @@ log and this option does nothing anymore.", 0 #endif , 0, 2, 0, 1, 0}, +#ifdef WITH_MARIA_STORAGE_ENGINE + {"maria_block_size", OPT_MARIA_BLOCK_SIZE, + "Block size to be used for MARIA index pages.", + (gptr*) &maria_block_size, + (gptr*) &maria_block_size, 0, GET_ULONG, REQUIRED_ARG, + MARIA_KEY_BLOCK_LENGTH, MARIA_MIN_KEY_BLOCK_LENGTH, + MARIA_MAX_KEY_BLOCK_LENGTH, + 0, MARIA_MIN_KEY_BLOCK_LENGTH, 0}, + {"maria_key_buffer_size", OPT_KEY_BUFFER_SIZE, + "The size of the buffer used for index blocks for Maria tables. Increase " + "this to get better index handling (for all reads and multiple writes) to " + "as much as you can afford; 64M on a 256M machine that mainly runs MySQL " + "is quite common.", + (gptr*) &maria_key_cache_var.param_buff_size, (gptr*) 0, + 0, (GET_ULL | GET_ASK_ADDR), + REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD, + IO_SIZE, 0}, + {"maria_max_sort_file_size", OPT_MARIA_MAX_SORT_FILE_SIZE, + "Don't use the fast sort index method to created index if the temporary " + "file would get bigger than this.", + (gptr*) &global_system_variables.maria_max_sort_file_size, + (gptr*) &max_system_variables.maria_max_sort_file_size, 0, + GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE, + 0, 1024*1024, 0}, + {"maria_repair_threads", OPT_MARIA_REPAIR_THREADS, + "Number of threads to use when repairing maria tables. The value of 1 " + "disables parallel repair.", + (gptr*) &global_system_variables.maria_repair_threads, + (gptr*) &max_system_variables.maria_repair_threads, 0, + GET_ULONG, REQUIRED_ARG, 1, 1, ~0L, 0, 1, 0}, + {"maria_sort_buffer_size", OPT_MARIA_SORT_BUFFER_SIZE, + "The buffer that is allocated when sorting the index when doing a REPAIR " + "or when creating indexes with CREATE INDEX or ALTER TABLE.", + (gptr*) &global_system_variables.maria_sort_buff_size, + (gptr*) &max_system_variables.maria_sort_buff_size, 0, + GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0}, + {"maria_stats_method", OPT_MARIA_STATS_METHOD, + "Specifies how maria index statistics collection code should threat NULLs. " + "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), " + "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".", + (gptr*) &maria_stats_method_str, (gptr*) &maria_stats_method_str, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, +#endif {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "Max packetlength to send/receive from to server.", (gptr*) &global_system_variables.max_allowed_packet, @@ -6145,12 +6200,6 @@ The minimum value for this variable is 4096.", (gptr*) &myisam_data_pointer_size, (gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG, 6, 2, 7, 0, 1, 0}, - {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE, - "Deprecated option", - (gptr*) &global_system_variables.myisam_max_extra_sort_file_size, - (gptr*) &max_system_variables.myisam_max_extra_sort_file_size, - 0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH, - 0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0}, {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE, "Don't use the fast sort index method to created index if the temporary file would get bigger than this.", (gptr*) &global_system_variables.myisam_max_sort_file_size, @@ -6363,8 +6412,8 @@ The minimum value for this variable is 4096.", REQUIRED_ARG, 20, 1, 16384, 0, 1, 0}, #endif {"thread_stack", OPT_THREAD_STACK, - "The stack size for each thread.", (gptr*) &thread_stack, - (gptr*) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, + "The stack size for each thread.", (gptr*) &my_thread_stack_size, + (gptr*) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK, 1024L*128L, ~0L, 0, 1024, 0}, { "time_format", OPT_TIME_FORMAT, "The TIME format (for future).", @@ -7109,15 +7158,24 @@ static void mysql_init_variables(void) global_query_id= thread_id= 1L; strmov(server_version, MYSQL_SERVER_VERSION); myisam_recover_options_str= sql_mode_str= "OFF"; - myisam_stats_method_str= "nulls_unequal"; + myisam_stats_method_str= maria_stats_method_str= "nulls_unequal"; my_bind_addr = htonl(INADDR_ANY); threads.empty(); thread_cache.empty(); key_caches.empty(); if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str, - default_key_cache_base.length))) + default_key_cache_base.length))) exit(1); - multi_keycache_init(); /* set key_cache_hash.default_value = dflt_key_cache */ +#ifdef WITH_MARIA_STORAGE_ENGINE + if (!(maria_key_cache= get_or_create_key_cache(maria_key_cache_base.str, + maria_key_cache_base.length))) + exit(1); + maria_key_cache->param_buff_size= maria_key_cache_var.param_buff_size; + maria_key_cache->param_block_size= maria_block_size; +#endif + + /* set key_cache_hash.default_value = dflt_key_cache */ + multi_keycache_init(); /* Set directory paths */ strmake(language, LANGUAGE, sizeof(language)-1); @@ -7159,6 +7217,7 @@ static void mysql_init_variables(void) when collecting index statistics for MyISAM tables. */ global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; + global_system_variables.maria_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; /* Variables that depends on compile options */ #ifndef DBUG_OFF @@ -7176,6 +7235,11 @@ static void mysql_init_variables(void) #else have_csv_db= SHOW_OPTION_NO; #endif +#ifdef WITH_MARIA_STORAGE_ENGINE + have_maria_db= SHOW_OPTION_YES; +#else + have_maria_db= SHOW_OPTION_NO; +#endif #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE have_ndbcluster= SHOW_OPTION_DISABLED; #else @@ -7773,7 +7837,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), int method; LINT_INIT(method_conv); - myisam_stats_method_str= argument; if ((method=find_type(argument, &myisam_stats_method_typelib, 2)) <= 0) { fprintf(stderr, "Invalid value of myisam_stats_method: %s.\n", argument); @@ -8267,11 +8330,13 @@ void refresh_status(THD *thd) #undef have_innodb #undef have_ndbcluster #undef have_csv_db +#undef have_maria_db SHOW_COMP_OPTION have_innodb= SHOW_OPTION_NO; SHOW_COMP_OPTION have_ndbcluster= SHOW_OPTION_NO; SHOW_COMP_OPTION have_csv_db= SHOW_OPTION_NO; SHOW_COMP_OPTION have_partition_db= SHOW_OPTION_NO; +SHOW_COMP_OPTION have_maria_db= SHOW_OPTION_NO; #ifndef WITH_INNOBASE_STORAGE_ENGINE uint innobase_flush_log_at_trx_commit; diff --git a/sql/set_var.cc b/sql/set_var.cc index ad5559165f3..2d40cb67bab 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -55,6 +55,9 @@ #include <thr_alarm.h> #include <myisam.h> #include <my_dir.h> +#ifdef WITH_MARIA_STORAGE_ENGINE +#include <maria.h> +#endif #include "events.h" @@ -141,6 +144,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type); static void fix_query_cache_size(THD *thd, enum_var_type type); static void fix_query_cache_min_res_unit(THD *thd, enum_var_type type); static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type); +static void fix_maria_max_sort_file_size(THD *thd, enum_var_type type); static void fix_max_binlog_size(THD *thd, enum_var_type type); static void fix_max_relay_log_size(THD *thd, enum_var_type type); static void fix_max_connections(THD *thd, enum_var_type type); @@ -343,6 +347,14 @@ sys_var_thd_enum sys_myisam_stats_method("myisam_stats_method", &myisam_stats_method_typelib, NULL); +sys_var_thd_ulonglong sys_maria_max_sort_file_size("maria_max_sort_file_size", &SV::maria_max_sort_file_size, fix_maria_max_sort_file_size, 1); +sys_var_thd_ulong sys_maria_repair_threads("maria_repair_threads", &SV::maria_repair_threads); +sys_var_thd_ulong sys_maria_sort_buffer_size("maria_sort_buffer_size", &SV::maria_sort_buff_size); +sys_var_thd_enum sys_maria_stats_method("maria_stats_method", + &SV::maria_stats_method, + &myisam_stats_method_typelib, + NULL); + sys_var_thd_ulong sys_net_buffer_length("net_buffer_length", &SV::net_buffer_length); sys_var_thd_ulong sys_net_read_timeout("net_read_timeout", @@ -667,6 +679,7 @@ sys_var_have_variable sys_have_csv_db("have_csv", &have_csv_db); sys_var_have_variable sys_have_dlopen("have_dynamic_loading", &have_dlopen); sys_var_have_variable sys_have_geometry("have_geometry", &have_geometry); sys_var_have_variable sys_have_innodb("have_innodb", &have_innodb); +sys_var_have_variable sys_have_maria_db("have_maria", &have_maria_db); sys_var_have_variable sys_have_ndbcluster("have_ndbcluster", &have_ndbcluster); sys_var_have_variable sys_have_openssl("have_openssl", &have_openssl); sys_var_have_variable sys_have_partition_db("have_partitioning", @@ -792,6 +805,7 @@ SHOW_VAR init_vars[]= { {sys_have_dlopen.name, (char*) &have_dlopen, SHOW_HAVE}, {sys_have_geometry.name, (char*) &have_geometry, SHOW_HAVE}, {sys_have_innodb.name, (char*) &have_innodb, SHOW_HAVE}, + {sys_have_maria_db.name, (char*) &have_maria_db, SHOW_HAVE}, {sys_have_ndbcluster.name, (char*) &have_ndbcluster, SHOW_HAVE}, {sys_have_openssl.name, (char*) &have_openssl, SHOW_HAVE}, {sys_have_partition_db.name,(char*) &have_partition_db, SHOW_HAVE}, @@ -871,6 +885,15 @@ SHOW_VAR init_vars[]= { {sys_low_priority_updates.name, (char*) &sys_low_priority_updates, SHOW_SYS}, {"lower_case_file_system", (char*) &lower_case_file_system, SHOW_MY_BOOL}, {"lower_case_table_names", (char*) &lower_case_table_names, SHOW_INT}, + + {sys_maria_max_sort_file_size.name, (char*) &sys_maria_max_sort_file_size, + SHOW_SYS}, + {sys_maria_repair_threads.name, (char*) &sys_maria_repair_threads, + SHOW_SYS}, + {sys_maria_sort_buffer_size.name, (char*) &sys_maria_sort_buffer_size, + SHOW_SYS}, + {sys_maria_stats_method.name, (char*) &sys_maria_stats_method, SHOW_SYS}, + {sys_max_allowed_packet.name,(char*) &sys_max_allowed_packet, SHOW_SYS}, {sys_max_binlog_cache_size.name,(char*) &sys_max_binlog_cache_size, SHOW_SYS}, {sys_max_binlog_size.name, (char*) &sys_max_binlog_size, SHOW_SYS}, @@ -1019,10 +1042,10 @@ SHOW_VAR init_vars[]= { #if HAVE_POOL_OF_THREADS == 1 {sys_thread_pool_size.name, (char*) &sys_thread_pool_size, SHOW_SYS}, #endif - {"thread_stack", (char*) &thread_stack, SHOW_LONG}, + {"thread_stack", (char*) &my_thread_stack_size, SHOW_LONG}, {sys_time_format.name, (char*) &sys_time_format, SHOW_SYS}, {"time_zone", (char*) &sys_time_zone, SHOW_SYS}, - {sys_timed_mutexes.name, (char*) &sys_timed_mutexes, SHOW_SYS}, + {sys_timed_mutexes.name, (char*) &sys_timed_mutexes, SHOW_SYS}, {sys_tmp_table_size.name, (char*) &sys_tmp_table_size, SHOW_SYS}, {sys_tmpdir.name, (char*) &sys_tmpdir, SHOW_SYS}, {sys_trans_alloc_block_size.name, (char*) &sys_trans_alloc_block_size, @@ -1165,6 +1188,16 @@ fix_myisam_max_sort_file_size(THD *thd, enum_var_type type) (my_off_t) global_system_variables.myisam_max_sort_file_size; } +static void +fix_maria_max_sort_file_size(THD *thd, enum_var_type type) +{ +#ifdef WITH_MARIA_STORAGE_ENGINE + maria_max_temp_length= + (my_off_t) global_system_variables.myisam_max_sort_file_size; +#endif +} + + /* Set the OPTION_BIG_SELECTS flag if max_join_size == HA_POS_ERROR */ @@ -2364,6 +2397,7 @@ void sys_var_collation_server::set_default(THD *thd, enum_var_type type) LEX_STRING default_key_cache_base= {(char *) "default", 7 }; +LEX_STRING maria_key_cache_base= {(char *) "maria", 5 }; static KEY_CACHE zero_key_cache; @@ -2373,7 +2407,7 @@ KEY_CACHE *get_key_cache(LEX_STRING *cache_name) if (!cache_name || ! cache_name->length) cache_name= &default_key_cache_base; return ((KEY_CACHE*) find_named(&key_caches, - cache_name->str, cache_name->length, 0)); + cache_name->str, cache_name->length, 0)); } diff --git a/sql/set_var.h b/sql/set_var.h index 8887d91ec69..0540f9964e0 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -1120,6 +1120,7 @@ public: extern sys_var_thd_bool sys_old_alter_table; extern sys_var_thd_bool sys_old_passwords; extern LEX_STRING default_key_cache_base; +extern LEX_STRING maria_key_cache_base; /* For sql_yacc */ struct sys_var_with_base diff --git a/sql/sql_class.h b/sql/sql_class.h index 1f5f7aedbb4..cbfbc72d0aa 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -180,7 +180,7 @@ class Time_zone; struct system_variables { - ulonglong myisam_max_extra_sort_file_size; + ulonglong maria_max_sort_file_size; ulonglong myisam_max_sort_file_size; ulonglong max_heap_table_size; ulonglong tmp_table_size; @@ -196,6 +196,9 @@ struct system_variables ulong max_sort_length; ulong max_tmp_tables; ulong max_insert_delayed_threads; + ulong maria_repair_threads; + ulong maria_sort_buff_size; + ulong maria_stats_method; ulong multi_range_count; ulong myisam_repair_threads; ulong myisam_sort_buff_size; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 11eb510d6c8..ec2807750bd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4868,10 +4868,10 @@ bool check_stack_overrun(THD *thd, long margin, long stack_used; DBUG_ASSERT(thd == current_thd); if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >= - (long) (thread_stack - margin)) + (long) (my_thread_stack_size - margin)) { sprintf(errbuff[0],ER(ER_STACK_OVERRUN_NEED_MORE), - stack_used,thread_stack,margin); + stack_used,my_thread_stack_size,margin); my_message(ER_STACK_OVERRUN_NEED_MORE,errbuff[0],MYF(0)); thd->fatal_error(); return 1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 75b3f5ae981..f58433cd220 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -25,6 +25,7 @@ #include "sql_cursor.h" #include <m_ctype.h> +#include <my_bit.h> #include <hash.h> #include <ft_global.h> diff --git a/sql/sql_sort.h b/sql/sql_sort.h index da28ca07e2c..1572f6304e1 100644 --- a/sql/sql_sort.h +++ b/sql/sql_sort.h @@ -34,7 +34,9 @@ the callback function 'unpack_addon_fields'. */ -typedef struct st_sort_addon_field { /* Sort addon packed field */ +typedef struct st_sort_addon_field +{ + /* Sort addon packed field */ Field *field; /* Original field */ uint offset; /* Offset from the last sorted field */ uint null_offset; /* Offset to to null bit from the last sorted field */ @@ -42,13 +44,6 @@ typedef struct st_sort_addon_field { /* Sort addon packed field */ uint8 null_bit; /* Null bit mask for the field */ } SORT_ADDON_FIELD; -typedef struct st_buffpek { /* Struktur om sorteringsbuffrarna */ - my_off_t file_pos; /* Where we are in the sort file */ - uchar *base,*key; /* key pointers */ - ha_rows count; /* Number of rows in table */ - ulong mem_count; /* numbers of keys in memory */ - ulong max_keys; /* Max keys in buffert */ -} BUFFPEK; typedef struct st_sort_param { uint rec_length; /* Length of sorted records */ diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 9e30cf5878c..07bd1390116 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -459,7 +459,7 @@ void mysql_print_status() VOID(my_getwd(current_dir, sizeof(current_dir),MYF(0))); printf("Current dir: %s\n", current_dir); printf("Running threads: %d Stack size: %ld\n", thread_count, - (long) thread_stack); + (long) my_thread_stack_size); thr_print_locks(); // Write some debug info #ifndef DBUG_OFF print_cached_tables(); @@ -534,7 +534,7 @@ Estimated memory (with thread stack): %ld\n", (int) info.uordblks, (int) info.fordblks, (int) info.keepcost, - (long) (thread_count * thread_stack + info.hblkhd + info.arena)); + (long) (thread_count * my_thread_stack_size + info.hblkhd + info.arena)); #endif Events::get_instance()->dump_internal_status(); diff --git a/sql/uniques.cc b/sql/uniques.cc index 9eb827f62a3..17c9c875659 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -449,7 +449,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size, */ for (top= begin; top != end; ++top) { - top->base= merge_buffer + (top - begin) * piece_size; + top->base= (byte*) (merge_buffer + (top - begin) * piece_size); top->max_keys= max_key_count_per_piece; bytes_read= read_to_buffer(file, top, key_length); if (bytes_read == (uint) (-1)) diff --git a/sql/unireg.cc b/sql/unireg.cc index d90420313a6..c55d6db3c85 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -284,8 +284,10 @@ bool mysql_create_frm(THD *thd, const char *file_name, my_free((gptr) keybuff, MYF(0)); if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) && - my_sync(file, MYF(MY_WME))) - goto err2; + (my_sync(file, MYF(MY_WME)) || + my_sync_dir_by_file(file_name, MYF(MY_WME)))) + goto err2; + if (my_close(file,MYF(MY_WME))) goto err3; |