From 069a068c90d8fa6ccb8028f3f2cd42c238b04699 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 23 Jul 2010 22:37:21 +0200 Subject: [PATCH 1/2] restore the unintentinally broken ABI --- include/maria.h | 2 +- sql/ha_ndbcluster.cc | 2 +- sql/ha_ndbcluster.h | 2 +- sql/ha_partition.cc | 7 +++---- sql/ha_partition.h | 2 +- sql/handler.h | 7 +++---- sql/log_event.cc | 2 +- sql/log_event_old.cc | 4 ++-- sql/sql_insert.cc | 6 +++--- sql/sql_load.cc | 2 +- sql/sql_table.cc | 2 +- storage/archive/ha_archive.cc | 2 +- storage/archive/ha_archive.h | 2 +- storage/federated/ha_federated.cc | 7 +++++-- storage/federated/ha_federated.h | 4 ++-- storage/federatedx/ha_federatedx.cc | 8 ++++++-- storage/federatedx/ha_federatedx.h | 4 ++-- storage/maria/ha_maria.cc | 6 +++--- storage/maria/ha_maria.h | 2 +- storage/maria/ma_write.c | 4 ++-- storage/myisam/ha_myisam.cc | 4 ++-- storage/myisam/ha_myisam.h | 2 +- 22 files changed, 44 insertions(+), 39 deletions(-) diff --git a/include/maria.h b/include/maria.h index c961b7d1672..106aa61ddbb 100644 --- a/include/maria.h +++ b/include/maria.h @@ -452,7 +452,7 @@ my_bool maria_test_if_sort_rep(MARIA_HA *info, ha_rows rows, ulonglong key_map, int maria_init_bulk_insert(MARIA_HA *info, ulong cache_size, ha_rows rows); void maria_flush_bulk_insert(MARIA_HA *info, uint inx); -void maria_end_bulk_insert(MARIA_HA *info, my_bool table_will_be_deleted); +void maria_end_bulk_insert(MARIA_HA *info); int maria_assign_to_pagecache(MARIA_HA *info, ulonglong key_map, PAGECACHE *key_cache); void maria_change_pagecache(PAGECACHE *old_key_cache, diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 68faef750c7..ceb60d127cf 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4232,7 +4232,7 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows) /** End of an insert. */ -int ha_ndbcluster::end_bulk_insert(bool abort) +int ha_ndbcluster::end_bulk_insert() { int error= 0; DBUG_ENTER("end_bulk_insert"); diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index f3651ebeca9..a17323d3fd6 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -322,7 +322,7 @@ class ha_ndbcluster: public handler double scan_time(); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); void start_bulk_insert(ha_rows rows); - int end_bulk_insert(bool abort); + int end_bulk_insert(); static Thd_ndb* seize_thd_ndb(); static void release_thd_ndb(Thd_ndb* thd_ndb); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 2f16d730296..9b2279a93d9 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3413,18 +3413,17 @@ ha_rows ha_partition::guess_bulk_insert_rows() SYNOPSIS end_bulk_insert() - abort 1 if table will be deleted (error condition) RETURN VALUE >0 Error code 0 Success Note: end_bulk_insert can be called without start_bulk_insert - being called, see bugĀ¤44108. + being called, see bug#44108. */ -int ha_partition::end_bulk_insert(bool abort) +int ha_partition::end_bulk_insert() { int error= 0; uint i; @@ -3437,7 +3436,7 @@ int ha_partition::end_bulk_insert(bool abort) { int tmp; if (bitmap_is_set(&m_bulk_insert_started, i) && - (tmp= m_file[i]->ha_end_bulk_insert(abort))) + (tmp= m_file[i]->ha_end_bulk_insert())) error= tmp; } bitmap_clear_all(&m_bulk_insert_started); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index f37587f2b71..9f6d9e0a5ba 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -364,7 +364,7 @@ public: virtual int delete_row(const uchar * buf); virtual int delete_all_rows(void); virtual void start_bulk_insert(ha_rows rows); - virtual int end_bulk_insert(bool); + virtual int end_bulk_insert(); private: ha_rows guess_bulk_insert_rows(); void start_part_bulk_insert(THD *thd, uint part_id); diff --git a/sql/handler.h b/sql/handler.h index 2077353959c..58aa07c06d7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1249,10 +1249,10 @@ public: estimation_rows_to_insert= rows; start_bulk_insert(rows); } - int ha_end_bulk_insert(bool abort) + int ha_end_bulk_insert() { estimation_rows_to_insert= 0; - return end_bulk_insert(abort); + return end_bulk_insert(); } int ha_bulk_update_row(const uchar *old_data, uchar *new_data, uint *dup_key_found); @@ -1796,7 +1796,6 @@ protected: private: /* Private helpers */ inline void mark_trx_read_write(); -private: /* Low-level primitives for storage engines. These should be overridden by the storage engine class. To call these methods, use @@ -1879,7 +1878,7 @@ private: virtual int repair(THD* thd, HA_CHECK_OPT* check_opt) { return HA_ADMIN_NOT_IMPLEMENTED; } virtual void start_bulk_insert(ha_rows rows) {} - virtual int end_bulk_insert(bool abort) { return 0; } + virtual int end_bulk_insert() { return 0; } virtual int index_read(uchar * buf, const uchar * key, uint key_len, enum ha_rkey_function find_flag) { return HA_ERR_WRONG_COMMAND; } diff --git a/sql/log_event.cc b/sql/log_event.cc index 7d8bedd6c79..536915d2c45 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8416,7 +8416,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability * ultimately. Still todo: fix */ } - if ((local_error= m_table->file->ha_end_bulk_insert(0))) + if ((local_error= m_table->file->ha_end_bulk_insert())) { m_table->file->print_error(local_error, MYF(0)); } diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 87225ce55eb..433d8d29001 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -943,7 +943,7 @@ int Write_rows_log_event_old::do_after_row_operations(TABLE *table, int error) fires bug#27077 todo: explain or fix */ - if ((local_error= table->file->ha_end_bulk_insert(0))) + if ((local_error= table->file->ha_end_bulk_insert())) { table->file->print_error(local_error, MYF(0)); } @@ -2636,7 +2636,7 @@ Write_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabili fires bug#27077 todo: explain or fix */ - if ((local_error= m_table->file->ha_end_bulk_insert(0))) + if ((local_error= m_table->file->ha_end_bulk_insert())) { m_table->file->print_error(local_error, MYF(0)); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 3836b259396..100bda421b2 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -887,7 +887,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, auto_inc values from the delayed_insert thread as they share TABLE. */ table->file->ha_release_auto_increment(); - if (using_bulk_insert && table->file->ha_end_bulk_insert(0) && !error) + if (using_bulk_insert && table->file->ha_end_bulk_insert() && !error) { table->file->print_error(my_errno,MYF(0)); error=1; @@ -3277,7 +3277,7 @@ bool select_insert::send_eof() DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'", trans_table, table->file->table_type())); - error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert(0) : 0; + error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert() : 0; table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); @@ -3360,7 +3360,7 @@ void select_insert::abort() { before. */ if (!thd->prelocked_mode) - table->file->ha_end_bulk_insert(0); + table->file->ha_end_bulk_insert(); /* If at least one row has been inserted/modified and will stay in diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7399b442573..e5ef7bed5e0 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -432,7 +432,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, error= read_sep_field(thd, info, table_list, fields_vars, set_fields, set_values, read_info, *enclosed, skip_lines, ignore); - if (!thd->prelocked_mode && table->file->ha_end_bulk_insert(0) && !error) + if (!thd->prelocked_mode && table->file->ha_end_bulk_insert() && !error) { table->file->print_error(my_errno, MYF(0)); error= 1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 85fc7ee724d..15cc162f6ab 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -7881,7 +7881,7 @@ err: if (error > 0) to->file->extra(HA_EXTRA_PREPARE_FOR_DROP); - if (errpos >= 3 && to->file->ha_end_bulk_insert(error > 1) && error <= 0) + if (errpos >= 3 && to->file->ha_end_bulk_insert() && error <= 0) { to->file->print_error(my_errno,MYF(0)); error= 1; diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index fd0993c9914..988337ec50e 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1539,7 +1539,7 @@ void ha_archive::start_bulk_insert(ha_rows rows) Other side of start_bulk_insert, is end_bulk_insert. Here we turn off the bulk insert flag, and set the share dirty so that the next select will call sync for us. */ -int ha_archive::end_bulk_insert(bool table_will_be_deleted) +int ha_archive::end_bulk_insert() { DBUG_ENTER("ha_archive::end_bulk_insert"); bulk_insert= FALSE; diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index 22f8302982d..ab630ed22fd 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -134,7 +134,7 @@ public: int optimize(THD* thd, HA_CHECK_OPT* check_opt); int repair(THD* thd, HA_CHECK_OPT* check_opt); void start_bulk_insert(ha_rows rows); - int end_bulk_insert(bool table_will_be_deleted); + int end_bulk_insert(); enum row_type get_row_type() const { return ROW_TYPE_COMPRESSED; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 4330d9bdd30..619393289a9 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1983,12 +1983,12 @@ void ha_federated::start_bulk_insert(ha_rows rows) @retval != 0 Error occured at remote server. Also sets my_errno. */ -int ha_federated::end_bulk_insert(bool abort) +int ha_federated::end_bulk_insert() { int error= 0; DBUG_ENTER("ha_federated::end_bulk_insert"); - if (!abort && bulk_insert.str && bulk_insert.length) + if (!table_will_be_deleted && bulk_insert.str && bulk_insert.length) { if (real_query(bulk_insert.str, bulk_insert.length)) error= stash_remote_error(); @@ -2905,6 +2905,8 @@ int ha_federated::extra(ha_extra_function operation) case HA_EXTRA_INSERT_WITH_UPDATE: insert_dup_update= TRUE; break; + case HA_EXTRA_PREPARE_FOR_DROP: + table_will_be_deleted = TRUE; default: /* do nothing */ DBUG_PRINT("info",("unhandled operation: %d", (uint) operation)); @@ -3305,6 +3307,7 @@ int ha_federated::external_lock(THD *thd, int lock_type) } } #endif /* XXX_SUPERCEDED_BY_WL2952 */ + table_will_be_deleted = FALSE; DBUG_RETURN(error); } diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index ab31e3c1680..142e0e95e2b 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -88,7 +88,7 @@ class ha_federated: public handler Array of all stored results we get during a query execution. */ DYNAMIC_ARRAY results; - bool position_called; + bool position_called, table_will_be_deleted; uint fetch_num; // stores the fetch num MYSQL_ROW_OFFSET current_position; // Current position used by ::position() int remote_error_number; @@ -210,7 +210,7 @@ public: int close(void); // required void start_bulk_insert(ha_rows rows); - int end_bulk_insert(bool abort); + int end_bulk_insert(); int write_row(uchar *buf); int update_row(const uchar *old_data, uchar *new_data); int delete_row(const uchar *buf); diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 435530e8caa..a88c60efb74 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -2143,12 +2143,12 @@ void ha_federatedx::start_bulk_insert(ha_rows rows) @retval != 0 Error occured at remote server. Also sets my_errno. */ -int ha_federatedx::end_bulk_insert(bool abort) +int ha_federatedx::end_bulk_insert() { int error= 0; DBUG_ENTER("ha_federatedx::end_bulk_insert"); - if (bulk_insert.str && bulk_insert.length && !abort) + if (bulk_insert.str && bulk_insert.length && !table_will_be_deleted) { if ((error= txn->acquire(share, FALSE, &io))) DBUG_RETURN(error); @@ -3082,6 +3082,9 @@ int ha_federatedx::extra(ha_extra_function operation) case HA_EXTRA_INSERT_WITH_UPDATE: insert_dup_update= TRUE; break; + case HA_EXTRA_PREPARE_FOR_DROP: + table_will_be_deleted = TRUE; + break; default: /* do nothing */ DBUG_PRINT("info",("unhandled operation: %d", (uint) operation)); @@ -3391,6 +3394,7 @@ int ha_federatedx::external_lock(MYSQL_THD thd, int lock_type) txn->release(&io); else { + table_will_be_deleted = FALSE; txn= get_txn(thd); if (!(error= txn->acquire(share, lock_type == F_RDLCK, &io)) && (lock_type == F_WRLCK || !io->is_autocommit())) diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index 0fa9df25895..2fd3c559321 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -259,7 +259,7 @@ class ha_federatedx: public handler int remote_error_number; char remote_error_buf[FEDERATEDX_QUERY_BUFFER_SIZE]; bool ignore_duplicates, replace_duplicates; - bool insert_dup_update; + bool insert_dup_update, table_will_be_deleted; DYNAMIC_STRING bulk_insert; private: @@ -379,7 +379,7 @@ public: int close(void); // required void start_bulk_insert(ha_rows rows); - int end_bulk_insert(bool abort); + int end_bulk_insert(); int write_row(uchar *buf); int update_row(const uchar *old_data, uchar *new_data); int delete_row(const uchar *buf); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index e919dbbc3cc..5140ad17d74 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1944,14 +1944,14 @@ void ha_maria::start_bulk_insert(ha_rows rows) != 0 Error */ -int ha_maria::end_bulk_insert(bool table_will_be_deleted) +int ha_maria::end_bulk_insert() { int err; DBUG_ENTER("ha_maria::end_bulk_insert"); - maria_end_bulk_insert(file, table_will_be_deleted); + maria_end_bulk_insert(file); if ((err= maria_extra(file, HA_EXTRA_NO_CACHE, 0))) goto end; - if (can_enable_indexes && !table_will_be_deleted) + if (can_enable_indexes && !file->s->deleting) err= enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE); end: if (bulk_insert_single_undo != BULK_INSERT_NONE) diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index ab4012ca38c..c0f2041fddb 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -123,7 +123,7 @@ public: int enable_indexes(uint mode); int indexes_are_disabled(void); void start_bulk_insert(ha_rows rows); - int end_bulk_insert(bool abort); + int end_bulk_insert(); ha_rows records_in_range(uint inx, key_range * min_key, key_range * max_key); void update_create_info(HA_CREATE_INFO * create_info); int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info); diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index 3b9ca46899f..5e3ccdfaed1 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -1755,7 +1755,7 @@ void maria_flush_bulk_insert(MARIA_HA *info, uint inx) } } -void maria_end_bulk_insert(MARIA_HA *info, my_bool abort) +void maria_end_bulk_insert(MARIA_HA *info) { DBUG_ENTER("maria_end_bulk_insert"); if (info->bulk_insert) @@ -1765,7 +1765,7 @@ void maria_end_bulk_insert(MARIA_HA *info, my_bool abort) { if (is_tree_inited(&info->bulk_insert[i])) { - if (abort) + if (info->s->deleting) reset_free_element(&info->bulk_insert[i]); delete_tree(&info->bulk_insert[i]); } diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 9597f848616..5f807be2374 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1591,11 +1591,11 @@ void ha_myisam::start_bulk_insert(ha_rows rows) != 0 Error */ -int ha_myisam::end_bulk_insert(bool abort) +int ha_myisam::end_bulk_insert() { mi_end_bulk_insert(file); int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0); - if (!err && !abort) + if (!err && !file->s->deleting) { if (can_enable_indexes) { diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 1b7e948b928..b7d15a6e8b7 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -108,7 +108,7 @@ class ha_myisam: public handler int enable_indexes(uint mode); int indexes_are_disabled(void); void start_bulk_insert(ha_rows rows); - int end_bulk_insert(bool abort); + int end_bulk_insert(); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); void update_create_info(HA_CREATE_INFO *create_info); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); From cf86a5ae5284c744bc4cc727073387d0799da5c2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 24 Jul 2010 14:17:30 +0200 Subject: [PATCH 2/2] force the generation of mysqlmanager.map file --- server-tools/instance-manager/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server-tools/instance-manager/CMakeLists.txt b/server-tools/instance-manager/CMakeLists.txt index 5e61c384254..c988a03912e 100755 --- a/server-tools/instance-manager/CMakeLists.txt +++ b/server-tools/instance-manager/CMakeLists.txt @@ -20,6 +20,8 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") ADD_DEFINITIONS(-DMYSQL_SERVER -DMYSQL_INSTANCE_MANAGER) INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/sql ${PROJECT_SOURCE_DIR}/extra/yassl/include) + +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS") ADD_EXECUTABLE(mysqlmanager buffer.cc command.cc commands.cc guardian.cc instance.cc instance_map.cc instance_options.cc listener.cc log.cc manager.cc messages.cc mysql_connection.cc