diff options
author | Michael Widenius <monty@askmonty.org> | 2011-06-27 19:07:24 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-06-27 19:07:24 +0300 |
commit | ba9a890f0c389a93925c8c21a30e64801f397f18 (patch) | |
tree | 30b4ae8dda481d0c057641fef6eb1edea8b643ec /sql | |
parent | a6542a13abcb0e5632919b30a7bd343757fbccba (diff) | |
download | mariadb-git-ba9a890f0c389a93925c8c21a30e64801f397f18.tar.gz |
New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
Split status variable Rows_read to Rows_read and Rows_tmp_read so that one can see how much real data is read.
Same was done with with Handler_update and Handler_write.
Fixed bug in MEMORY tables where some variables was counted twice.
Added new internal handler call 'ha_close()' to have one place to gather statistics.
Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
mysql-test/r/status.result:
Updated test results and added new tests
mysql-test/r/status_user.result:
Udated test results
mysql-test/t/status.test:
Added new test for temporary table status variables
sql/ha_partition.cc:
Changed to call ha_close() instead of close()
sql/handler.cc:
Added internal_tmp_table variable for easy checking of temporary tables.
Added new internal handler call 'ha_close()' to have one place to gather statistics.
Gather statistics for internal temporary tables.
sql/handler.h:
Added handler variables internal_tmp_table, rows_tmp_read.
Split function update_index_statistics() to two.
Added ha_update_tmp_row() for faster tmp table handling with more statistics.
sql/item_sum.cc:
ha_write_row() -> ha_write_tmp_row()
sql/multi_range_read.cc:
close() -> ha_close()
sql/mysqld.cc:
New status variables: Rows_tmp_read, Handler_tmp_update and Handler_tmp_write
sql/opt_range.cc:
close() -> ha_close()
sql/sql_base.cc:
close() -> ha_close()
sql/sql_class.cc:
Added handling of rows_tmp_read
sql/sql_class.h:
Added new satistics variables.
rows_read++ -> update_rows_read() to be able to correctly count reads to internal temp tables.
Added handler::ha_update_tmp_row()
sql/sql_connect.cc:
Added comment
sql/sql_expression_cache.cc:
ha_write_row() -> ha_write_tmp_row()
sql/sql_select.cc:
close() -> ha_close()
ha_update_row() -> ha_update_tmp_row()
sql/sql_show.cc:
ha_write_row() -> ha_write_tmp_row()
sql/sql_table.cc:
Fixed bug where thd->open_options was set to wrong value when doing admin_recreate_table()
sql/sql_union.cc:
ha_write_row() -> ha_write_tmp_row()
sql/sql_update.cc:
ha_write_row() -> ha_write_tmp_row()
sql/table.cc:
close() -> ha_close()
storage/heap/ha_heap.cc:
Removed double counting of statistic variables.
close -> ha_close() to get tmp table statistics.
storage/maria/ha_maria.cc:
close -> ha_close() to get tmp table statistics.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 8 | ||||
-rw-r--r-- | sql/handler.cc | 20 | ||||
-rw-r--r-- | sql/handler.h | 20 | ||||
-rw-r--r-- | sql/item_sum.cc | 2 | ||||
-rw-r--r-- | sql/multi_range_read.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 | ||||
-rw-r--r-- | sql/opt_range.cc | 4 | ||||
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 25 | ||||
-rw-r--r-- | sql/sql_connect.cc | 1 | ||||
-rw-r--r-- | sql/sql_expression_cache.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 12 | ||||
-rw-r--r-- | sql/sql_show.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 8 | ||||
-rw-r--r-- | sql/sql_union.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/table.cc | 2 |
18 files changed, 81 insertions, 40 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index bd34cb04290..eabb10a0d5a 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1301,7 +1301,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl, DBUG_RETURN(0); error_external_lock: - VOID(file->close()); + VOID(file->ha_close()); error_open: VOID(file->ha_delete_table(part_name)); error_create: @@ -1347,7 +1347,7 @@ void ha_partition::cleanup_new_partition(uint part_count) while ((part_count > 0) && (*file)) { (*file)->ha_external_lock(thd, F_UNLCK); - (*file)->close(); + (*file)->ha_close(); /* Leave the (*file)->ha_delete_table(part_name) to the ddl-log */ @@ -2842,7 +2842,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) err_handler: DEBUG_SYNC(ha_thd(), "partition_open_error"); while (file-- != m_file) - (*file)->close(); + (*file)->ha_close(); err_alloc: bitmap_free(&m_bulk_insert_started); if (!m_is_clone_of) @@ -2928,7 +2928,7 @@ int ha_partition::close(void) repeat: do { - (*file)->close(); + (*file)->ha_close(); } while (*(++file)); if (first && m_added_file && m_added_file[0]) diff --git a/sql/handler.cc b/sql/handler.cc index 318e2e116e2..751e31fdf9f 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2168,7 +2168,7 @@ THD *handler::ha_thd(void) const Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set */ int handler::ha_open(TABLE *table_arg, const char *name, int mode, - int test_if_locked) + uint test_if_locked) { int error; DBUG_ENTER("handler::ha_open"); @@ -2212,11 +2212,22 @@ int handler::ha_open(TABLE *table_arg, const char *name, int mode, dup_ref=ref+ALIGN_SIZE(ref_length); cached_table_flags= table_flags(); } - rows_read= rows_changed= 0; - memset(index_rows_read, 0, sizeof(index_rows_read)); + reset_statistics(); + internal_tmp_table= test(test_if_locked & HA_OPEN_INTERNAL_TABLE); DBUG_RETURN(error); } +int handler::ha_close() +{ + DBUG_ENTER("ha_close"); + /* + Increment global statistics for temporary tables. + In_use is 0 for tables that was closed from the table cache. + */ + if (table->in_use) + status_var_add(table->in_use->status_var.rows_tmp_read, rows_tmp_read); + DBUG_RETURN(close()); +} /* Initialize handler for random reading, with error handling */ @@ -3238,7 +3249,7 @@ int handler::rename_table(const char * from, const char * to) void handler::drop_table(const char *name) { - close(); + ha_close(); delete_table(name); } @@ -3757,6 +3768,7 @@ void handler::update_global_table_stats() TABLE_STATS * table_stats; status_var_add(table->in_use->status_var.rows_read, rows_read); + DBUG_ASSERT(rows_tmp_read == 0); if (!table->in_use->userstat_running) { diff --git a/sql/handler.h b/sql/handler.h index 4707aabbd52..63e7c567b29 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1,4 +1,5 @@ /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. + Copyright 2009-2011 Monty Program Ab 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 @@ -1599,6 +1600,7 @@ public: KEY_PART_INFO *range_key_part; int key_compare_result_on_equal; bool eq_range; + bool internal_tmp_table; /* If internal tmp table */ /* TRUE <=> the engine guarantees that returned records are within the range @@ -1643,6 +1645,7 @@ public: */ /* Statistics variables */ ulonglong rows_read; + ulonglong rows_tmp_read; ulonglong rows_changed; /* One bigger than needed to avoid to test if key == MAX_KEY */ ulonglong index_rows_read[MAX_KEY+1]; @@ -1685,7 +1688,7 @@ public: } /* ha_ methods: pubilc wrappers for private virtual API */ - int ha_open(TABLE *table, const char *name, int mode, int test_if_locked); + int ha_open(TABLE *table, const char *name, int mode, uint test_if_locked); int ha_index_init(uint idx, bool sorted) { int result; @@ -1809,7 +1812,7 @@ public: uint get_dup_key(int error); void reset_statistics() { - rows_read= rows_changed= 0; + rows_read= rows_changed= rows_tmp_read= 0; bzero(index_rows_read, sizeof(index_rows_read)); } virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) @@ -1894,7 +1897,7 @@ public: */ uint get_index(void) const { return inited == INDEX ? active_index : MAX_KEY; } - virtual int close(void)=0; + int ha_close(void); /** @retval 0 Bulk update used by handler @@ -1970,10 +1973,18 @@ protected: virtual int index_last(uchar * buf) { return HA_ERR_WRONG_COMMAND; } virtual int index_next_same(uchar *buf, const uchar *key, uint keylen); + virtual int close(void)=0; + inline void update_rows_read() + { + if (likely(!internal_tmp_table)) + rows_read++; + else + rows_tmp_read++; + } inline void update_index_statistics() { index_rows_read[active_index]++; - rows_read++; + update_rows_read(); } public: @@ -2604,6 +2615,7 @@ public: virtual handlerton *partition_ht() const { return ht; } inline int ha_write_tmp_row(uchar *buf); + inline int ha_update_tmp_row(const uchar * old_data, uchar * new_data); }; #include "multi_range_read.h" diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e7fe2095481..bc4ab876b55 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2587,7 +2587,7 @@ bool Item_sum_count_distinct::add() */ return tree->unique_add(table->record[0] + table->s->null_bytes); } - if ((error= table->file->ha_write_row(table->record[0])) && + if ((error= table->file->ha_write_tmp_row(table->record[0])) && table->file->is_fatal_error(error, HA_CHECK_DUP)) return TRUE; return FALSE; diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index c666c571787..f0a1987c383 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -1075,7 +1075,7 @@ void DsMrr_impl::close_second_handler() { secondary_file->ha_index_or_rnd_end(); secondary_file->ha_external_lock(current_thd, F_UNLCK); - secondary_file->close(); + secondary_file->ha_close(); delete secondary_file; secondary_file= NULL; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5dcbaa0b13b..6cbd73f4a08 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -8266,6 +8266,8 @@ SHOW_VAR status_vars[]= { {"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS}, {"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS}, {"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS}, + {"Handler_tmp_update", (char*) offsetof(STATUS_VAR, ha_tmp_update_count), SHOW_LONG_STATUS}, + {"Handler_tmp_write", (char*) offsetof(STATUS_VAR, ha_tmp_write_count), SHOW_LONG_STATUS}, {"Key", (char*) &show_default_keycache, SHOW_FUNC}, {"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, @@ -8280,6 +8282,7 @@ SHOW_VAR status_vars[]= { {"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_FUNC}, {"Rows_sent", (char*) offsetof(STATUS_VAR, rows_sent), SHOW_LONGLONG_STATUS}, {"Rows_read", (char*) offsetof(STATUS_VAR, rows_read), SHOW_LONGLONG_STATUS}, + {"Rows_tmp_read", (char*) offsetof(STATUS_VAR, rows_tmp_read), SHOW_LONGLONG_STATUS}, #ifdef HAVE_QUERY_CACHE {"Qcache_free_blocks", (char*) &query_cache.free_memory_blocks, SHOW_LONG_NOFLUSH}, {"Qcache_free_memory", (char*) &query_cache.free_memory, SHOW_LONG_NOFLUSH}, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index dc987e196f4..3b672d6b704 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1804,7 +1804,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file, free_file)); file->ha_external_lock(current_thd, F_UNLCK); - file->close(); + file->ha_close(); delete file; } } @@ -1999,7 +1999,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) if (init() || reset()) { file->ha_external_lock(thd, F_UNLCK); - file->close(); + file->ha_close(); goto failure; } free_file= TRUE; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 57775146b90..fee407f9e0e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -675,7 +675,7 @@ void close_handle_and_leave_table_as_lock(TABLE *table) */ if (table->child_l || table->parent) detach_merge_children(table, FALSE); - table->file->close(); + table->file->ha_close(); table->db_stat= 0; // Mark file closed release_table_share(table->s, RELEASE_NORMAL); table->s= share; @@ -3708,7 +3708,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name) if (table->db_stat) { table->db_stat= 0; - table->file->close(); + table->file->ha_close(); } } else diff --git a/sql/sql_class.cc b/sql/sql_class.cc index a7a3e15965e..3bd1e591054 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1201,6 +1201,7 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) to_var->bytes_sent+= from_var->bytes_sent; to_var->rows_read+= from_var->rows_read; to_var->rows_sent+= from_var->rows_sent; + to_var->rows_tmp_read+= from_var->rows_tmp_read; to_var->binlog_bytes_written+= from_var->binlog_bytes_written; to_var->cpu_time+= from_var->cpu_time; to_var->busy_time+= from_var->busy_time; @@ -1236,6 +1237,7 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent; to_var->rows_read+= from_var->rows_read - dec_var->rows_read; to_var->rows_sent+= from_var->rows_sent - dec_var->rows_sent; + to_var->rows_tmp_read+= from_var->rows_tmp_read - dec_var->rows_tmp_read; to_var->binlog_bytes_written+= from_var->binlog_bytes_written - dec_var->binlog_bytes_written; to_var->cpu_time+= from_var->cpu_time - dec_var->cpu_time; diff --git a/sql/sql_class.h b/sql/sql_class.h index b02f0daa6fe..6f2852bf431 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -530,6 +530,9 @@ typedef struct system_status_var ulong ha_rollback_count; ulong ha_update_count; ulong ha_write_count; + /* The following are for internal temporary tables */ + ulong ha_tmp_update_count; + ulong ha_tmp_write_count; ulong ha_prepare_count; ulong ha_discover_count; ulong ha_savepoint_count; @@ -582,6 +585,7 @@ typedef struct system_status_var ulonglong bytes_sent; ulonglong rows_read; ulonglong rows_sent; + ulonglong rows_tmp_read; ulonglong binlog_bytes_written; double last_query_cost; double cpu_time, busy_time; @@ -3610,7 +3614,7 @@ inline int handler::ha_index_read_idx_map(uchar * buf, uint index, int error= index_read_idx_map(buf, index, key, keypart_map, find_flag); if (!error) { - rows_read++; + update_rows_read(); index_rows_read[index]++; } table->status=error ? STATUS_NOT_FOUND: 0; @@ -3677,7 +3681,8 @@ inline int handler::ha_ft_read(uchar *buf) { int error= ft_read(buf); if (!error) - rows_read++; + update_rows_read(); + table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -3687,7 +3692,7 @@ inline int handler::ha_rnd_next(uchar *buf) increment_statistics(&SSV::ha_read_rnd_next_count); int error= rnd_next(buf); if (!error) - rows_read++; + update_rows_read(); table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -3697,7 +3702,7 @@ inline int handler::ha_rnd_pos(uchar *buf, uchar *pos) increment_statistics(&SSV::ha_read_rnd_count); int error= rnd_pos(buf, pos); if (!error) - rows_read++; + update_rows_read(); table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -3706,7 +3711,7 @@ inline int handler::ha_rnd_pos_by_record(uchar *buf) { int error= rnd_pos_by_record(buf); if (!error) - rows_read++; + update_rows_read(); table->status=error ? STATUS_NOT_FOUND: 0; return error; } @@ -3715,15 +3720,21 @@ inline int handler::ha_read_first_row(uchar *buf, uint primary_key) { int error= read_first_row(buf, primary_key); if (!error) - rows_read++; + update_rows_read(); table->status=error ? STATUS_NOT_FOUND: 0; return error; } inline int handler::ha_write_tmp_row(uchar *buf) { - increment_statistics(&SSV::ha_write_count); + increment_statistics(&SSV::ha_tmp_write_count); return write_row(buf); } +inline int handler::ha_update_tmp_row(const uchar *old_data, uchar *new_data) +{ + increment_statistics(&SSV::ha_tmp_update_count); + return update_row(old_data, new_data); +} + #endif /* MYSQL_SERVER */ diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 05e33826da9..debae2dd74d 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -690,6 +690,7 @@ static void update_global_user_stats_with_user(THD *thd, user_stats->binlog_bytes_written+= (thd->status_var.binlog_bytes_written - thd->org_status_var.binlog_bytes_written); + /* We are not counting rows in internal temporary tables here ! */ user_stats->rows_read+= (thd->status_var.rows_read - thd->org_status_var.rows_read); user_stats->rows_sent+= (thd->status_var.rows_sent - diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc index c3450884610..d79dca03e42 100644 --- a/sql/sql_expression_cache.cc +++ b/sql/sql_expression_cache.cc @@ -249,7 +249,7 @@ my_bool Expression_cache_tmptable::put_value(Item *value) if (table_thd->is_error()) goto err;; - if ((error= cache_table->file->ha_write_row(cache_table->record[0]))) + if ((error= cache_table->file->ha_write_tmp_row(cache_table->record[0]))) { /* create_myisam_from_heap will generate error if needed */ if (cache_table->file->is_fatal_error(error, HA_CHECK_DUP) && diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c3e1c785b59..5d2e838eda6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -14322,7 +14322,7 @@ create_internal_tmp_table_from_heap2(THD *thd, TABLE *table, /* remove heap table and change to use myisam table */ (void) table->file->ha_rnd_end(); - (void) table->file->close(); // This deletes the table ! + (void) table->file->ha_close(); // This deletes the table ! delete table->file; table->file=0; plugin_unlock(0, table->s->db_plugin); @@ -14343,7 +14343,7 @@ create_internal_tmp_table_from_heap2(THD *thd, TABLE *table, table->file->print_error(write_err, MYF(0)); err_killed: (void) table->file->ha_rnd_end(); - (void) new_table.file->close(); + (void) new_table.file->ha_close(); err1: new_table.file->ha_delete_table(new_table.s->table_name.str); err2: @@ -16183,8 +16183,8 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { /* Update old record */ restore_record(table,record[1]); update_tmptable_sum_func(join->sum_funcs,table); - if ((error= table->file->ha_update_row(table->record[1], - table->record[0]))) + if ((error= table->file->ha_update_tmp_row(table->record[1], + table->record[0]))) { table->file->print_error(error,MYF(0)); /* purecov: inspected */ DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ @@ -16267,8 +16267,8 @@ end_unique_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), } restore_record(table,record[1]); update_tmptable_sum_func(join->sum_funcs,table); - if ((error= table->file->ha_update_row(table->record[1], - table->record[0]))) + if ((error= table->file->ha_update_tmp_row(table->record[1], + table->record[0]))) { table->file->print_error(error,MYF(0)); /* purecov: inspected */ DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 0cf7a9b1dc2..e2949c49608 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2814,7 +2814,7 @@ typedef struct st_lookup_field_values bool schema_table_store_record(THD *thd, TABLE *table) { int error; - if ((error= table->file->ha_write_row(table->record[0]))) + if ((error= table->file->ha_write_tmp_row(table->record[0]))) { TMP_TABLE_PARAM *param= table->pos_in_table_list->schema_table_param; if (create_internal_tmp_table_from_heap(thd, table, param->start_recinfo, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 685b468a868..c6730bc0853 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4681,6 +4681,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, int result_code; bool need_repair_or_alter= 0; DBUG_ENTER("mysql_admin_table"); + DBUG_PRINT("enter", ("extra_open_options: %u", extra_open_options)); if (end_active_trans(thd)) DBUG_RETURN(1); @@ -4705,9 +4706,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, bool fatal_error=0; DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name)); - DBUG_PRINT("admin", ("extra_open_options: %u", extra_open_options)); strxmov(table_name, db, ".", table->table_name, NullS); - thd->open_options|= extra_open_options; table->lock_type= lock_type; /* open only one table from local list of command */ { @@ -4734,12 +4733,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, lex->sql_command == SQLCOM_ANALYZE || lex->sql_command == SQLCOM_OPTIMIZE) thd->prepare_derived_at_open= TRUE; + thd->open_options|= extra_open_options; open_and_lock_tables(thd, table); + thd->open_options&= ~extra_open_options; thd->prepare_derived_at_open= FALSE; thd->no_warnings_for_error= 0; table->next_global= save_next_global; table->next_local= save_next_local; - thd->open_options&= ~extra_open_options; #ifdef WITH_PARTITION_STORAGE_ENGINE if (table->table) { @@ -4923,7 +4923,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, /* We use extra_open_options to be able to open crashed tables */ thd->open_options|= extra_open_options; result_code= admin_recreate_table(thd, table); - thd->open_options= ~extra_open_options; + thd->open_options&= ~extra_open_options; goto send_result; } if (check_old_types || check_for_upgrade) diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 50505dd94a9..d0ec95efc27 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -60,7 +60,7 @@ int select_union::send_data(List<Item> &values) if (thd->is_error()) return 1; - if ((write_err= table->file->ha_write_row(table->record[0]))) + if ((write_err= table->file->ha_write_tmp_row(table->record[0]))) { if (write_err == HA_ERR_FOUND_DUPP_KEY) { diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 4821fc2bd8f..bd088857ff7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1868,7 +1868,7 @@ int multi_update::send_data(List<Item> ¬_used_values) *values_for_table[offset], TRUE, FALSE); /* Write row, ignoring duplicated updates to a row */ - error= tmp_table->file->ha_write_row(tmp_table->record[0]); + error= tmp_table->file->ha_write_tmp_row(tmp_table->record[0]); if (error != HA_ERR_FOUND_DUPP_KEY && error != HA_ERR_FOUND_DUPP_UNIQUE) { if (error && diff --git a/sql/table.cc b/sql/table.cc index 2d2311d8987..bf8e0e46661 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2460,7 +2460,7 @@ int closefrm(register TABLE *table, bool free_share) { if (table->s->deleting) table->file->extra(HA_EXTRA_PREPARE_FOR_DROP); - error=table->file->close(); + error=table->file->ha_close(); } table->alias.free(); if (table->expr_arena) |