summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2008-03-31 10:40:39 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2008-03-31 10:40:39 +0300
commitc13eb355bbbe275a83ad73da264358a25528955b (patch)
treeafdcfa074599e5684ac6de2dfec247cda696263a /sql
parentf6229d3d9aac8600f05368f1289c0b3bbb05fc14 (diff)
parentf5f7a59ff8fa886fcc55366df97c339320dc456a (diff)
downloadmariadb-git-c13eb355bbbe275a83ad73da264358a25528955b.tar.gz
Merge bk-internal:/home/bk/mysql-5.1
into magare.gmz:/home/kgeorge/mysql/work/merge-build-5.1-bugteam include/my_dbug.h: Auto merged mysys/mf_keycache.c: Auto merged sql/item_func.cc: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_select.cc: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_dynrec.c: Auto merged storage/myisam/mi_open.c: Auto merged storage/myisam/mi_packrec.c: Auto merged storage/myisam/mi_test1.c: Auto merged storage/myisam/mi_test2.c: Auto merged storage/myisam/mi_write.c: Auto merged storage/myisammrg/ha_myisammrg.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/gen_lex_hash.cc4
-rw-r--r--sql/ha_partition.cc20
-rw-r--r--sql/ha_partition.h2
-rw-r--r--sql/handler.cc12
-rw-r--r--sql/handler.h5
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/lex.h7
-rw-r--r--sql/log.cc5
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/mysqld.cc63
-rw-r--r--sql/opt_range.cc4
-rw-r--r--sql/set_var.cc2
-rw-r--r--sql/sql_class.cc1
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_plugin.cc7
-rw-r--r--sql/sql_select.cc5
-rw-r--r--sql/sql_show.cc24
-rw-r--r--sql/sql_table.cc10
-rw-r--r--sql/sql_test.cc4
-rw-r--r--sql/sql_yacc.yy29
-rw-r--r--sql/table.cc10
-rw-r--r--sql/table.h1
-rw-r--r--sql/unireg.cc6
23 files changed, 145 insertions, 83 deletions
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index c9c1813a429..7b2395673eb 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -486,8 +486,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/ha_partition.cc b/sql/ha_partition.cc
index ae7e2215517..2e0bb090ad2 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4805,11 +4805,14 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info,
about this call). We pass this along to all underlying MyISAM handlers
and ignore it for the rest.
- HA_EXTRA_PREPARE_FOR_DELETE:
+ HA_EXTRA_PREPARE_FOR_DROP:
Only used by MyISAM, called in preparation for a DROP TABLE.
It's used mostly by Windows that cannot handle dropping an open file.
On other platforms it has the same effect as HA_EXTRA_FORCE_REOPEN.
+ HA_EXTRA_PREPARE_FOR_RENAME:
+ Informs the handler we are about to attempt a rename of the table.
+
HA_EXTRA_READCHECK:
HA_EXTRA_NO_READCHECK:
Only one call to HA_EXTRA_NO_READCHECK from ha_open where it says that
@@ -4944,14 +4947,15 @@ int ha_partition::extra(enum ha_extra_function operation)
}
/* Category 3), used by MyISAM handlers */
- case HA_EXTRA_PREPARE_FOR_DELETE:
- DBUG_RETURN(prepare_for_delete());
+ case HA_EXTRA_PREPARE_FOR_RENAME:
+ DBUG_RETURN(prepare_for_rename());
break;
case HA_EXTRA_NORMAL:
case HA_EXTRA_QUICK:
case HA_EXTRA_NO_READCHECK:
case HA_EXTRA_PREPARE_FOR_UPDATE:
case HA_EXTRA_FORCE_REOPEN:
+ case HA_EXTRA_PREPARE_FOR_DROP:
case HA_EXTRA_FLUSH_CACHE:
{
if (m_myisam)
@@ -5110,24 +5114,24 @@ void ha_partition::prepare_extra_cache(uint cachesize)
0 Success
*/
-int ha_partition::prepare_for_delete()
+int ha_partition::prepare_for_rename()
{
int result= 0, tmp;
handler **file;
- DBUG_ENTER("ha_partition::prepare_for_delete()");
+ DBUG_ENTER("ha_partition::prepare_for_rename()");
if (m_new_file != NULL)
{
for (file= m_new_file; *file; file++)
- if ((tmp= (*file)->extra(HA_EXTRA_PREPARE_FOR_DELETE)))
+ if ((tmp= (*file)->extra(HA_EXTRA_PREPARE_FOR_RENAME)))
result= tmp;
for (file= m_reorged_file; *file; file++)
- if ((tmp= (*file)->extra(HA_EXTRA_PREPARE_FOR_DELETE)))
+ if ((tmp= (*file)->extra(HA_EXTRA_PREPARE_FOR_RENAME)))
result= tmp;
DBUG_RETURN(result);
}
- DBUG_RETURN(loop_extra(HA_EXTRA_PREPARE_FOR_DELETE));
+ DBUG_RETURN(loop_extra(HA_EXTRA_PREPARE_FOR_RENAME));
}
/*
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 9d10aea2b6f..ac00581fae0 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -211,7 +211,7 @@ public:
}
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
private:
- int prepare_for_delete();
+ int prepare_for_rename();
int copy_partitions(ulonglong *copied, ulonglong *deleted);
void cleanup_new_partition(uint part_count);
int prepare_new_partition(TABLE *table, HA_CREATE_INFO *create_info,
diff --git a/sql/handler.cc b/sql/handler.cc
index 140d13bcb1e..b334e003851 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -288,7 +288,8 @@ handler *get_ha_partition(partition_info *part_info)
@retval
!=0 Error
*/
-static int ha_init_errors(void)
+
+int ha_init_errors(void)
{
#define SETMSG(nr, msg) errmsgs[(nr) - HA_ERR_FIRST]= (msg)
const char **errmsgs;
@@ -501,9 +502,6 @@ int ha_init()
int error= 0;
DBUG_ENTER("ha_init");
- if (ha_init_errors())
- DBUG_RETURN(1);
-
DBUG_ASSERT(total_ha < MAX_HA);
/*
Check if there is a transaction-capable storage engine besides the
@@ -3347,10 +3345,10 @@ handler::ha_repair_partitions(THD *thd)
int ha_enable_transaction(THD *thd, bool on)
{
int error=0;
-
DBUG_ENTER("ha_enable_transaction");
- thd->transaction.on= on;
- if (on)
+ DBUG_PRINT("enter", ("on: %d", (int) on));
+
+ if ((thd->transaction.on= on))
{
/*
Now all storage engines should have transaction handling enabled.
diff --git a/sql/handler.h b/sql/handler.h
index a3743c78f34..d674c07a57d 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>
@@ -272,6 +273,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
};
@@ -322,6 +324,7 @@ enum enum_binlog_command {
#define HA_CREATE_USED_CONNECTION (1L << 18)
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
#define HA_CREATE_USED_TRANSACTIONAL (1L << 20)
+#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)
typedef ulonglong my_xid; // this line is the same as in log_event.h
#define MYSQL_XID_PREFIX "MySQLXid"
@@ -917,6 +920,7 @@ typedef struct st_ha_create_information
bool frm_only; /* 1 if no ha_create_table() */
bool varchar; /* 1 if table has a VARCHAR */
enum ha_storage_media storage_media; /* DEFAULT, DISK or MEMORY */
+ enum ha_choice page_checksum; /* If we have page_checksums */
} HA_CREATE_INFO;
@@ -1964,6 +1968,7 @@ static inline bool ha_storage_engine_is_enabled(const handlerton *db_type)
}
/* basic stuff */
+int ha_init_errors(void);
int ha_init(void);
int ha_end(void);
int ha_initialize_handlerton(st_plugin_int *plugin);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c938bf5ebe1..a17c1eff5dd 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -32,6 +32,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/lex.h b/sql/lex.h
index 0b601de772a..acb81dcf717 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -386,8 +386,9 @@ static SYMBOL symbols[] = {
{ "OWNER", SYM(OWNER_SYM)},
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
{ "PARSER", SYM(PARSER_SYM)},
+ { "PAGE", SYM(PAGE_SYM)},
+ { "PAGE_CHECKSUM", SYM(PAGE_CHECKSUM_SYM)},
{ "PARTIAL", SYM(PARTIAL)},
- { "PAGE", SYM(PAGE_SYM)},
{ "PARTITION", SYM(PARTITION_SYM)},
{ "PARTITIONING", SYM(PARTITIONING_SYM)},
{ "PARTITIONS", SYM(PARTITIONS_SYM)},
@@ -524,7 +525,8 @@ static SYMBOL symbols[] = {
{ "SWITCHES", SYM(SWITCHES_SYM)},
{ "TABLE", SYM(TABLE_SYM)},
{ "TABLES", SYM(TABLES)},
- { "TABLESPACE", SYM(TABLESPACE)},
+ { "TABLESPACE", SYM(TABLESPACE)},
+ { "TABLE_CHECKSUM", SYM(TABLE_CHECKSUM_SYM)},
{ "TEMPORARY", SYM(TEMPORARY)},
{ "TEMPTABLE", SYM(TEMPTABLE_SYM)},
{ "TERMINATED", SYM(TERMINATED)},
@@ -541,6 +543,7 @@ static SYMBOL symbols[] = {
{ "TO", SYM(TO_SYM)},
{ "TRAILING", SYM(TRAILING)},
{ "TRANSACTION", SYM(TRANSACTION_SYM)},
+ { "TRANSACTIONAL", SYM(TRANSACTIONAL_SYM)},
{ "TRIGGER", SYM(TRIGGER_SYM)},
{ "TRIGGERS", SYM(TRIGGERS_SYM)},
{ "TRUE", SYM(TRUE_SYM)},
diff --git a/sql/log.cc b/sql/log.cc
index fcb81e05ab3..384f53bf64a 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2420,6 +2420,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 0791daf76d5..69f214d95f3 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1861,7 +1861,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;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 36a5b1a10d9..8bafb15eeaa 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"
@@ -468,7 +469,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;
@@ -2392,7 +2393,7 @@ or misconfigured. This error can also be caused by malfunctioning hardware.\n",
We will try our best to scrape up some info that will hopefully help diagnose\n\
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",
+ fprintf(stderr, "key_buffer_size=%lu\n",
(ulong) dflt_key_cache->key_cache_mem_size);
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
@@ -2428,7 +2429,7 @@ Attempting backtrace. You can use the following information to find out\n\
where mysqld died. If you see no messages after this, something went\n\
terribly wrong...\n");
print_stacktrace(thd ? (uchar*) thd->thread_stack : (uchar*) 0,
- thread_stack);
+ my_thread_stack_size);
}
if (thd)
{
@@ -2611,9 +2612,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
@@ -3809,6 +3810,13 @@ server.");
using_update_log=1;
}
+ /* call ha_init_key_cache() on all key caches to init them */
+ process_key_caches(&ha_init_key_cache);
+
+ /* Allow storage engine to give real error messages */
+ if (ha_init_errors())
+ DBUG_RETURN(1);
+
if (plugin_init(&defaults_argc, defaults_argv,
(opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
(opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
@@ -3975,9 +3983,6 @@ server.");
if (opt_myisam_log)
(void) mi_log(1);
- /* call ha_init_key_cache() on all key caches to init them */
- process_key_caches(&ha_init_key_cache);
-
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && !defined(EMBEDDED_LIBRARY)
if (locked_in_memory && !getuid())
{
@@ -4167,9 +4172,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
{
@@ -4180,15 +4185,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
}
}
@@ -5449,7 +5454,7 @@ enum options_mysqld
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_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
@@ -5464,7 +5469,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,
@@ -6635,10 +6640,10 @@ The minimum value for this variable is 4096.",
(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,
- (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
- REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
+ "The size of the buffer that is allocated when preloading indexes",
+ (uchar**) &global_system_variables.preload_buff_size,
+ (uchar**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
+ REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
"Allocation block size for query parsing and execution",
(uchar**) &global_system_variables.query_alloc_block_size,
@@ -6782,8 +6787,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, ULONG_MAX, 0, 1024, 0},
{ "time_format", OPT_TIME_FORMAT,
"The TIME format (for future).",
@@ -6797,12 +6802,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, ULONG_MAX, 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, ULONG_MAX, 0, 1024, 0},
@@ -7234,6 +7239,7 @@ SHOW_VAR status_vars[]= {
{"Open_tables", (char*) &show_open_tables, SHOW_FUNC},
{"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
+ {"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
{"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_FUNC},
#ifdef HAVE_QUERY_CACHE
{"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_NOFLUSH},
@@ -7463,9 +7469,10 @@ static void mysql_init_variables(void)
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 */
+ /* set key_cache_hash.default_value = dflt_key_cache */
+ multi_keycache_init();
/* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1);
@@ -7480,7 +7487,7 @@ static void mysql_init_variables(void)
master_password= master_host= 0;
master_info_file= (char*) "master.info",
relay_log_info_file= (char*) "relay-log.info";
- master_ssl_key= master_ssl_cert= master_ssl_ca=
+ master_ssl_key= master_ssl_cert= master_ssl_ca=
master_ssl_capath= master_ssl_cipher= 0;
report_user= report_password = report_host= 0; /* TO BE DELETED */
opt_relay_logname= opt_relaylog_index_name= 0;
@@ -8141,7 +8148,7 @@ mysql_getopt_value(const char *keyname, uint key_length,
}
}
}
- return option->value;
+ return option->value;
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 793742f9e7a..e5709f418f7 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2142,9 +2142,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
quick=0;
needed_reg.clear_all();
quick_keys.clear_all();
- if ((specialflag & SPECIAL_SAFE_MODE) && ! force_quick_range ||
- !limit)
- DBUG_RETURN(0); /* purecov: inspected */
if (keys_to_use.is_clear_all())
DBUG_RETURN(0);
records= head->file->stats.records;
@@ -4315,7 +4312,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 46a64b1a87c..99931d7bafc 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -810,7 +810,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},
};
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7c57e3fc40e..485abdf13ea 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -579,6 +579,7 @@ THD::THD()
cleanup_done= abort_on_warning= no_warnings_for_error= 0;
peer_port= 0; // For SHOW PROCESSLIST
transaction.m_pending_rows_event= 0;
+ transaction.on= 1;
#ifdef SIGNAL_WITH_VIO_CLOSE
active_vio = 0;
#endif
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 3edad3a2184..2b57071d497 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5290,10 +5290,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_plugin.cc b/sql/sql_plugin.cc
index e2449613458..811b82ebe05 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1446,10 +1446,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
- {
- pthread_mutex_unlock(&LOCK_plugin);
goto error;
- }
}
plugin_dl_del(&dl); // reduce ref count
}
@@ -1459,10 +1456,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
pthread_mutex_lock(&LOCK_plugin);
if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
- {
- pthread_mutex_unlock(&LOCK_plugin);
goto error;
- }
}
pthread_mutex_unlock(&LOCK_plugin);
name.length= dl.length= 0;
@@ -1485,6 +1479,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
}
DBUG_RETURN(FALSE);
error:
+ pthread_mutex_unlock(&LOCK_plugin);
sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
name.str, dl.str);
DBUG_RETURN(TRUE);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8aec8795aa8..164edacc932 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -33,6 +33,7 @@
#include "sql_cursor.h"
#include <m_ctype.h>
+#include <my_bit.h>
#include <hash.h>
#include <ft_global.h>
@@ -9732,7 +9733,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
table->s= share;
init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
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
@@ -10294,7 +10295,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_show.cc b/sql/sql_show.cc
index ab15aa79d71..b005615ce7c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -72,6 +72,9 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
grant_names, NULL};
#endif
+/* Match the values of enum ha_choice */
+static const char *ha_choice_values[] = {"", "0", "1"};
+
static void store_key_options(THD *thd, String *packet, TABLE *table,
KEY *key_info);
@@ -1184,6 +1187,8 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
key_info= table->key_info;
bzero((char*) &create_info, sizeof(create_info));
+ /* Allow update_create_info to update row type */
+ create_info.row_type= share->row_type;
file->update_create_info(&create_info);
primary_key= share->primary_key;
@@ -1368,19 +1373,25 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
packet->append(STRING_WITH_LEN(" PACK_KEYS=1"));
if (share->db_create_options & HA_OPTION_NO_PACK_KEYS)
packet->append(STRING_WITH_LEN(" PACK_KEYS=0"));
+ /* We use CHECKSUM, instead of TABLE_CHECKSUM, for backward compability */
if (share->db_create_options & HA_OPTION_CHECKSUM)
packet->append(STRING_WITH_LEN(" CHECKSUM=1"));
+ if (share->page_checksum != HA_CHOICE_UNDEF)
+ {
+ packet->append(STRING_WITH_LEN(" PAGE_CHECKSUM="));
+ packet->append(ha_choice_values[(uint) share->page_checksum], 1);
+ }
if (share->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
packet->append(STRING_WITH_LEN(" DELAY_KEY_WRITE=1"));
- if (share->row_type != ROW_TYPE_DEFAULT)
+ if (create_info.row_type != ROW_TYPE_DEFAULT)
{
packet->append(STRING_WITH_LEN(" ROW_FORMAT="));
- packet->append(ha_row_type[(uint) share->row_type]);
+ packet->append(ha_row_type[(uint) create_info.row_type]);
}
if (share->transactional != HA_CHOICE_UNDEF)
{
packet->append(STRING_WITH_LEN(" TRANSACTIONAL="));
- packet->append(share->transactional == HA_CHOICE_YES ? "1" : "0", 1);
+ packet->append(ha_choice_values[(uint) share->transactional], 1);
}
if (table->s->key_block_size)
{
@@ -3494,8 +3505,12 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
ptr=strmov(ptr," pack_keys=1");
if (share->db_create_options & HA_OPTION_NO_PACK_KEYS)
ptr=strmov(ptr," pack_keys=0");
+ /* We use CHECKSUM, instead of TABLE_CHECKSUM, for backward compability */
if (share->db_create_options & HA_OPTION_CHECKSUM)
ptr=strmov(ptr," checksum=1");
+ if (share->page_checksum != HA_CHOICE_UNDEF)
+ ptr= strxmov(ptr, " page_checksum=",
+ ha_choice_values[(uint) share->page_checksum], NullS);
if (share->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
ptr=strmov(ptr," delay_key_write=1");
if (share->row_type != ROW_TYPE_DEFAULT)
@@ -3514,6 +3529,9 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
show_table->part_info->no_parts > 0)
ptr= strmov(ptr, " partitioned");
#endif
+ if (share->transactional != HA_CHOICE_UNDEF)
+ ptr= strxmov(ptr, " transactional=",
+ ha_choice_values[(uint) share->transactional], NullS);
table->field[19]->store(option_buff+1,
(ptr == option_buff ? 0 :
(uint) (ptr-option_buff)-1), cs);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f69f5fadff3..714701bbf3b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3808,8 +3808,9 @@ mysql_rename_table(handlerton *base, const char *old_db,
wait_while_table_is_used()
thd Thread handler
table Table to remove from cache
- function HA_EXTRA_PREPARE_FOR_DELETE if table is to be deleted
- HA_EXTRA_FORCE_REOPEN if table is not be used
+ function HA_EXTRA_PREPARE_FOR_DROP if table is to be deleted
+ HA_EXTRA_FORCE_REOPEN if table is not be used
+ HA_EXTRA_PREPARE_FOR_RENAME if table is to be renamed
NOTES
When returning, the table will be unusable for other threads until
the table is closed.
@@ -3861,7 +3862,7 @@ void close_cached_table(THD *thd, TABLE *table)
{
DBUG_ENTER("close_cached_table");
- wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DELETE);
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
/* Close lock if this is not got with LOCK TABLES */
if (thd->lock)
{
@@ -6749,7 +6750,7 @@ view_err:
if (lower_case_table_names)
my_casedn_str(files_charset_info, old_name);
- wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DELETE);
+ wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME);
close_data_files_and_morph_locks(thd, db, table_name);
error=0;
@@ -7226,7 +7227,6 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list)
table_list->table= NULL;
bzero((char*) &create_info, sizeof(create_info));
- create_info.db_type= 0;
create_info.row_type=ROW_TYPE_NOT_USED;
create_info.default_table_charset=default_charset_info;
/* Force alter table to recreate table */
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 0bce4eb4a82..1a522b852e9 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/sql_yacc.yy b/sql/sql_yacc.yy
index 5e28bdb45e8..896b0b26bfa 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -487,6 +487,7 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal,
enum enum_tx_isolation tx_isolation;
enum Cast_target cast_type;
enum Item_udftype udf_type;
+ enum ha_choice choice;
CHARSET_INFO *charset;
thr_lock_type lock_type;
interval_type interval, interval_time_st;
@@ -881,6 +882,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token OWNER_SYM
%token PACK_KEYS_SYM
%token PAGE_SYM
+%token PAGE_CHECKSUM_SYM
%token PARAM_MARKER
%token PARSER_SYM
%token PARTIAL /* SQL-2003-N */
@@ -1021,6 +1023,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token TABLESPACE
%token TABLE_REF_PRIORITY
%token TABLE_SYM /* SQL-2003-R */
+%token TABLE_CHECKSUM_SYM
%token TEMPORARY /* SQL-2003-N */
%token TEMPTABLE_SYM
%token TERMINATED
@@ -1156,6 +1159,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <ulonglong_number>
ulonglong_num real_ulonglong_num size_number
+%type <choice> choice
+
%type <p_elem_value>
part_bit_expr
@@ -4347,6 +4352,16 @@ create_table_option:
Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM;
Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM;
}
+ | TABLE_CHECKSUM_SYM opt_equal ulong_num
+ {
+ Lex->create_info.table_options|= $3 ? HA_OPTION_CHECKSUM : HA_OPTION_NO_CHECKSUM;
+ Lex->create_info.used_fields|= HA_CREATE_USED_CHECKSUM;
+ }
+ | PAGE_CHECKSUM_SYM opt_equal choice
+ {
+ Lex->create_info.used_fields|= HA_CREATE_USED_PAGE_CHECKSUM;
+ Lex->create_info.page_checksum= $3;
+ }
| DELAY_KEY_WRITE_SYM opt_equal ulong_num
{
Lex->create_info.table_options|= $3 ? HA_OPTION_DELAY_KEY_WRITE : HA_OPTION_NO_DELAY_KEY_WRITE;
@@ -4406,11 +4421,10 @@ create_table_option:
Lex->create_info.used_fields|= HA_CREATE_USED_KEY_BLOCK_SIZE;
Lex->create_info.key_block_size= $3;
}
- | TRANSACTIONAL_SYM opt_equal ulong_num
+ | TRANSACTIONAL_SYM opt_equal choice
{
- Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL;
- Lex->create_info.transactional= ($3 != 0 ? HA_CHOICE_YES :
- HA_CHOICE_NO);
+ Lex->create_info.used_fields|= HA_CREATE_USED_TRANSACTIONAL;
+ Lex->create_info.transactional= $3;
}
;
@@ -8308,6 +8322,11 @@ dec_num:
| FLOAT_NUM
;
+choice:
+ ulong_num { $$= $1 != 0 ? HA_CHOICE_YES : HA_CHOICE_NO; }
+ | DEFAULT { $$= HA_CHOICE_UNDEF; }
+ ;
+
procedure_clause:
/* empty */
| PROCEDURE ident /* Procedure name */
@@ -10621,6 +10640,7 @@ keyword_sp:
| ONE_SYM {}
| PACK_KEYS_SYM {}
| PAGE_SYM {}
+ | PAGE_CHECKSUM_SYM {}
| PARTIAL {}
| PARTITIONING_SYM {}
| PARTITIONS_SYM {}
@@ -10690,6 +10710,7 @@ keyword_sp:
| SWAPS_SYM {}
| SWITCHES_SYM {}
| TABLES {}
+ | TABLE_CHECKSUM_SYM {}
| TABLESPACE {}
| TEMPORARY {}
| TEMPTABLE_SYM {}
diff --git a/sql/table.cc b/sql/table.cc
index 100821f28d5..ebf3dfd748e 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -711,7 +711,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (!head[32]) // New frm file in 3.23
{
share->avg_row_length= uint4korr(head+34);
- share->transactional= (ha_choice) head[39];
+ share->transactional= (ha_choice) (head[39] & 3);
+ share->page_checksum= (ha_choice) ((head[39] >> 2) & 3);
share->row_type= (row_type) head[40];
share->table_charset= get_charset((uint) head[38],MYF(0));
share->null_field_first= 1;
@@ -2454,7 +2455,9 @@ File create_frm(THD *thd, const char *name, const char *db,
int2store(fileinfo+16,reclength);
int4store(fileinfo+18,create_info->max_rows);
int4store(fileinfo+22,create_info->min_rows);
+ /* fileinfo[26] is set in mysql_create_frm() */
fileinfo[27]=2; // Use long pack-fields
+ /* fileinfo[28 & 29] is set to key_info_length in mysql_create_frm() */
create_info->table_options|=HA_OPTION_LONG_BLOB_PTR; // Use portable blob pointers
int2store(fileinfo+30,create_info->table_options);
fileinfo[32]=0; // No filename anymore
@@ -2462,9 +2465,10 @@ File create_frm(THD *thd, const char *name, const char *db,
int4store(fileinfo+34,create_info->avg_row_length);
fileinfo[38]= (create_info->default_table_charset ?
create_info->default_table_charset->number : 0);
- fileinfo[39]= (uchar) create_info->transactional;
+ fileinfo[39]= (uchar) ((uint) create_info->transactional |
+ ((uint) create_info->page_checksum << 2));
fileinfo[40]= (uchar) create_info->row_type;
- /* Next few bytes were for RAID support */
+ /* Next few bytes where for RAID support */
fileinfo[41]= 0;
fileinfo[42]= 0;
fileinfo[43]= 0;
diff --git a/sql/table.h b/sql/table.h
index d448485a117..0e0a35b022d 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -311,6 +311,7 @@ typedef struct st_table_share
enum row_type row_type; /* How rows are stored */
enum tmp_table_type tmp_table;
enum ha_choice transactional;
+ enum ha_choice page_checksum;
uint ref_count; /* How many TABLE objects uses this */
uint open_count; /* Number of tables in open list */
diff --git a/sql/unireg.cc b/sql/unireg.cc
index abab4632fe4..9e42aabfef7 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -328,8 +328,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;