diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-12-11 12:39:38 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-12-11 12:39:38 +0300 |
commit | 567671368723c704d60902b4d0ccff951b414552 (patch) | |
tree | 965519a5b0af3f33624c7e16fd61b58d15f42372 /storage | |
parent | efee0608316e4cc034a3e62d05980eef8530843d (diff) | |
parent | ceefe7bb50b17b72e88851e3b98642e89a4cddae (diff) | |
download | mariadb-git-567671368723c704d60902b4d0ccff951b414552.tar.gz |
Manual merge from mysql-trunk.
Conflicts:
- client/mysqltest.cc
- mysql-test/collections/default.experimental
- mysql-test/suite/rpl/t/disabled.def
- sql/mysqld.cc
- sql/opt_range.cc
- sql/sp.cc
- sql/sql_acl.cc
- sql/sql_partition.cc
- sql/sql_table.cc
Diffstat (limited to 'storage')
26 files changed, 140 insertions, 90 deletions
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 319ed467966..143d684025e 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -1,4 +1,5 @@ # Copyright (C) 2005-2006 MySQL AB +# Copyright (C) 2009 SUN Microsystems # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -68,14 +69,23 @@ archive_reader_LDFLAGS = @NOINST_LDFLAGS@ EXTRA_DIST = CMakeLists.txt plug.in if HAVE_DTRACE_DASH_G +# The object for static and dynamic linking of archive differ +# For static linkage of archive to mysqld libarchive_a_LIBADD = probes_mysql.o libarchive_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES = probes_mysql.o dtrace_files dtrace_providers +# For archive as shared library +ha_archive_la_LIBADD = probes_sh_mysql.o +ha_archive_la_DEPENDENCIES = probes_sh_mysql.o dtrace_shared_files dtrace_providers + +CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers dtrace_shared_files DTRACEFILES = libarchive_a-ha_archive.o +DTRACESHAREDFILES = .libs/ha_archive_la-ha_archive.o DTRACEPROVIDER = probes_mysql.d dtrace_files: echo $(DTRACEFILES) > $@ +dtrace_shared_files: + echo $(DTRACESHAREDFILES) > $@ dtrace_providers: probes_mysql.d echo $(DTRACEPROVIDER) > $@ probes_mysql.d: @@ -83,6 +93,9 @@ probes_mysql.d: $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d echo timestamp > dtrace_sources +probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDFILES) + $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@ + probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ endif diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 2e812ffa6a5..e8d80106a6f 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -172,8 +172,8 @@ int archive_db_init(void *p) if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST)) goto error; - if (hash_init(&archive_open_tables, table_alias_charset, 32, 0, 0, - (hash_get_key) archive_get_key, 0, 0)) + if (my_hash_init(&archive_open_tables, table_alias_charset, 32, 0, 0, + (my_hash_get_key) archive_get_key, 0, 0)) { VOID(pthread_mutex_destroy(&archive_mutex)); } @@ -198,7 +198,7 @@ error: int archive_db_done(void *p) { - hash_free(&archive_open_tables); + my_hash_free(&archive_open_tables); VOID(pthread_mutex_destroy(&archive_mutex)); return 0; @@ -316,9 +316,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) pthread_mutex_lock(&archive_mutex); length=(uint) strlen(table_name); - if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables, - (uchar*) table_name, - length))) + if (!(share=(ARCHIVE_SHARE*) my_hash_search(&archive_open_tables, + (uchar*) table_name, + length))) { char *tmp_name; azio_stream archive_tmp; @@ -400,7 +400,7 @@ int ha_archive::free_share() pthread_mutex_lock(&archive_mutex); if (!--share->use_count) { - hash_delete(&archive_open_tables, (uchar*) share); + my_hash_delete(&archive_open_tables, (uchar*) share); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); /* diff --git a/storage/blackhole/CMakeLists.txt b/storage/blackhole/CMakeLists.txt index b762228d7fd..bed282ef21d 100644 --- a/storage/blackhole/CMakeLists.txt +++ b/storage/blackhole/CMakeLists.txt @@ -13,9 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") - INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") SET(BLACKHOLE_SOURCES ha_blackhole.cc ha_blackhole.h) diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index eaa17a41ac5..27e4c919911 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -319,8 +319,9 @@ static st_blackhole_share *get_share(const char *table_name) length= (uint) strlen(table_name); pthread_mutex_lock(&blackhole_mutex); - if (!(share= (st_blackhole_share*) hash_search(&blackhole_open_tables, - (uchar*) table_name, length))) + if (!(share= (st_blackhole_share*) + my_hash_search(&blackhole_open_tables, + (uchar*) table_name, length))) { if (!(share= (st_blackhole_share*) my_malloc(sizeof(st_blackhole_share) + length, @@ -350,7 +351,7 @@ static void free_share(st_blackhole_share *share) { pthread_mutex_lock(&blackhole_mutex); if (!--share->use_count) - hash_delete(&blackhole_open_tables, (uchar*) share); + my_hash_delete(&blackhole_open_tables, (uchar*) share); pthread_mutex_unlock(&blackhole_mutex); } @@ -377,16 +378,16 @@ static int blackhole_init(void *p) blackhole_hton->flags= HTON_CAN_RECREATE; VOID(pthread_mutex_init(&blackhole_mutex, MY_MUTEX_INIT_FAST)); - (void) hash_init(&blackhole_open_tables, system_charset_info,32,0,0, - (hash_get_key) blackhole_get_key, - (hash_free_key) blackhole_free_key, 0); + (void) my_hash_init(&blackhole_open_tables, system_charset_info,32,0,0, + (my_hash_get_key) blackhole_get_key, + (my_hash_free_key) blackhole_free_key, 0); return 0; } static int blackhole_fini(void *p) { - hash_free(&blackhole_open_tables); + my_hash_free(&blackhole_open_tables); pthread_mutex_destroy(&blackhole_mutex); return 0; diff --git a/storage/csv/CMakeLists.txt b/storage/csv/CMakeLists.txt index eb21a9b048c..37760588897 100644 --- a/storage/csv/CMakeLists.txt +++ b/storage/csv/CMakeLists.txt @@ -13,8 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") SET(CSV_SOURCES ha_tina.cc ha_tina.h transparent_file.cc transparent_file.h) diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 07c4785ab90..9cc0f1e607b 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -111,8 +111,8 @@ static int tina_init_func(void *p) tina_hton= (handlerton *)p; VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST)); - (void) hash_init(&tina_open_tables,system_charset_info,32,0,0, - (hash_get_key) tina_get_key,0,0); + (void) my_hash_init(&tina_open_tables,system_charset_info,32,0,0, + (my_hash_get_key) tina_get_key,0,0); tina_hton->state= SHOW_OPTION_YES; tina_hton->db_type= DB_TYPE_CSV_DB; tina_hton->create= tina_create_handler; @@ -123,7 +123,7 @@ static int tina_init_func(void *p) static int tina_done_func(void *p) { - hash_free(&tina_open_tables); + my_hash_free(&tina_open_tables); pthread_mutex_destroy(&tina_mutex); return 0; @@ -148,9 +148,9 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) If share is not present in the hash, create a new share and initialize its members. */ - if (!(share=(TINA_SHARE*) hash_search(&tina_open_tables, - (uchar*) table_name, - length))) + if (!(share=(TINA_SHARE*) my_hash_search(&tina_open_tables, + (uchar*) table_name, + length))) { if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), &share, sizeof(*share), @@ -377,7 +377,7 @@ static int free_share(TINA_SHARE *share) share->tina_write_opened= FALSE; } - hash_delete(&tina_open_tables, (uchar*) share); + my_hash_delete(&tina_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); my_free((uchar*) share, MYF(0)); @@ -448,6 +448,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg) buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin); chain= chain_buffer; file_buff= new Transparent_file(); + init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);; } @@ -594,7 +595,7 @@ int ha_tina::find_current_row(uchar *buf) bool read_all; DBUG_ENTER("ha_tina::find_current_row"); - free_root(&blobroot, MYF(MY_MARK_BLOCKS_FREE)); + free_root(&blobroot, MYF(0)); /* We do not read further then local_saved_data_file_length in order @@ -1073,8 +1074,6 @@ int ha_tina::rnd_init(bool scan) records_is_known= 0; chain_ptr= chain; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - DBUG_RETURN(0); } @@ -1192,6 +1191,7 @@ int ha_tina::extra(enum ha_extra_function operation) DBUG_RETURN(0); } + /* Set end_pos to the last valid byte of continuous area, closest to the given "hole", stored in the buffer. "Valid" here means, @@ -1394,8 +1394,6 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1595,8 +1593,6 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1604,7 +1600,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) count--; current_position= next_position; } - + free_root(&blobroot, MYF(0)); my_free((char*)buf, MYF(0)); diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 02e0700a825..a246d1858e5 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -98,6 +98,7 @@ public: my_free(chain, 0); if (file_buff) delete file_buff; + free_root(&blobroot, MYF(0)); } const char *table_type() const { return "CSV"; } const char *index_type(uint inx) { return "NONE"; } diff --git a/storage/example/CMakeLists.txt b/storage/example/CMakeLists.txt index a328da107bd..f0b1343ab9c 100644 --- a/storage/example/CMakeLists.txt +++ b/storage/example/CMakeLists.txt @@ -13,8 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") SET(EXAMPLE_SOURCES ha_example.cc) MYSQL_STORAGE_ENGINE(EXAMPLE) diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index ce269aee59b..1179a338ee2 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -34,7 +34,7 @@ noinst_HEADERS = ha_example.h EXTRA_LTLIBRARIES = ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ -ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) +ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 30fc82c82d2..9bc666663c3 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (C) 2003 MySQL AB, 2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -133,8 +133,8 @@ static int example_init_func(void *p) example_hton= (handlerton *)p; VOID(pthread_mutex_init(&example_mutex,MY_MUTEX_INIT_FAST)); - (void) hash_init(&example_open_tables,system_charset_info,32,0,0, - (hash_get_key) example_get_key,0,0); + (void) my_hash_init(&example_open_tables,system_charset_info,32,0,0, + (my_hash_get_key) example_get_key,0,0); example_hton->state= SHOW_OPTION_YES; example_hton->create= example_create_handler; @@ -151,7 +151,7 @@ static int example_done_func(void *p) if (example_open_tables.records) error= 1; - hash_free(&example_open_tables); + my_hash_free(&example_open_tables); pthread_mutex_destroy(&example_mutex); DBUG_RETURN(0); @@ -175,9 +175,9 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) pthread_mutex_lock(&example_mutex); length=(uint) strlen(table_name); - if (!(share=(EXAMPLE_SHARE*) hash_search(&example_open_tables, - (uchar*) table_name, - length))) + if (!(share=(EXAMPLE_SHARE*) my_hash_search(&example_open_tables, + (uchar*) table_name, + length))) { if (!(share=(EXAMPLE_SHARE *) my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), @@ -222,7 +222,7 @@ static int free_share(EXAMPLE_SHARE *share) pthread_mutex_lock(&example_mutex); if (!--share->use_count) { - hash_delete(&example_open_tables, (uchar*) share); + my_hash_delete(&example_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); my_free(share, MYF(0)); @@ -921,6 +921,24 @@ static struct st_mysql_sys_var* example_system_variables[]= { NULL }; +// this is an example of SHOW_FUNC and of my_snprintf() service +static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var, + char *buf) +{ + var->type= SHOW_CHAR; + var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes + my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE, + "enum_var is %u, ulong_var is %lu, %.6b", // %b is MySQL extension + srv_enum_var, srv_ulong_var, "really"); + return 0; +} + +static struct st_mysql_show_var func_status[]= +{ + {"example_func_example", (char *)show_func_example, SHOW_FUNC}, + {0,0,SHOW_UNDEF} +}; + mysql_declare_plugin(example) { MYSQL_STORAGE_ENGINE_PLUGIN, @@ -932,7 +950,7 @@ mysql_declare_plugin(example) example_init_func, /* Plugin Init */ example_done_func, /* Plugin Deinit */ 0x0001 /* 0.1 */, - NULL, /* status variables */ + func_status, /* status variables */ example_system_variables, /* system variables */ NULL /* config options */ } diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index a3fa42d7d05..05be8b27a8b 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -459,8 +459,8 @@ int federated_db_init(void *p) if (pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST)) goto error; - if (!hash_init(&federated_open_tables, &my_charset_bin, 32, 0, 0, - (hash_get_key) federated_get_key, 0, 0)) + if (!my_hash_init(&federated_open_tables, &my_charset_bin, 32, 0, 0, + (my_hash_get_key) federated_get_key, 0, 0)) { DBUG_RETURN(FALSE); } @@ -483,7 +483,7 @@ error: int federated_done(void *p) { - hash_free(&federated_open_tables); + my_hash_free(&federated_open_tables); VOID(pthread_mutex_destroy(&federated_mutex)); return 0; @@ -1495,10 +1495,10 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) goto error; /* TODO: change tmp_share.scheme to LEX_STRING object */ - if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables, - (uchar*) tmp_share.share_key, - tmp_share. - share_key_length))) + if (!(share= (FEDERATED_SHARE *) my_hash_search(&federated_open_tables, + (uchar*) tmp_share.share_key, + tmp_share. + share_key_length))) { query.set_charset(system_charset_info); query.append(STRING_WITH_LEN("SELECT ")); @@ -1560,7 +1560,7 @@ static int free_share(FEDERATED_SHARE *share) pthread_mutex_lock(&federated_mutex); if (!--share->use_count) { - hash_delete(&federated_open_tables, (uchar*) share); + my_hash_delete(&federated_open_tables, (uchar*) share); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); free_root(&mem_root, MYF(0)); @@ -2892,7 +2892,7 @@ int ha_federated::info(uint flag) } if (flag & HA_STATUS_AUTO) - stats.auto_increment_value= mysql->last_used_con->insert_id; + stats.auto_increment_value= mysql->insert_id; mysql_free_result(result); diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt index c2d2cd1290f..4a0fa22c8f1 100755 --- a/storage/heap/CMakeLists.txt +++ b/storage/heap/CMakeLists.txt @@ -13,8 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") SET(HEAP_SOURCES _check.c _rectest.c hp_block.c hp_clear.c hp_close.c hp_create.c diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1c0aa177fba..1c3a86fb2b3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1138,7 +1138,29 @@ innobase_mysql_tmpfile(void) will be passed to fdopen(), it will be closed by invoking fclose(), which in turn will invoke close() instead of my_close(). */ + +#ifdef _WIN32 + /* Note that on Windows, the integer returned by mysql_tmpfile + has no relation to C runtime file descriptor. Here, we need + to call my_get_osfhandle to get the HANDLE and then convert it + to C runtime filedescriptor. */ + { + HANDLE hFile = my_get_osfhandle(fd); + HANDLE hDup; + BOOL bOK = + DuplicateHandle(GetCurrentProcess(), hFile, GetCurrentProcess(), + &hDup, 0, FALSE, DUPLICATE_SAME_ACCESS); + if(bOK) { + fd2 = _open_osfhandle((intptr_t)hDup,0); + } + else { + my_osmaperr(GetLastError()); + fd2 = -1; + } + } +#else fd2 = dup(fd); +#endif if (fd2 < 0) { DBUG_PRINT("error",("Got error %d on dup",fd2)); my_errno=errno; @@ -4514,7 +4536,7 @@ calc_row_difference( upd_t* uvect, /*!< in/out: update vector */ uchar* old_row, /*!< in: old row in MySQL format */ uchar* new_row, /*!< in: new row in MySQL format */ - struct st_table* table, /*!< in: table in MySQL data + TABLE* table, /*!< in: table in MySQL data dictionary */ uchar* upd_buff, /*!< in: buffer to use */ ulint buff_len, /*!< in: buffer length */ diff --git a/storage/innobase/include/handler0alter.h b/storage/innobase/include/handler0alter.h index 985b76f4f50..7f5af6d2e76 100644 --- a/storage/innobase/include/handler0alter.h +++ b/storage/innobase/include/handler0alter.h @@ -27,7 +27,7 @@ UNIV_INTERN void innobase_rec_to_mysql( /*==================*/ - TABLE* table, /*!< in/out: MySQL table */ + struct TABLE* table, /*!< in/out: MySQL table */ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: index */ const ulint* offsets); /*!< in: rec_get_offsets( @@ -39,4 +39,4 @@ UNIV_INTERN void innobase_rec_reset( /*===============*/ - TABLE* table); /*!< in/out: MySQL table */ + struct TABLE* table); /*!< in/out: MySQL table */ diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 62a5efd11f7..fbeb125ce7b 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -191,7 +191,7 @@ row_merge_build_indexes( unless creating a PRIMARY KEY */ dict_index_t** indexes, /*!< in: indexes to be created */ ulint n_indexes, /*!< in: size of indexes[] */ - TABLE* table); /*!< in/out: MySQL table, for + struct TABLE* table); /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ #endif /* row0merge.h */ diff --git a/storage/innobase/include/row0types.h b/storage/innobase/include/row0types.h index 7920fd75061..1be729206ba 100644 --- a/storage/innobase/include/row0types.h +++ b/storage/innobase/include/row0types.h @@ -54,6 +54,6 @@ typedef struct purge_node_struct purge_node_t; typedef struct row_ext_struct row_ext_t; /* MySQL data types */ -typedef struct st_table TABLE; +struct TABLE; #endif diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index 25f041c0885..232211e5ce7 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -408,7 +408,7 @@ row_merge_buf_add( /** Structure for reporting duplicate records. */ struct row_merge_dup_struct { const dict_index_t* index; /*!< index being sorted */ - TABLE* table; /*!< MySQL table object */ + struct TABLE* table; /*!< MySQL table object */ ulint n_dup; /*!< number of duplicates */ }; @@ -1100,7 +1100,7 @@ ulint row_merge_read_clustered_index( /*===========================*/ trx_t* trx, /*!< in: transaction */ - TABLE* table, /*!< in/out: MySQL table object, + struct TABLE* table, /*!< in/out: MySQL table object, for reporting erroneous records */ const dict_table_t* old_table,/*!< in: table where rows are read from */ @@ -1388,7 +1388,7 @@ row_merge_blocks( ulint* foffs1, /*!< in/out: offset of second source list in the file */ merge_file_t* of, /*!< in/out: output file */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { @@ -1570,7 +1570,7 @@ row_merge( ulint* half, /*!< in/out: half the file */ row_merge_block_t* block, /*!< in/out: 3 buffers */ int* tmpfd, /*!< in/out: temporary file handle */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { @@ -1678,7 +1678,7 @@ row_merge_sort( index entries */ row_merge_block_t* block, /*!< in/out: 3 buffers */ int* tmpfd, /*!< in/out: temporary file handle */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { @@ -2458,7 +2458,7 @@ row_merge_build_indexes( unless creating a PRIMARY KEY */ dict_index_t** indexes, /*!< in: indexes to be created */ ulint n_indexes, /*!< in: size of indexes[] */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt index c05e0046e64..829d89a798a 100755 --- a/storage/myisam/CMakeLists.txt +++ b/storage/myisam/CMakeLists.txt @@ -15,8 +15,6 @@ INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c ha_myisam.cc @@ -34,16 +32,16 @@ MYSQL_STORAGE_ENGINE(MYISAM) IF(NOT SOURCE_SUBLIBS) ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c) - TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys debug dbug strings zlib wsock32) + TARGET_LINK_LIBRARIES(myisam_ftdump myisam mysys dbug strings zlib) ADD_EXECUTABLE(myisamchk myisamchk.c) - TARGET_LINK_LIBRARIES(myisamchk myisam mysys debug dbug strings zlib wsock32) + TARGET_LINK_LIBRARIES(myisamchk myisam mysys dbug strings zlib) ADD_EXECUTABLE(myisamlog myisamlog.c) - TARGET_LINK_LIBRARIES(myisamlog myisam mysys debug dbug strings zlib wsock32) + TARGET_LINK_LIBRARIES(myisamlog myisam mysys dbug strings zlib) ADD_EXECUTABLE(myisampack myisampack.c) - TARGET_LINK_LIBRARIES(myisampack myisam mysys debug dbug strings zlib wsock32) + TARGET_LINK_LIBRARIES(myisampack myisam mysys dbug strings zlib) SET_TARGET_PROPERTIES(myisamchk myisampack PROPERTIES LINK_FLAGS "setargv.obj") diff --git a/storage/myisam/ft_static.c b/storage/myisam/ft_static.c index 1b6c7458fd7..16cbfa1dada 100644 --- a/storage/myisam/ft_static.c +++ b/storage/myisam/ft_static.c @@ -30,8 +30,8 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={ 0, /* Bit pos */ HA_VAR_LENGTH_PART | HA_PACK_KEY, /* flag */ HA_FT_MAXBYTELEN, /* length */ - HA_KEYTYPE_VARTEXT2, /* type */ 63, /* language (will be overwritten) */ + HA_KEYTYPE_VARTEXT2, /* type */ 0, /* null_bit */ 2, 0, 0 /* bit_start, bit_end, bit_length */ }, @@ -41,7 +41,7 @@ const HA_KEYSEG ft_keysegs[FT_SEGS]={ be packed in any way, otherwise w_search() won't be able to update key entry 'in vivo' */ - 0, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, HA_FT_WTYPE, 63, 0, 0, 0, 0 + 0, 0, 0, 0, HA_NO_SORT, HA_FT_WLEN, 63, HA_FT_WTYPE, 0, 0, 0, 0 } }; diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 696b9ff93df..79f1ea0e4e5 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -66,9 +66,12 @@ static int _mi_cmp_buffer(File file, const uchar *buff, my_off_t filepos, my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) { DBUG_ENTER("mi_dynmap_file"); - if (size > (my_off_t) (~((size_t) 0))) + if (size == 0 || size > (my_off_t) (~((size_t) 0))) { - DBUG_PRINT("warning", ("File is too large for mmap")); + if (size) + DBUG_PRINT("warning", ("File is too large for mmap")); + else + DBUG_PRINT("warning", ("Do not mmap zero-length")); DBUG_RETURN(1); } /* diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index 6a4c21160f4..8a5866ae763 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -236,7 +236,7 @@ int mi_lock_database(MI_INFO *info, int lock_type) break; /* Impossible */ } } -#ifdef __WIN__ +#ifdef _WIN32 else { /* @@ -455,11 +455,11 @@ int _mi_writeinfo(register MI_INFO *info, uint operation) share->state.update_count= info->last_loop= ++info->this_loop; if ((error=mi_state_info_write(share->kfile, &share->state, 1))) olderror=my_errno; -#ifdef __WIN__ +#ifdef _WIN32 if (myisam_flush) { - _commit(share->kfile); - _commit(info->dfile); + my_sync(share->kfile,0); + my_sync(info->dfile,0); } #endif } diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index e18146f2357..9117d76de24 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -1130,10 +1130,10 @@ int mi_keyseg_write(File file, const HA_KEYSEG *keyseg) ulong pos; *ptr++= keyseg->type; - *ptr++= keyseg->language; + *ptr++= keyseg->language & 0xFF; /* Collation ID, low byte */ *ptr++= keyseg->null_bit; *ptr++= keyseg->bit_start; - *ptr++= keyseg->bit_end; + *ptr++= keyseg->language >> 8; /* Collation ID, high byte */ *ptr++= keyseg->bit_length; mi_int2store(ptr,keyseg->flag); ptr+=2; mi_int2store(ptr,keyseg->length); ptr+=2; @@ -1152,12 +1152,13 @@ uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg) keyseg->language = *ptr++; keyseg->null_bit = *ptr++; keyseg->bit_start = *ptr++; - keyseg->bit_end = *ptr++; + keyseg->language += ((uint16) (*ptr++)) << 8; keyseg->bit_length = *ptr++; keyseg->flag = mi_uint2korr(ptr); ptr +=2; keyseg->length = mi_uint2korr(ptr); ptr +=2; keyseg->start = mi_uint4korr(ptr); ptr +=4; keyseg->null_pos = mi_uint4korr(ptr); ptr +=4; + keyseg->bit_end= 0; keyseg->charset=0; /* Will be filled in later */ if (keyseg->null_bit) /* We adjust bit_pos if null_bit is last in the byte */ diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt index 60cfffc67ff..c545d04a780 100755 --- a/storage/myisammrg/CMakeLists.txt +++ b/storage/myisammrg/CMakeLists.txt @@ -12,8 +12,6 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index addec5bb58a..471e2243aac 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -153,7 +153,7 @@ extern "C" void myrg_print_wrong_table(const char *table_name) buf[db.length]= '.'; memcpy(buf + db.length + 1, name.str, name.length); buf[db.length + name.length + 1]= 0; - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE), buf); } diff --git a/storage/mysql_storage_engine.cmake b/storage/mysql_storage_engine.cmake index af8c3a85cd1..b920f16452b 100644 --- a/storage/mysql_storage_engine.cmake +++ b/storage/mysql_storage_engine.cmake @@ -34,7 +34,7 @@ IF(NOT SOURCE_SUBLIBS) #The dll is linked to the mysqld executable SET(dyn_libname ha_${libname}) ADD_LIBRARY(${dyn_libname} SHARED ${${engine}_SOURCES}) - TARGET_LINK_LIBRARIES (${dyn_libname} mysqld) + TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld) IF(${engine}_LIBS) TARGET_LINK_LIBRARIES(${dyn_libname} ${${engine}_LIBS}) ENDIF(${engine}_LIBS) diff --git a/storage/ndb/test/run-test/setup.cpp b/storage/ndb/test/run-test/setup.cpp index cbb7a34f171..60f8285888c 100644 --- a/storage/ndb/test/run-test/setup.cpp +++ b/storage/ndb/test/run-test/setup.cpp @@ -105,6 +105,8 @@ setup_config(atrt_config& config) */ for (j = 0; j<(size_t)argc; j++) { + if (tmp[j] == args_separator) /* skip arguments separator */ + continue; for (k = 0; proc_args[k].name; k++) { if (!strncmp(tmp[j], proc_args[k].name, strlen(proc_args[k].name))) @@ -369,6 +371,12 @@ load_options(int argc, char** argv, int type, atrt_options& opts) { for (size_t i = 0; i<(size_t)argc; i++) { + /** + * Skip the separator for arguments from config file and command + * line + */ + if (argv[i] == args_separator) + continue; for (size_t j = 0; f_options[j].name; j++) { const char * name = f_options[j].name; |