From 48a596edac4a85d3fd49f6e60c215287a485df40 Mon Sep 17 00:00:00 2001 From: "istruewing@chilla.local" <> Date: Wed, 31 Jan 2007 18:49:07 +0100 Subject: Bug#17332 - changing key_buffer_size on a running server can crash under load Resizing a key cache while it was in heavy use could crash the server. There were several race conditions. I reworked some of the algorithms to fix the race conditions. No test case. Repeating the crashes requires heavy concurrent load on the key cache. A test script is attached to the bug report. More explanations to the changes are contained in a text file attached to the bug report. --- storage/myisam/ha_myisam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 397856a4a4e..9f9fce98b43 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -858,6 +858,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) ulonglong map= ~(ulonglong) 0; TABLE_LIST *table_list= table->pos_in_table_list; my_bool ignore_leaves= table_list->ignore_leaves; + char buf[ERRMSGSIZE+20]; DBUG_ENTER("ha_myisam::preload_keys"); @@ -889,7 +890,6 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) errmsg= "Failed to allocate buffer"; break; default: - char buf[ERRMSGSIZE+20]; my_snprintf(buf, ERRMSGSIZE, "Failed to read from index file (errno: %d)", my_errno); errmsg= buf; -- cgit v1.2.1 From dc24473cb20a13b8af79aa8327b0e0fb253ff239 Mon Sep 17 00:00:00 2001 From: "antony@ppcg5.local" <> Date: Fri, 2 Mar 2007 08:43:45 -0800 Subject: WL#2936 "Server Variables for Plugins" Implement support for plugins to declare server variables. Demonstrate functionality by removing InnoDB specific code from sql/* New feature for HASH - HASH_UNIQUE flag New feature for DYNAMIC_ARRAY - initializer accepts preallocated ptr. Completed support for plugin reference counting. --- storage/myisam/ha_myisam.cc | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 06ec5c4b44e..25f42c6b2ed 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -633,10 +633,10 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) for (i= 0; i < table->s->keys; i++) { - struct st_plugin_int *parser= table->key_info[i].parser; + plugin_ref parser= table->key_info[i].parser; if (table->key_info[i].flags & HA_USES_PARSER) file->s->keyinfo[i].parser= - (struct st_mysql_ftparser *)parser->plugin->info; + (struct st_mysql_ftparser *)plugin_decl(parser)->info; table->key_info[i].block_size= file->s->keyinfo[i].block_length; } return (0); @@ -651,7 +651,7 @@ int ha_myisam::close(void) int ha_myisam::write_row(byte * buf) { - statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status); + ha_statistic_increment(&SSV::ha_write_count); /* If we have a timestamp column, update it to the current time */ if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) @@ -1509,7 +1509,7 @@ bool ha_myisam::is_crashed() const int ha_myisam::update_row(const byte * old_data, byte * new_data) { - statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status); + ha_statistic_increment(&SSV::ha_update_count); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) table->timestamp_field->set_time(); return mi_update(file,old_data,new_data); @@ -1517,7 +1517,7 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data) int ha_myisam::delete_row(const byte * buf) { - statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status); + ha_statistic_increment(&SSV::ha_delete_count); return mi_delete(file,buf); } @@ -1525,8 +1525,7 @@ int ha_myisam::index_read(byte * buf, const byte * key, uint key_len, enum ha_rkey_function find_flag) { DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_key_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file,buf,active_index, key, key_len, find_flag); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1535,8 +1534,7 @@ int ha_myisam::index_read(byte * buf, const byte * key, int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key, uint key_len, enum ha_rkey_function find_flag) { - statistic_increment(table->in_use->status_var.ha_read_key_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file,buf,index, key, key_len, find_flag); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1546,8 +1544,7 @@ int ha_myisam::index_read_last(byte * buf, const byte * key, uint key_len) { DBUG_ENTER("ha_myisam::index_read_last"); DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_key_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file,buf,active_index, key, key_len, HA_READ_PREFIX_LAST); table->status=error ? STATUS_NOT_FOUND: 0; DBUG_RETURN(error); @@ -1556,8 +1553,7 @@ int ha_myisam::index_read_last(byte * buf, const byte * key, uint key_len) int ha_myisam::index_next(byte * buf) { DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_next_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_next_count); int error=mi_rnext(file,buf,active_index); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1566,8 +1562,7 @@ int ha_myisam::index_next(byte * buf) int ha_myisam::index_prev(byte * buf) { DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_prev_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_prev_count); int error=mi_rprev(file,buf, active_index); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1576,8 +1571,7 @@ int ha_myisam::index_prev(byte * buf) int ha_myisam::index_first(byte * buf) { DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_first_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_first_count); int error=mi_rfirst(file, buf, active_index); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1586,8 +1580,7 @@ int ha_myisam::index_first(byte * buf) int ha_myisam::index_last(byte * buf) { DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_last_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_last_count); int error=mi_rlast(file, buf, active_index); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1598,8 +1591,7 @@ int ha_myisam::index_next_same(byte * buf, uint length __attribute__((unused))) { DBUG_ASSERT(inited==INDEX); - statistic_increment(table->in_use->status_var.ha_read_next_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_next_count); int error=mi_rnext_same(file,buf); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1615,8 +1607,7 @@ int ha_myisam::rnd_init(bool scan) int ha_myisam::rnd_next(byte *buf) { - statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_rnd_next_count); int error=mi_scan(file, buf); table->status=error ? STATUS_NOT_FOUND: 0; return error; @@ -1629,8 +1620,7 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos) int ha_myisam::rnd_pos(byte * buf, byte *pos) { - statistic_increment(table->in_use->status_var.ha_read_rnd_count, - &LOCK_status); + ha_statistic_increment(&SSV::ha_read_rnd_count); int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length)); table->status=error ? STATUS_NOT_FOUND: 0; return error; -- cgit v1.2.1 From 088e2395f1833f16c2ea3f7405f604165b4aa2cc Mon Sep 17 00:00:00 2001 From: "monty@mysql.com/narttu.mysql.fi" <> Date: Thu, 10 May 2007 12:59:39 +0300 Subject: WL#3817: Simplify string / memory area types and make things more consistent (first part) The following type conversions was done: - Changed byte to uchar - Changed gptr to uchar* - Change my_string to char * - Change my_size_t to size_t - Change size_s to size_t Removed declaration of byte, gptr, my_string, my_size_t and size_s. Following function parameter changes was done: - All string functions in mysys/strings was changed to use size_t instead of uint for string lengths. - All read()/write() functions changed to use size_t (including vio). - All protocoll functions changed to use size_t instead of uint - Functions that used a pointer to a string length was changed to use size_t* - Changed malloc(), free() and related functions from using gptr to use void * as this requires fewer casts in the code and is more in line with how the standard functions work. - Added extra length argument to dirname_part() to return the length of the created string. - Changed (at least) following functions to take uchar* as argument: - db_dump() - my_net_write() - net_write_command() - net_store_data() - DBUG_DUMP() - decimal2bin() & bin2decimal() - Changed my_compress() and my_uncompress() to use size_t. Changed one argument to my_uncompress() from a pointer to a value as we only return one value (makes function easier to use). - Changed type of 'pack_data' argument to packfrm() to avoid casts. - Changed in readfrm() and writefrom(), ha_discover and handler::discover() the type for argument 'frmdata' to uchar** to avoid casts. - Changed most Field functions to use uchar* instead of char* (reduced a lot of casts). - Changed field->val_xxx(xxx, new_ptr) to take const pointers. Other changes: - Removed a lot of not needed casts - Added a few new cast required by other changes - Added some cast to my_multi_malloc() arguments for safety (as string lengths needs to be uint, not size_t). - Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done explicitely as this conflict was often hided by casting the function to hash_get_key). - Changed some buffers to memory regions to uchar* to avoid casts. - Changed some string lengths from uint to size_t. - Changed field->ptr to be uchar* instead of char*. This allowed us to get rid of a lot of casts. - Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar - Include zlib.h in some files as we needed declaration of crc32() - Changed MY_FILE_ERROR to be (size_t) -1. - Changed many variables to hold the result of my_read() / my_write() to be size_t. This was needed to properly detect errors (which are returned as (size_t) -1). - Removed some very old VMS code - Changed packfrm()/unpackfrm() to not be depending on uint size (portability fix) - Removed windows specific code to restore cursor position as this causes slowdown on windows and we should not mix read() and pread() calls anyway as this is not thread safe. Updated function comment to reflect this. Changed function that depended on original behavior of my_pwrite() to itself restore the cursor position (one such case). - Added some missing checking of return value of malloc(). - Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow. - Changed type of table_def::m_size from my_size_t to ulong to reflect that m_size is the number of elements in the array, not a string/memory length. - Moved THD::max_row_length() to table.cc (as it's not depending on THD). Inlined max_row_length_blob() into this function. - More function comments - Fixed some compiler warnings when compiled without partitions. - Removed setting of LEX_STRING() arguments in declaration (portability fix). - Some trivial indentation/variable name changes. - Some trivial code simplifications: - Replaced some calls to alloc_root + memcpy to use strmake_root()/strdup_root(). - Changed some calls from memdup() to strmake() (Safety fix) - Simpler loops in client-simple.c --- storage/myisam/ha_myisam.cc | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index d31f5b7e792..d2a45d41566 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -121,7 +121,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, { uint i, j, recpos, minpos, fieldpos, temp_length, length; enum ha_base_keytype type= HA_KEYTYPE_BINARY; - byte *record; + uchar *record; KEY *pos; MI_KEYDEF *keydef; MI_COLUMNDEF *recinfo, *recinfo_pos; @@ -531,7 +531,7 @@ int ha_myisam::net_read_dump(NET* net) error= -1; goto err; } - if (my_write(data_fd, (byte*)net->read_pos, (uint) packet_len, + if (my_write(data_fd, (uchar*)net->read_pos, (uint) packet_len, MYF(MY_WME|MY_FNABP))) { error = errno; @@ -550,7 +550,7 @@ int ha_myisam::dump(THD* thd, int fd) uint blocksize = share->blocksize; my_off_t bytes_to_read = share->state.state.data_file_length; int data_fd = file->dfile; - byte * buf = (byte*) my_malloc(blocksize, MYF(MY_WME)); + uchar *buf = (uchar*) my_malloc(blocksize, MYF(MY_WME)); if (!buf) return ENOMEM; @@ -558,7 +558,7 @@ int ha_myisam::dump(THD* thd, int fd) my_seek(data_fd, 0L, MY_SEEK_SET, MYF(MY_WME)); for (; bytes_to_read > 0;) { - uint bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME)); + size_t bytes = my_read(data_fd, buf, blocksize, MYF(MY_WME)); if (bytes == MY_FILE_ERROR) { error = errno; @@ -575,7 +575,7 @@ int ha_myisam::dump(THD* thd, int fd) } else { - if (my_net_write(net, (char*) buf, bytes)) + if (my_net_write(net, buf, bytes)) { error = errno ? errno : EPIPE; goto err; @@ -586,13 +586,13 @@ int ha_myisam::dump(THD* thd, int fd) if (fd < 0) { - if (my_net_write(net, "", 0)) + if (my_net_write(net, (uchar*) "", 0)) error = errno ? errno : EPIPE; net_flush(net); } err: - my_free((gptr) buf, MYF(0)); + my_free((uchar*) buf, MYF(0)); return error; } #endif /* HAVE_REPLICATION */ @@ -710,7 +710,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) recinfo must be freed. */ if (recinfo) - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); return my_errno; } @@ -721,7 +721,7 @@ int ha_myisam::close(void) return mi_close(tmp); } -int ha_myisam::write_row(byte * buf) +int ha_myisam::write_row(uchar *buf) { statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status); @@ -1594,7 +1594,7 @@ bool ha_myisam::is_crashed() const (my_disable_locking && file->s->state.open_count)); } -int ha_myisam::update_row(const byte * old_data, byte * new_data) +int ha_myisam::update_row(const uchar *old_data, uchar *new_data) { statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) @@ -1602,13 +1602,13 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data) return mi_update(file,old_data,new_data); } -int ha_myisam::delete_row(const byte * buf) +int ha_myisam::delete_row(const uchar *buf) { statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status); return mi_delete(file,buf); } -int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map, +int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { DBUG_ASSERT(inited==INDEX); @@ -1619,7 +1619,7 @@ int ha_myisam::index_read(byte *buf, const byte *key, key_part_map keypart_map, return error; } -int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key, +int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key, key_part_map keypart_map, enum ha_rkey_function find_flag) { @@ -1630,7 +1630,7 @@ int ha_myisam::index_read_idx(byte *buf, uint index, const byte *key, return error; } -int ha_myisam::index_read_last(byte *buf, const byte *key, +int ha_myisam::index_read_last(uchar *buf, const uchar *key, key_part_map keypart_map) { DBUG_ENTER("ha_myisam::index_read_last"); @@ -1643,7 +1643,7 @@ int ha_myisam::index_read_last(byte *buf, const byte *key, DBUG_RETURN(error); } -int ha_myisam::index_next(byte * buf) +int ha_myisam::index_next(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_next_count, @@ -1653,7 +1653,7 @@ int ha_myisam::index_next(byte * buf) return error; } -int ha_myisam::index_prev(byte * buf) +int ha_myisam::index_prev(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_prev_count, @@ -1663,7 +1663,7 @@ int ha_myisam::index_prev(byte * buf) return error; } -int ha_myisam::index_first(byte * buf) +int ha_myisam::index_first(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_first_count, @@ -1673,7 +1673,7 @@ int ha_myisam::index_first(byte * buf) return error; } -int ha_myisam::index_last(byte * buf) +int ha_myisam::index_last(uchar *buf) { DBUG_ASSERT(inited==INDEX); statistic_increment(table->in_use->status_var.ha_read_last_count, @@ -1683,8 +1683,8 @@ int ha_myisam::index_last(byte * buf) return error; } -int ha_myisam::index_next_same(byte * buf, - const byte *key __attribute__((unused)), +int ha_myisam::index_next_same(uchar *buf, + const uchar *key __attribute__((unused)), uint length __attribute__((unused))) { DBUG_ASSERT(inited==INDEX); @@ -1703,7 +1703,7 @@ int ha_myisam::rnd_init(bool scan) return mi_reset(file); // Free buffers } -int ha_myisam::rnd_next(byte *buf) +int ha_myisam::rnd_next(uchar *buf) { statistic_increment(table->in_use->status_var.ha_read_rnd_next_count, &LOCK_status); @@ -1712,12 +1712,12 @@ int ha_myisam::rnd_next(byte *buf) return error; } -int ha_myisam::restart_rnd_next(byte *buf, byte *pos) +int ha_myisam::restart_rnd_next(uchar *buf, uchar *pos) { return rnd_pos(buf,pos); } -int ha_myisam::rnd_pos(byte * buf, byte *pos) +int ha_myisam::rnd_pos(uchar *buf, uchar *pos) { statistic_increment(table->in_use->status_var.ha_read_rnd_count, &LOCK_status); @@ -1726,7 +1726,7 @@ int ha_myisam::rnd_pos(byte * buf, byte *pos) return error; } -void ha_myisam::position(const byte* record) +void ha_myisam::position(const uchar *record) { my_off_t row_position= mi_position(file); my_store_ptr(ref, ref_length, row_position); @@ -1911,7 +1911,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, records, recinfo, 0, (MI_UNIQUEDEF*) 0, &create_info, create_flags); - my_free((gptr) recinfo, MYF(0)); + my_free((uchar*) recinfo, MYF(0)); DBUG_RETURN(error); } @@ -1929,7 +1929,7 @@ void ha_myisam::get_auto_increment(ulonglong offset, ulonglong increment, { ulonglong nr; int error; - byte key[MI_MAX_KEY_LENGTH]; + uchar key[MI_MAX_KEY_LENGTH]; if (!table->s->next_number_key_offset) { // Autoincrement at key-start @@ -2002,7 +2002,7 @@ ha_rows ha_myisam::records_in_range(uint inx, key_range *min_key, } -int ha_myisam::ft_read(byte * buf) +int ha_myisam::ft_read(uchar *buf) { int error; -- cgit v1.2.1 From 9a92325c02c55d2b60f44ca3e8724787b8d2d100 Mon Sep 17 00:00:00 2001 From: "mats@kindahl-laptop.dnsalias.net" <> Date: Mon, 28 May 2007 12:50:29 +0200 Subject: WL#3303 (RBR: Engine-controlled logging format): Adding support to allow engines to tell what formats they can handle. The server will generate an error if it is not possible to log the statement according to the logging mode in effect. Adding flags to several storage engines to state what they can handle. Changes to NDB handler removing code that forces row-based mode and adding flag saying that NDB can only handle row format. Adding check that binlog flags are only used for real tables that are opened for writing. --- storage/myisam/ha_myisam.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index d31f5b7e792..61303aaf0ae 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -474,6 +474,7 @@ void mi_check_print_warning(MI_CHECK *param, const char *fmt,...) ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), file(0), int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | + HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS | HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS | -- cgit v1.2.1 From a1529d92d1a4f71a6f04eae958c3b0be2869b8ba Mon Sep 17 00:00:00 2001 From: "svoj@mysql.com/june.mysql.com" <> Date: Fri, 8 Jun 2007 11:20:50 +0500 Subject: BUG#26976 - Missing table in merge not noted in related error msg + SHOW CREATE TABLE fails After merge fixes. --- storage/myisam/ha_myisam.cc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 351ec87fb51..12c722e8f80 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1224,11 +1224,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) table->keys_in_use_for_query.clear_all(); if (table_list->process_index_hints(table)) - { - errmsg= thd->net.last_error; - error= HA_ADMIN_FAILED; - goto err; - } + DBUG_RETURN(HA_ADMIN_FAILED); map= ~(ulonglong) 0; if (!table->keys_in_use_for_query.is_clear_all()) /* use all keys if there's no list specified by the user through hints */ @@ -1243,7 +1239,6 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) error= HA_ADMIN_CORRUPT; } - err: if (error != HA_ADMIN_OK) { /* Send error to user */ @@ -1278,11 +1273,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) table->keys_in_use_for_query.clear_all(); if (table_list->process_index_hints(table)) - { - errmsg= thd->net.last_error; - error= HA_ADMIN_FAILED; - goto err; - } + DBUG_RETURN(HA_ADMIN_FAILED); map= ~(ulonglong) 0; /* Check validity of the index references */ -- cgit v1.2.1 From c15a2647a0a4e88612bb3c3aa8d7417860016155 Mon Sep 17 00:00:00 2001 From: "iggy@alf." <> Date: Fri, 15 Jun 2007 14:32:16 -0400 Subject: Embedded Server doesn't build on Windows. - Add build configuration parameter EMBEDDED_ONLY which will configure the VS solution to produce only mysql embedded binary. - Make necessary updates to successfully compile solution. --- storage/myisam/ha_myisam.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 8b95cdb30fd..f35b6ae761b 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1437,8 +1437,10 @@ int ha_myisam::enable_indexes(uint mode) might have been set by the first repair. They can still be seen with SHOW WARNINGS then. */ +#ifndef EMBEDDED_LIBRARY if (! error) thd->clear_error(); +#endif /* EMBEDDED_LIBRARY */ } info(HA_STATUS_CONST); thd->proc_info=save_proc_info; -- cgit v1.2.1 From c7bbd8917c534815316b356e5ea581d9e7167fed Mon Sep 17 00:00:00 2001 From: "malff/marcsql@weblab.(none)" <> Date: Fri, 27 Jul 2007 00:31:06 -0600 Subject: WL#3984 (Revise locking of mysql.general_log and mysql.slow_log) Bug#25422 (Hang with log tables) Bug 17876 (Truncating mysql.slow_log in a SP after using cursor locks the thread) Bug 23044 (Warnings on flush of a log table) Bug 29129 (Resetting general_log while the GLOBAL READ LOCK is set causes a deadlock) Prior to this fix, the server would hang when performing concurrent ALTER TABLE or TRUNCATE TABLE statements against the LOG TABLES, which are mysql.general_log and mysql.slow_log. The root cause traces to the following code: in sql_base.cc, open_table() if (table->in_use != thd) { /* wait_for_condition will unlock LOCK_open for us */ wait_for_condition(thd, &LOCK_open, &COND_refresh); } The problem with this code is that the current implementation of the LOGGER creates 'fake' THD objects, like - Log_to_csv_event_handler::general_log_thd - Log_to_csv_event_handler::slow_log_thd which are not associated to a real thread running in the server, so that waiting for these non-existing threads to release table locks cause the dead lock. In general, the design of Log_to_csv_event_handler does not fit into the general architecture of the server, so that the concept of general_log_thd and slow_log_thd has to be abandoned: - this implementation does not work with table locking - it will not work with commands like SHOW PROCESSLIST - having the log tables always opened does not integrate well with DDL operations / FLUSH TABLES / SET GLOBAL READ_ONLY With this patch, the fundamental design of the LOGGER has been changed to: - always open and close a log table when writing a log - remove totally the usage of fake THD objects - clarify how locking of log tables is implemented in general. See WL#3984 for details related to the new locking design. Additional changes (misc bugs exposed and fixed): 1) mysqldump which would ignore some tables in dump_all_tables_in_db(), but forget to ignore the same in dump_all_views_in_db(). 2) mysqldump would also issue an empty "LOCK TABLE" command when all the tables to lock are to be ignored (numrows == 0), instead of not issuing the query. 3) Internal errors handlers could intercept errors but not warnings (see sql_error.cc). 4) Implementing a nested call to open tables, for the performance schema tables, exposed an existing bug in remove_table_from_cache(), which would perform: in_use->some_tables_deleted=1; against another thread, without any consideration about thread locking. This call inside remove_table_from_cache() was not required anyway, since calling mysql_lock_abort() takes care of aborting -- cleanly -- threads that might hold a lock on a table. This line (in_use->some_tables_deleted=1) has been removed. --- storage/myisam/ha_myisam.cc | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index c86459ae0a7..77334b2cfba 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -607,41 +607,7 @@ err: #endif /* HAVE_REPLICATION */ -bool ha_myisam::check_if_locking_is_allowed(uint sql_command, - ulong type, TABLE *table, - uint count, uint current, - uint *system_count, - bool called_by_privileged_thread) -{ - /* - To be able to open and lock for reading system tables like 'mysql.proc', - when we already have some tables opened and locked, and avoid deadlocks - we have to disallow write-locking of these tables with any other tables. - */ - if (table->s->system_table && - table->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE) - (*system_count)++; - - /* 'current' is an index, that's why '<=' below. */ - if (*system_count > 0 && *system_count <= current) - { - my_error(ER_WRONG_LOCK_OF_SYSTEM_TABLE, MYF(0)); - return FALSE; - } - - /* - Deny locking of the log tables, which is incompatible with - concurrent insert. Unless called from a logger THD (general_log_thd - or slow_log_thd) or by a privileged thread. - */ - if (!called_by_privileged_thread) - return check_if_log_table_locking_is_allowed(sql_command, type, table); - - return TRUE; -} - - /* Name is here without an extension */ - +/* Name is here without an extension */ int ha_myisam::open(const char *name, int mode, uint test_if_locked) { MI_KEYDEF *keyinfo; -- cgit v1.2.1 From e53a73e26cf858ac48ead40927d84d54e33c1695 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com/nosik.monty.fi" <> Date: Mon, 13 Aug 2007 16:11:25 +0300 Subject: Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris Faster thr_alarm() Added 'Opened_files' status variable to track calls to my_open() Don't give warnings when running mysql_install_db Added option --source-install to mysql_install_db I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems index_read() -> index_read_map() index_read_idx() -> index_read_idx_map() index_read_last() -> index_read_last_map() --- storage/myisam/ha_myisam.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 77334b2cfba..bc6e5706c21 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1576,8 +1576,9 @@ int ha_myisam::delete_row(const uchar *buf) return mi_delete(file,buf); } -int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map, - enum ha_rkey_function find_flag) +int ha_myisam::index_read_map(uchar *buf, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) { DBUG_ASSERT(inited==INDEX); ha_statistic_increment(&SSV::ha_read_key_count); @@ -1586,9 +1587,9 @@ int ha_myisam::index_read(uchar *buf, const uchar *key, key_part_map keypart_map return error; } -int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key, - key_part_map keypart_map, - enum ha_rkey_function find_flag) +int ha_myisam::index_read_idx_map(uchar *buf, uint index, const uchar *key, + key_part_map keypart_map, + enum ha_rkey_function find_flag) { ha_statistic_increment(&SSV::ha_read_key_count); int error=mi_rkey(file, buf, index, key, keypart_map, find_flag); @@ -1596,8 +1597,8 @@ int ha_myisam::index_read_idx(uchar *buf, uint index, const uchar *key, return error; } -int ha_myisam::index_read_last(uchar *buf, const uchar *key, - key_part_map keypart_map) +int ha_myisam::index_read_last_map(uchar *buf, const uchar *key, + key_part_map keypart_map) { DBUG_ENTER("ha_myisam::index_read_last"); DBUG_ASSERT(inited==INDEX); -- cgit v1.2.1 From 4eee02dd3ded060c230e5013483f33e6c99b1fc3 Mon Sep 17 00:00:00 2001 From: "gkodinov/kgeorge@macbook.local" <> Date: Fri, 21 Sep 2007 10:15:16 +0200 Subject: fixed type conversion warnings revealed by bug 30639 --- storage/myisam/ha_myisam.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'storage/myisam/ha_myisam.cc') diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index bc6e5706c21..ca4c40547ee 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1461,7 +1461,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows) DBUG_ENTER("ha_myisam::start_bulk_insert"); THD *thd= current_thd; ulong size= min(thd->variables.read_buff_size, - table->s->avg_row_length*rows); + (ulong) (table->s->avg_row_length*rows)); DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu", (ulong) rows, size)); -- cgit v1.2.1