summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <jani@hynda.mysql.fi>2007-06-27 17:51:35 +0300
committerunknown <jani@hynda.mysql.fi>2007-06-27 17:51:35 +0300
commitcfdd73369c0c2d57908af8dc727de33567fe9e0b (patch)
tree12bdcd18fb3072cb578c358e9acd8f5a8df3f19e /sql
parenta0fa27cf359397d721272635482a7d03687ad241 (diff)
parent5444b55cbbab69a508e6c477a1b9580eff969da1 (diff)
downloadmariadb-git-cfdd73369c0c2d57908af8dc727de33567fe9e0b.tar.gz
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into hynda.mysql.fi:/home/my/mysql-maria configure.in: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/view.test: Auto merged sql/item_func.cc: Auto merged sql/net_serv.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc14
-rw-r--r--sql/gen_lex_hash.cc4
-rw-r--r--sql/handler.cc96
-rw-r--r--sql/handler.h15
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/log.cc5
-rw-r--r--sql/mysql_priv.h7
-rw-r--r--sql/mysqld.cc158
-rw-r--r--sql/opt_range.cc1
-rw-r--r--sql/set_var.cc192
-rw-r--r--sql/set_var.h41
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_select.cc5
-rw-r--r--sql/sql_sort.h11
-rw-r--r--sql/sql_test.cc4
-rw-r--r--sql/uniques.cc2
-rw-r--r--sql/unireg.cc6
20 files changed, 511 insertions, 62 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index b1dfb4d5e71..6c72a0a2856 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -457,7 +457,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
ref_pos= ref_buff;
quick_select=select && select->quick;
record=0;
- flag= ((!indexfile && file->ha_table_flags() & HA_REC_NOT_IN_SEQ)
+ flag= ((!indexfile && (file->ha_table_flags() & HA_REC_NOT_IN_SEQ))
|| quick_select);
if (indexfile || flag)
ref_pos= &file->ref[0];
@@ -1076,7 +1076,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);
@@ -1146,7 +1146,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 */
@@ -1158,10 +1158,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
@@ -1250,7 +1250,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;
/*
@@ -1285,7 +1285,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 36b7f30dc64..18f80e11a15 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.cc b/sql/handler.cc
index b290c5acaa7..d768ad4dc5d 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -30,6 +30,10 @@
#include <myisampack.h>
#include <errno.h>
+#ifdef WITH_MARIA_STORAGE_ENGINE
+#include <maria.h>
+#endif
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
#endif
@@ -2789,6 +2793,98 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
}
+/*****************************************************************************
+ pagecache handling.
+
+ This code is only relevant for maria tables
+
+ pagecache->cache may be 0 only in the case where a key cache is not
+ initialized or when we where not able to init the key cache in a previous
+ call to ha_init_pagecache() (probably out of memory)
+*****************************************************************************/
+
+
+#ifdef WITH_MARIA_STORAGE_ENGINE
+
+/* Init a pagecache if it has not been initied before */
+
+int ha_init_pagecache(const char *name, PAGECACHE *pagecache)
+{
+ DBUG_ENTER("ha_init_key_cache");
+
+ if (!pagecache->inited)
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ long tmp_buff_size= (long) pagecache->param_buff_size;
+ uint division_limit= pagecache->param_division_limit;
+ uint age_threshold= pagecache->param_age_threshold;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ DBUG_RETURN(!init_pagecache(pagecache,
+ tmp_buff_size, division_limit, age_threshold,
+ MARIA_KEY_BLOCK_LENGTH));
+ }
+ DBUG_RETURN(0);
+}
+
+
+/* Resize key cache */
+/*
+TODO: uncomment when resize will be implemented
+int ha_resize_pagecache(PAGECACHE *pagecache)
+{
+ DBUG_ENTER("ha_resize_pagecache");
+
+ if (pagecache->inited)
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ long tmp_buff_size= (long) pagecache->param_buff_size;
+ long tmp_block_size= (long) pagecache->param_block_size;
+ uint division_limit= pagecache->param_division_limit;
+ uint age_threshold= pagecache->param_age_threshold;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ DBUG_RETURN(!resize_pagecache(pagecache, tmp_block_size,
+ tmp_buff_size,
+ division_limit, age_threshold));
+ }
+ DBUG_RETURN(0);
+}
+*/
+
+
+/* Change parameters for key cache (like size) */
+
+int ha_change_pagecache_param(PAGECACHE *pagecache)
+{
+ if (pagecache->inited)
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ uint division_limit= pagecache->param_division_limit;
+ uint age_threshold= pagecache->param_age_threshold;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ change_pagecache_param(pagecache, division_limit, age_threshold);
+ }
+ return 0;
+}
+
+/* Free memory allocated by a key cache */
+
+int ha_end_pagecache(PAGECACHE *pagecache)
+{
+ end_pagecache(pagecache, 1); // Can never fail
+ return 0;
+}
+
+/* Move all tables from one key cache to another one */
+
+int ha_change_pagecache(PAGECACHE *old_pagecache,
+ PAGECACHE *new_pagecache)
+{
+ maria_change_pagecache(old_pagecache, new_pagecache);
+ return 0;
+}
+
+#endif /* WITH_MARIA_STORAGE_ENGINE */
+
/** @brief
Try to discover one table from handler(s)
diff --git a/sql/handler.h b/sql/handler.h
index e80b62c1250..9eed5ce7f2e 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -20,8 +20,10 @@
#pragma interface /* gcc class implementation */
#endif
+#include <my_handler.h>
#include <ft_global.h>
#include <keycache.h>
+#include "../storage/maria/ma_pagecache.h"
#ifndef NO_HASH
#define NO_HASH /* Not yet implemented */
@@ -272,6 +274,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
};
@@ -851,7 +854,8 @@ typedef struct st_ha_check_opt
ulong sort_buffer_size;
uint flags; /* isam layer flags (e.g. for myisamchk) */
uint sql_flags; /* sql layer flags - for something myisamchk cannot do */
- KEY_CACHE *key_cache; /* new key cache when changing key cache */
+ KEY_CACHE *key_cache; /* new key cache when changing key cache */
+ PAGECACHE *pagecache; /* new pagecache when changing pagecache */
void init();
} HA_CHECK_OPT;
@@ -1806,6 +1810,15 @@ int ha_resize_key_cache(KEY_CACHE *key_cache);
int ha_change_key_cache_param(KEY_CACHE *key_cache);
int ha_change_key_cache(KEY_CACHE *old_key_cache, KEY_CACHE *new_key_cache);
int ha_end_key_cache(KEY_CACHE *key_cache);
+/* pagecache */
+int ha_init_pagecache(const char *name, PAGECACHE *pagecache);
+/*
+TODO: uncomment when resizing will be implemented
+int ha_resize_pagecache(PAGECACHE *pagecache);
+*/
+int ha_change_pagecache_param(PAGECACHE *pagecache);
+int ha_change_pagecache(PAGECACHE *old_pagecache, PAGECACHE *new_pagecache);
+int ha_end_pagecache(PAGECACHE *pagecache);
/* report to InnoDB that control passes to the client */
int ha_release_temporary_latches(THD *thd);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f14091b4592..5a41aa3e9da 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -27,6 +27,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 8fc68f93e12..347a4a1f084 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1368,7 +1368,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 6dc204265b0..1a7ec087c51 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2413,6 +2413,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 5a50b03282f..a14c139e926 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1644,7 +1644,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;
@@ -1718,6 +1718,9 @@ extern pthread_cond_t COND_global_read_lock;
extern pthread_attr_t connection_attrib;
extern I_List<THD> threads;
extern I_List<NAMED_LIST> key_caches;
+#ifdef WITH_MARIA_STORAGE_ENGINE
+extern I_List<NAMED_LIST> pagecaches;
+#endif /* WITH_MARIA_STORAGE_ENGINE */
extern MY_BITMAP temp_pool;
extern String my_empty_string;
extern const String my_null_string;
@@ -1743,7 +1746,7 @@ extern uint sql_command_flags[];
extern TYPELIB log_output_typelib;
/* optional things, have_* variables */
-
+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 39a7c4e9095..ddaf0c360bb 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 "rpl_mi.h"
#include "sql_repl.h"
@@ -27,6 +28,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"
@@ -439,7 +443,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;
@@ -500,6 +504,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>";
@@ -522,6 +527,9 @@ FILE *stderror_file=0;
I_List<THD> threads;
I_List<NAMED_LIST> key_caches;
+#ifdef WITH_MARIA_STORAGE_ENGINE
+I_List<NAMED_LIST> pagecaches;
+#endif /* WITH_MARIA_STORAGE_ENGINE */
Rpl_filter* rpl_filter;
Rpl_filter* binlog_filter;
@@ -1201,7 +1209,13 @@ void clean_up(bool print_message)
tc_log->close();
xid_cache_free();
delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache);
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ delete_elements(&pagecaches, (void (*)(const char*, gptr)) free_pagecache);
+#endif /* WITH_MARIA_STORAGE_ENGINE */
multi_keycache_free();
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ multi_pagecache_free();
+#endif
free_status_vars();
end_thr_alarm(1); /* Free allocated memory */
my_free_open_file_info();
@@ -2190,6 +2204,10 @@ the problem, but since we have already crashed, something is definitely wrong\n\
and this may fail.\n\n");
fprintf(stderr, "key_buffer_size=%lu\n",
(ulong) dflt_key_cache->key_cache_mem_size);
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ fprintf(stderr, "page_buffer_size=%lu\n",
+ (ulong) maria_pagecache->mem_size);
+#endif /* WITH_MARIA_STORAGE_ENGINE */
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
@@ -2197,6 +2215,9 @@ and this may fail.\n\n");
fprintf(stderr, "It is possible that mysqld could use up to \n\
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ (ulong) maria_pagecache->mem_size +
+#endif /* WITH_MARIA_STORAGE_ENGINE */
(global_system_variables.read_buff_size +
global_system_variables.sortbuff_size) *
thread_scheduler.max_threads +
@@ -2220,7 +2241,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 ? (uchar*) thd->thread_stack : (uchar*) 0,
- thread_stack);
+ my_thread_stack_size);
}
if (thd)
{
@@ -2379,9 +2400,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
@@ -2780,6 +2801,16 @@ static int init_common_variables(const char *conf_file_name, int argc,
get_options(&defaults_argc, defaults_argv);
set_server_version();
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ if (!(maria_pagecache= get_or_create_pagecache(maria_pagecache_base.str,
+ maria_pagecache_base.length)))
+ exit(1);
+/*
+ maria_pagecache->param_buff_size= maria_pagecache_var.param_buff_size;
+ maria_pagecache->param_block_size= maria_block_size;
+*/
+#endif
+
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
server_version, SYSTEM_TYPE,MACHINE_TYPE));
@@ -3554,6 +3585,9 @@ server.");
/* call ha_init_key_cache() on all key caches to init them */
process_key_caches(&ha_init_key_cache);
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ process_pagecaches(&ha_init_pagecache);
+#endif /* WITH_MARIA_STORAGE_ENGINE */
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && !defined(EMBEDDED_LIBRARY)
if (locked_in_memory && !getuid())
@@ -3744,9 +3778,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
{
@@ -3757,15 +3791,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
}
}
@@ -5009,10 +5043,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,
@@ -5026,7 +5067,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_ERROR_LOG_FILE,
OPT_DEFAULT_WEEK_FORMAT,
OPT_RANGE_ALLOC_BLOCK_SIZE, OPT_ALLOW_SUSPICIOUS_UDFS,
@@ -5980,6 +6021,40 @@ 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.",
+ (uchar**) &maria_block_size,
+ (uchar**) &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_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.",
+ (uchar**) &global_system_variables.maria_max_sort_file_size,
+ (uchar**) &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.",
+ (uchar**) &global_system_variables.maria_repair_threads,
+ (uchar**) &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.",
+ (uchar**) &global_system_variables.maria_sort_buff_size,
+ (uchar**) &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\".",
+ (uchar**) &maria_stats_method_str, (uchar**) &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.",
(uchar**) &global_system_variables.max_allowed_packet,
@@ -6083,12 +6158,6 @@ The minimum value for this variable is 4096.",
(uchar**) &myisam_data_pointer_size,
(uchar**) &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",
- (uchar**) &global_system_variables.myisam_max_extra_sort_file_size,
- (uchar**) &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.",
(uchar**) &global_system_variables.myisam_max_sort_file_size,
@@ -6136,7 +6205,7 @@ The minimum value for this variable is 4096.",
(uchar**) &global_system_variables.net_write_timeout,
(uchar**) &max_system_variables.net_write_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
- { "old", OPT_OLD_MODE, "Use compatible behavior.",
+ {"old", OPT_OLD_MODE, "Use compatible behavior.",
(uchar**) &global_system_variables.old_mode,
(uchar**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
@@ -6154,6 +6223,27 @@ The minimum value for this variable is 4096.",
(uchar**) &global_system_variables.optimizer_search_depth,
(uchar**) &max_system_variables.optimizer_search_depth,
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ {"pagecache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
+ "This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
+ (uchar**) &maria_pagecache_var.param_age_threshold,
+ (uchar**) 0,
+ 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
+ 300, 100, ~0L, 0, 100, 0},
+ {"pagecache_buffer_size", OPT_KEY_BUFFER_SIZE,
+ "The size of the buffer used for index blocks for MyISAM 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.",
+ (uchar**) &maria_pagecache_var.param_buff_size,
+ (uchar**) 0,
+ 0, (GET_ULL | GET_ASK_ADDR),
+ REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, ~(ulong) 0, MALLOC_OVERHEAD,
+ IO_SIZE, KEY_CACHE_SIZE},
+ {"pagecache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
+ "The minimum percentage of warm blocks in key cache",
+ (uchar**) &maria_pagecache_var.param_division_limit,
+ (uchar**) 0,
+ 0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
+ 1, 100, 0, 1, 0},
+#endif /* WITH_MARIA_STORAGE_ENGINE */
{"plugin_dir", OPT_PLUGIN_DIR,
"Directory for plugins.",
(uchar**) &opt_plugin_dir_ptr, (uchar**) &opt_plugin_dir_ptr, 0,
@@ -6162,7 +6252,6 @@ The minimum value for this variable is 4096.",
"Optional colon separated list of plugins to load, where each plugin is "
"identified by name and path to library seperated by an equals.",
(uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0,
- GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
"The size of the buffer that is allocated when preloading indexes",
(uchar**) &global_system_variables.preload_buff_size,
@@ -6310,8 +6399,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.", (uchar**) &thread_stack,
- (uchar**) &thread_stack, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
+ "The stack size for each thread.", (uchar**) &my_thread_stack_size,
+ (uchar**) &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).",
@@ -6324,12 +6413,12 @@ The minimum value for this variable is 4096.",
(uchar**) &max_system_variables.tmp_table_size, 0, GET_ULL,
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
- "Allocation block size for various transaction-related structures",
+ "Allocation block size for transactions to be stored in binary log",
(uchar**) &global_system_variables.trans_alloc_block_size,
(uchar**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0},
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
- "Persistent buffer for various transaction-related structures",
+ "Persistent buffer for transactions to be stored in binary log",
(uchar**) &global_system_variables.trans_prealloc_size,
(uchar**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0},
@@ -7075,15 +7164,25 @@ 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();
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ pagecaches.empty();
+#endif /* WITH_MARIA_STORAGE_ENGINE */
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 */
+
+ /* set key_cache_hash.default_value = dflt_key_cache */
+ multi_keycache_init();
+
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ /* set pagecache_hash.default_value = maria_pagecache */
+ multi_pagecache_init();
+#endif
/* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1);
@@ -7126,6 +7225,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
@@ -7657,7 +7757,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int method;
LINT_INIT(method_conv);
- myisam_stats_method_str= argument;
method= find_type_or_exit(argument, &myisam_stats_method_typelib,
opt->name);
switch (method-1) {
@@ -8131,6 +8230,9 @@ void refresh_status(THD *thd)
/* Reset the counters of all key caches (default and named). */
process_key_caches(reset_key_cache_counters);
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ process_pagecaches(reset_pagecache_counters);
+#endif /* WITH_MARIA_STORAGE_ENGINE */
pthread_mutex_unlock(&LOCK_status);
/*
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 4944c994d3d..3ee7e8ee813 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -4299,7 +4299,6 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info,
}
info->out_rows *= selectivity_mult;
- DBUG_PRINT("info", ("info->total_cost= %g", info->total_cost));
if (is_cpk_scan)
{
diff --git a/sql/set_var.cc b/sql/set_var.cc
index d9869ce6809..5b28e257f5a 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -54,6 +54,9 @@
#include <thr_alarm.h>
#include <myisam.h>
#include <my_dir.h>
+#ifdef WITH_MARIA_STORAGE_ENGINE
+#include <maria.h>
+#endif
#include "events.h"
@@ -113,6 +116,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);
@@ -121,6 +125,9 @@ static void fix_thd_mem_root(THD *thd, enum_var_type type);
static void fix_trans_mem_root(THD *thd, enum_var_type type);
static void fix_server_id(THD *thd, enum_var_type type);
static KEY_CACHE *create_key_cache(const char *name, uint length);
+#ifdef WITH_MARIA_STORAGE_ENGINE
+static PAGECACHE *create_pagecache(const char *name, uint length);
+#endif /* WITH_MARIA_STORAGE_ENGINE */
void fix_sql_mode_var(THD *thd, enum_var_type type);
static uchar *get_error_count(THD *thd);
static uchar *get_warning_count(THD *thd);
@@ -238,6 +245,14 @@ static sys_var_key_cache_long sys_key_cache_division_limit(&vars, "key_cache_div
static sys_var_key_cache_long sys_key_cache_age_threshold(&vars, "key_cache_age_threshold",
offsetof(KEY_CACHE,
param_age_threshold));
+#ifdef WITH_MARIA_STORAGE_ENGINE
+sys_var_pagecache_long sys_pagecache_division_limit("pagecache_division_limit",
+ offsetof(PAGECACHE,
+ param_division_limit));
+sys_var_pagecache_long sys_pagecache_age_threshold("pagecache_age_threshold",
+ offsetof(KEY_CACHE,
+ param_age_threshold));
+#endif /* WITH_MARIA_STORAGE_ENGINE */
static sys_var_bool_ptr sys_local_infile(&vars, "local_infile",
&opt_local_infile);
static sys_var_trust_routine_creators
@@ -330,6 +345,14 @@ static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_met
&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);
+
static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length",
&SV::net_buffer_length);
static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout",
@@ -624,6 +647,7 @@ static sys_var_have_plugin sys_have_csv(&vars, "have_csv", C_STRING_WITH_LEN("cs
static sys_var_have_variable sys_have_dlopen(&vars, "have_dynamic_loading", &have_dlopen);
static sys_var_have_variable sys_have_geometry(&vars, "have_geometry", &have_geometry);
static sys_var_have_plugin sys_have_innodb(&vars, "have_innodb", C_STRING_WITH_LEN("innodb"), MYSQL_STORAGE_ENGINE_PLUGIN);
+static sys_var_have_variable sys_have_maria_db(&vars, "have_maria", &have_maria_db);
static sys_var_have_plugin sys_have_ndbcluster(&vars, "have_ndbcluster", C_STRING_WITH_LEN("ndbcluster"), MYSQL_STORAGE_ENGINE_PLUGIN);
static sys_var_have_variable sys_have_openssl(&vars, "have_openssl", &have_ssl);
static sys_var_have_variable sys_have_ssl(&vars, "have_ssl", &have_ssl);
@@ -702,7 +726,7 @@ static SHOW_VAR fixed_vars[]= {
#ifdef HAVE_THR_SETCONCURRENCY
{"thread_concurrency", (char*) &concurrency, SHOW_LONG},
#endif
- {"thread_stack", (char*) &thread_stack, SHOW_LONG},
+ {"thread_stack", (char*) &my_thread_stack_size, SHOW_LONG},
};
@@ -839,6 +863,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
*/
@@ -1893,15 +1927,30 @@ LEX_STRING default_key_cache_base= {(char *) "default", 7 };
static KEY_CACHE zero_key_cache;
+#ifdef WITH_MARIA_STORAGE_ENGINE
+LEX_STRING maria_pagecache_base= {(char *) "default", 7 };
+static PAGECACHE zero_pagecache;
+#endif /* WITH_MARIA_STORAGE_ENGINE */
+
KEY_CACHE *get_key_cache(LEX_STRING *cache_name)
{
safe_mutex_assert_owner(&LOCK_global_system_variables);
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));
}
+#ifdef WITH_MARIA_STORAGE_ENGINE
+PAGECACHE *get_pagecache(LEX_STRING *cache_name)
+{
+ safe_mutex_assert_owner(&LOCK_global_system_variables);
+ if (!cache_name || ! cache_name->length)
+ cache_name= &default_key_cache_base;
+ return ((PAGECACHE*) find_named(&pagecaches,
+ cache_name->str, cache_name->length, 0));
+}
+#endif /* WITH_MARIA_STORAGE_ENGINE */
uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
@@ -1913,6 +1962,18 @@ uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
}
+#ifdef WITH_MARIA_STORAGE_ENGINE
+byte *sys_var_pagecache_param::value_ptr(THD *thd, enum_var_type type,
+ LEX_STRING *base)
+{
+ PAGECACHE *pagecache= get_pagecache(base);
+ if (!pagecache)
+ pagecache= &zero_pagecache;
+ return (byte*) pagecache + offset ;
+}
+#endif /* WITH_MARIA_STORAGE_ENGINE */
+
+
bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
{
ulonglong tmp= var->save_result.ulonglong_value;
@@ -2049,6 +2110,60 @@ end:
}
+#ifdef WITH_MARIA_STORAGE_ENGINE
+bool sys_var_pagecache_long::update(THD *thd, set_var *var)
+{
+ ulong tmp= (ulong) var->value->val_int();
+ LEX_STRING *base_name= &var->base;
+ bool error= 0;
+
+ if (!base_name->length)
+ base_name= &maria_pagecache_base;
+
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ PAGECACHE *pagecache= get_pagecache(base_name);
+
+ if (!pagecache && !(pagecache= create_pagecache(base_name->str,
+ base_name->length)))
+ {
+ error= 1;
+ goto end;
+ }
+
+ /*
+ Abort if some other thread is changing the key cache
+ TODO: This should be changed so that we wait until the previous
+ assignment is done and then do the new assign
+ */
+ if (pagecache->in_init)
+ goto end;
+
+ *((ulong*) (((char*) pagecache) + offset))=
+ (ulong) getopt_ull_limit_value(tmp, option_limits);
+
+ /*
+ Don't create a new key cache if it didn't exist
+ (pagecaches are created only when the user sets block_size)
+ */
+ pagecache->in_init= 1;
+
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+
+ /*
+ TODO: uncomment whan it will be implemented
+ error= (bool) (ha_resize_pagecache(pagecache));
+ */
+
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ pagecache->in_init= 0;
+
+end:
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return error;
+}
+#endif /* WITH_MARIA_STORAGE_ENGINE */
+
+
bool sys_var_log_state::update(THD *thd, set_var *var)
{
bool res= 0;
@@ -3538,12 +3653,85 @@ bool process_key_caches(int (* func) (const char *name, KEY_CACHE *))
}
+#ifdef WITH_MARIA_STORAGE_ENGINE
+
+static PAGECACHE *create_pagecache(const char *name, uint length)
+{
+ PAGECACHE *pagecache;
+ DBUG_ENTER("create_pagecache");
+ DBUG_PRINT("enter",("name: %.*s", length, name));
+
+ if ((pagecache= (PAGECACHE*) my_malloc(sizeof(PAGECACHE),
+ MYF(MY_ZEROFILL | MY_WME))))
+ {
+ if (!new NAMED_LIST(&pagecaches, name, length, (gptr) pagecache))
+ {
+ my_free((char*) pagecache, MYF(0));
+ pagecache= 0;
+ }
+ else
+ {
+ /*
+ Set default values for a key cache
+ The values in maria_pagecache_var is set by my_getopt() at startup
+ We don't set 'buff_size' as this is used to enable the key cache
+ */
+ pagecache->param_buff_size= (maria_pagecache_var.param_buff_size ?
+ maria_pagecache_var.param_buff_size:
+ KEY_CACHE_SIZE);
+ pagecache->param_division_limit= maria_pagecache_var.param_division_limit;
+ pagecache->param_age_threshold= maria_pagecache_var.param_age_threshold;
+ }
+ }
+ DBUG_RETURN(pagecache);
+}
+
+
+PAGECACHE *get_or_create_pagecache(const char *name, uint length)
+{
+ LEX_STRING pagecache_name;
+ PAGECACHE *pagecache;
+
+ pagecache_name.str= (char *) name;
+ pagecache_name.length= length;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ if (!(pagecache= get_pagecache(&pagecache_name)))
+ pagecache= create_pagecache(name, length);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return pagecache;
+}
+
+
+void free_pagecache(const char *name, PAGECACHE *pagecache)
+{
+ ha_end_pagecache(pagecache);
+ my_free((char*) pagecache, MYF(0));
+}
+
+
+bool process_pagecaches(int (* func) (const char *name, PAGECACHE *))
+{
+ I_List_iterator<NAMED_LIST> it(pagecaches);
+ NAMED_LIST *element;
+
+ while ((element= it++))
+ {
+ PAGECACHE *pagecache= (PAGECACHE *) element->data;
+ func(element->name, pagecache);
+ }
+ return 0;
+}
+
+#endif /* WITH_MARIA_STORAGE_ENGINE */
+
+
void sys_var_trust_routine_creators::warn_deprecated(THD *thd)
{
WARN_DEPRECATED(thd, "5.2", "log_bin_trust_routine_creators",
"'log_bin_trust_function_creators'");
}
+
void sys_var_trust_routine_creators::set_default(THD *thd, enum_var_type type)
{
warn_deprecated(thd);
diff --git a/sql/set_var.h b/sql/set_var.h
index a998dc93b84..ab865f312b3 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -733,6 +733,33 @@ public:
};
+#ifdef WITH_MARIA_STORAGE_ENGINE
+class sys_var_pagecache_param :public sys_var
+{
+protected:
+ size_t offset;
+public:
+ sys_var_pagecache_param(const char *name_arg, size_t offset_arg)
+ :sys_var(name_arg), offset(offset_arg)
+ {}
+ byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
+ bool check_default(enum_var_type type) { return 1; }
+ bool is_struct() { return 1; }
+};
+
+
+class sys_var_pagecache_long :public sys_var_pagecache_param
+{
+public:
+ sys_var_pagecache_long(const char *name_arg, size_t offset_arg)
+ :sys_var_pagecache_param(name_arg, offset_arg)
+ {}
+ bool update(THD *thd, set_var *var);
+ SHOW_TYPE type() { return SHOW_LONG; }
+};
+#endif /* WITH_MARIA_STORAGE_ENGINE */
+
+
class sys_var_thd_date_time_format :public sys_var_thd
{
DATE_TIME_FORMAT *SV::*offset;
@@ -1131,7 +1158,11 @@ public:
my_free((uchar*) name, MYF(0));
}
friend bool process_key_caches(int (* func) (const char *name,
- KEY_CACHE *));
+ KEY_CACHE *));
+#ifdef WITH_MARIA_STORAGE_ENGINE
+ friend bool process_pagecaches(int (* func) (const char *name,
+ PAGECACHE *));
+#endif /* WITH_MARIA_STORAGE_ENGINE */
friend void delete_elements(I_List<NAMED_LIST> *list,
void (*free_element)(const char*, uchar*));
};
@@ -1141,6 +1172,9 @@ 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;
+#ifdef WITH_MARIA_STORAGE_ENGINE
+extern LEX_STRING maria_pagecache_base;
+#endif /* WITH_MARIA_STORAGE_ENGINE */
/* For sql_yacc */
struct sys_var_with_base
@@ -1182,3 +1216,8 @@ void free_key_cache(const char *name, KEY_CACHE *key_cache);
bool process_key_caches(int (* func) (const char *name, KEY_CACHE *));
void delete_elements(I_List<NAMED_LIST> *list,
void (*free_element)(const char*, uchar*));
+#ifdef WITH_MARIA_STORAGE_ENGINE
+PAGECACHE *get_or_create_pagecache(const char *name, uint length);
+void free_pagecache(const char *name, PAGECACHE *pagecache);
+bool process_pagecaches(int (* func) (const char *name, PAGECACHE *));
+#endif /* WITH_MARIA_STORAGE_ENGINE */
diff --git a/sql/slave.cc b/sql/slave.cc
index 6c7968c2b3f..512c4bc8d12 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -28,6 +28,8 @@
#include <sql_common.h>
#include <errmsg.h>
+static Log_event* next_event(RELAY_LOG_INFO* rli);
+
#ifdef HAVE_REPLICATION
#include "rpl_tblmap.h"
diff --git a/sql/sql_class.h b/sql/sql_class.h
index c46adc62c7c..1c0d6e4c258 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -236,6 +236,7 @@ struct system_variables
uint dynamic_variables_size; /* how many bytes are in use */
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;
@@ -251,6 +252,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 a8dbebe012d..4845f45948f 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5034,10 +5034,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 067e334f73d..9cb59d957de 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>
@@ -9546,7 +9547,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->s= share;
init_tmp_table_share(share, "", 0, tmpname, tmppath);
share->blob_field= blob_field;
- share->blob_ptr_size= mi_portable_sizeof_char_ptr;
+ share->blob_ptr_size= portable_sizeof_char_ptr;
share->db_low_byte_first=1; // True for HEAP and MyISAM
share->table_charset= param->table_charset;
share->primary_key= MAX_KEY; // Indicate no primary key
@@ -10111,7 +10112,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
table->s= share;
share->blob_field= blob_field;
share->fields= field_count;
- share->blob_ptr_size= mi_portable_sizeof_char_ptr;
+ share->blob_ptr_size= portable_sizeof_char_ptr;
setup_tmp_table_column_bitmaps(table, bitmaps);
/* Create all fields and calculate the total length of record */
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 5bd01eea68c..6d75c90eb1d 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();
@@ -536,7 +536,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::dump_internal_status();
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 7a05ceaddfc..619a516e54a 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -448,7 +448,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 57847bc70c6..c74e046b133 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(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;