1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

A pre-requisite for the fix for Bug#12713 "Error in a stored function

called from a SELECT doesn't cause ROLLBACK of state"
Make private all class handler methods (PSEA API) that may modify
data. Introduce and deploy public ha_* wrappers for these methods in 
all sql/.
This necessary to keep track of all data modifications in sql/,
which is in turn necessary to be able to optimize two-phase
commit of those transactions that do not modify data.


sql/ha_partition.cc:
  Class ha_partition is no longer a friend of class handler.
  Use the public handler interface (handler::ha_ methods) for partition
  operations.
  Remove unnecessary casts from char[] to const char *.ppзи выафвыаafa
sql/handler.cc:
  Function ha_create_table() is no longer a friend of class handler.
  Use public handler::change_table_ptr() to access private members.
  This fixes a subtle bug (no test case in the test suite) when a
  deletion error occurs inside one partition of a partitioned engine. 
  The old code would crash in handler::print_error() in this case.
  
  Implement the newly introduced public ha_* wrappers of the private
  virtual handler methods.
sql/handler.h:
  Introduce ha_* wrappers to all class handler methods that may
  modify data. This is necessary to be able to keep track of
  data modifying operations of class handler and optimize read-only
  transactions.
sql/item_sum.cc:
  delete_all_rows -> ha_delete_all_rows
sql/sql_base.cc:
  Use the new public wrappers.
sql/sql_delete.cc:
  delete_all_rows -> ha_delete_all_rows
sql/sql_partition.cc:
  Use the new public wrappers.
sql/sql_select.cc:
  delete_all_rows -> ha_delete_all_rows
  delete_table -> ha_delete_table
  disabe_indexes -> ha_disable_idnexes
sql/sql_show.cc:
  delete_all_rows -> ha_delete_all_rows
sql/sql_table.cc:
  Use the public wrappers for class handler DDL methods.
  All methods which may change handler data are now accessed via a public
  wrapper.
sql/sql_union.cc:
  delete_all_rows -> ha_delete_all_rows
  {enable,disable}_indexes -> ha_{enable,disable}_indexes
sql/sql_update.cc:
  bulk_update_row -> ha_bulk_update_row
sql/unireg.cc:
  create_handler_files -> ha_create_handler_files
This commit is contained in:
unknown
2007-12-20 21:16:55 +03:00
parent 5473858b64
commit 0fbc29c197
13 changed files with 548 additions and 184 deletions

View File

@ -5108,9 +5108,9 @@ static bool mysql_change_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_ENTER("mysql_change_partitions");
build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "", 0);
if ((error= file->change_partitions(lpt->create_info, path, &lpt->copied,
&lpt->deleted, lpt->pack_frm_data,
lpt->pack_frm_len)))
if ((error= file->ha_change_partitions(lpt->create_info, path, &lpt->copied,
&lpt->deleted, lpt->pack_frm_data,
lpt->pack_frm_len)))
{
if (error != ER_OUTOFMEMORY)
file->print_error(error, MYF(0));
@ -5148,7 +5148,7 @@ static bool mysql_rename_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_ENTER("mysql_rename_partitions");
build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "", 0);
if ((error= lpt->table->file->rename_partitions(path)))
if ((error= lpt->table->file->ha_rename_partitions(path)))
{
if (error != 1)
lpt->table->file->print_error(error, MYF(0));
@ -5189,7 +5189,7 @@ static bool mysql_drop_partitions(ALTER_PARTITION_PARAM_TYPE *lpt)
DBUG_ENTER("mysql_drop_partitions");
build_table_filename(path, sizeof(path), lpt->db, lpt->table_name, "", 0);
if ((error= lpt->table->file->drop_partitions(path)))
if ((error= lpt->table->file->ha_drop_partitions(path)))
{
lpt->table->file->print_error(error, MYF(0));
DBUG_RETURN(TRUE);
@ -6105,13 +6105,13 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
int error;
written_bin_log= FALSE;
if (((alter_info->flags & ALTER_OPTIMIZE_PARTITION) &&
(error= table->file->optimize_partitions(thd))) ||
(error= table->file->ha_optimize_partitions(thd))) ||
((alter_info->flags & ALTER_ANALYZE_PARTITION) &&
(error= table->file->analyze_partitions(thd))) ||
(error= table->file->ha_analyze_partitions(thd))) ||
((alter_info->flags & ALTER_CHECK_PARTITION) &&
(error= table->file->check_partitions(thd))) ||
(error= table->file->ha_check_partitions(thd))) ||
((alter_info->flags & ALTER_REPAIR_PARTITION) &&
(error= table->file->repair_partitions(thd))))
(error= table->file->ha_repair_partitions(thd))))
{
table->file->print_error(error, MYF(0));
goto err;