mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01: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.
This commit is contained in:
parent
ab6ef39cd1
commit
dfe685e6fc
13 changed files with 548 additions and 184 deletions
|
@ -367,7 +367,7 @@ bool ha_partition::initialise_partition(MEM_ROOT *mem_root)
|
|||
HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, HA_DUPLICATE_POS,
|
||||
HA_CAN_INSERT_DELAYED is disabled until further investigated.
|
||||
*/
|
||||
m_table_flags= (ulong)m_file[0]->table_flags();
|
||||
m_table_flags= (ulong)m_file[0]->ha_table_flags();
|
||||
m_low_byte_first= m_file[0]->low_byte_first();
|
||||
m_pkey_is_clustered= TRUE;
|
||||
file_array= m_file;
|
||||
|
@ -382,7 +382,7 @@ bool ha_partition::initialise_partition(MEM_ROOT *mem_root)
|
|||
}
|
||||
if (!file->primary_key_is_clustered())
|
||||
m_pkey_is_clustered= FALSE;
|
||||
m_table_flags&= file->table_flags();
|
||||
m_table_flags&= file->ha_table_flags();
|
||||
} while (*(++file_array));
|
||||
m_table_flags&= ~(HA_CAN_GEOMETRY | HA_CAN_FULLTEXT | HA_DUPLICATE_POS |
|
||||
HA_CAN_SQL_HANDLER | HA_CAN_INSERT_DELAYED |
|
||||
|
@ -616,7 +616,7 @@ int ha_partition::drop_partitions(const char *path)
|
|||
sub_elem->partition_name, name_variant);
|
||||
file= m_file[part];
|
||||
DBUG_PRINT("info", ("Drop subpartition %s", part_name_buff));
|
||||
if ((ret_error= file->delete_table((const char *) part_name_buff)))
|
||||
if ((ret_error= file->ha_delete_table(part_name_buff)))
|
||||
error= ret_error;
|
||||
if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -629,7 +629,7 @@ int ha_partition::drop_partitions(const char *path)
|
|||
TRUE);
|
||||
file= m_file[i];
|
||||
DBUG_PRINT("info", ("Drop partition %s", part_name_buff));
|
||||
if ((ret_error= file->delete_table((const char *) part_name_buff)))
|
||||
if ((ret_error= file->ha_delete_table(part_name_buff)))
|
||||
error= ret_error;
|
||||
if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -707,7 +707,7 @@ int ha_partition::rename_partitions(const char *path)
|
|||
sub_elem->partition_name,
|
||||
NORMAL_PART_NAME);
|
||||
DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff));
|
||||
if ((ret_error= file->delete_table((const char *) norm_name_buff)))
|
||||
if ((ret_error= file->ha_delete_table(norm_name_buff)))
|
||||
error= ret_error;
|
||||
else if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -722,7 +722,7 @@ int ha_partition::rename_partitions(const char *path)
|
|||
part_elem->partition_name, NORMAL_PART_NAME,
|
||||
TRUE);
|
||||
DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
|
||||
if ((ret_error= file->delete_table((const char *) norm_name_buff)))
|
||||
if ((ret_error= file->ha_delete_table(norm_name_buff)))
|
||||
error= ret_error;
|
||||
else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -778,7 +778,7 @@ int ha_partition::rename_partitions(const char *path)
|
|||
{
|
||||
file= m_reorged_file[part_count++];
|
||||
DBUG_PRINT("info", ("Delete subpartition %s", norm_name_buff));
|
||||
if ((ret_error= file->delete_table((const char *) norm_name_buff)))
|
||||
if ((ret_error= file->ha_delete_table(norm_name_buff)))
|
||||
error= ret_error;
|
||||
else if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -791,8 +791,8 @@ int ha_partition::rename_partitions(const char *path)
|
|||
TEMP_PART_NAME);
|
||||
DBUG_PRINT("info", ("Rename subpartition from %s to %s",
|
||||
part_name_buff, norm_name_buff));
|
||||
if ((ret_error= file->rename_table((const char *) part_name_buff,
|
||||
(const char *) norm_name_buff)))
|
||||
if ((ret_error= file->ha_rename_table(part_name_buff,
|
||||
norm_name_buff)))
|
||||
error= ret_error;
|
||||
else if (deactivate_ddl_log_entry(sub_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -809,7 +809,7 @@ int ha_partition::rename_partitions(const char *path)
|
|||
{
|
||||
file= m_reorged_file[part_count++];
|
||||
DBUG_PRINT("info", ("Delete partition %s", norm_name_buff));
|
||||
if ((ret_error= file->delete_table((const char *) norm_name_buff)))
|
||||
if ((ret_error= file->ha_delete_table(norm_name_buff)))
|
||||
error= ret_error;
|
||||
else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -821,8 +821,8 @@ int ha_partition::rename_partitions(const char *path)
|
|||
TRUE);
|
||||
DBUG_PRINT("info", ("Rename partition from %s to %s",
|
||||
part_name_buff, norm_name_buff));
|
||||
if ((ret_error= file->rename_table((const char *) part_name_buff,
|
||||
(const char *) norm_name_buff)))
|
||||
if ((ret_error= file->ha_rename_table(part_name_buff,
|
||||
norm_name_buff)))
|
||||
error= ret_error;
|
||||
else if (deactivate_ddl_log_entry(part_elem->log_entry->entry_pos))
|
||||
error= 1;
|
||||
|
@ -1036,9 +1036,9 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
|
|||
DBUG_PRINT("enter", ("flag = %u", flag));
|
||||
|
||||
if (flag == OPTIMIZE_PARTS)
|
||||
error= file->optimize(thd, check_opt);
|
||||
error= file->ha_optimize(thd, check_opt);
|
||||
else if (flag == ANALYZE_PARTS)
|
||||
error= file->analyze(thd, check_opt);
|
||||
error= file->ha_analyze(thd, check_opt);
|
||||
else if (flag == CHECK_PARTS)
|
||||
error= file->ha_check(thd, check_opt);
|
||||
else if (flag == REPAIR_PARTS)
|
||||
|
@ -1139,7 +1139,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
|
|||
if ((error= set_up_table_before_create(tbl, part_name, create_info,
|
||||
0, p_elem)))
|
||||
goto error;
|
||||
if ((error= file->create(part_name, tbl, create_info)))
|
||||
if ((error= file->ha_create(part_name, tbl, create_info)))
|
||||
goto error;
|
||||
create_flag= TRUE;
|
||||
if ((error= file->ha_open(tbl, part_name, m_mode, m_open_test_lock)))
|
||||
|
@ -1150,13 +1150,13 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
|
|||
assumes that external_lock() is last call that may fail here.
|
||||
Otherwise see description for cleanup_new_partition().
|
||||
*/
|
||||
if ((error= file->external_lock(current_thd, m_lock_type)))
|
||||
if ((error= file->ha_external_lock(current_thd, m_lock_type)))
|
||||
goto error;
|
||||
|
||||
DBUG_RETURN(0);
|
||||
error:
|
||||
if (create_flag)
|
||||
VOID(file->delete_table(part_name));
|
||||
VOID(file->ha_delete_table(part_name));
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
@ -1585,7 +1585,7 @@ int ha_partition::copy_partitions(ulonglong *copied, ulonglong *deleted)
|
|||
}
|
||||
}
|
||||
late_extra_no_cache(reorg_part);
|
||||
file->rnd_end();
|
||||
file->ha_rnd_end();
|
||||
reorg_part++;
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
|
@ -1702,16 +1702,15 @@ uint ha_partition::del_ren_cre_table(const char *from,
|
|||
{ // Rename branch
|
||||
create_partition_name(to_buff, to, name_buffer_ptr, NORMAL_PART_NAME,
|
||||
FALSE);
|
||||
error= (*file)->rename_table((const char*) from_buff,
|
||||
(const char*) to_buff);
|
||||
error= (*file)->ha_rename_table(from_buff, to_buff);
|
||||
}
|
||||
else if (table_arg == NULL) // delete branch
|
||||
error= (*file)->delete_table((const char*) from_buff);
|
||||
error= (*file)->ha_delete_table(from_buff);
|
||||
else
|
||||
{
|
||||
if ((error= set_up_table_before_create(table_arg, from_buff,
|
||||
create_info, i, NULL)) ||
|
||||
((error= (*file)->create(from_buff, table_arg, create_info))))
|
||||
((error= (*file)->ha_create(from_buff, table_arg, create_info))))
|
||||
goto create_error;
|
||||
}
|
||||
name_buffer_ptr= strend(name_buffer_ptr) + 1;
|
||||
|
@ -1726,7 +1725,7 @@ create_error:
|
|||
{
|
||||
create_partition_name(from_buff, from, name_buffer_ptr, NORMAL_PART_NAME,
|
||||
FALSE);
|
||||
VOID((*file)->delete_table((const char*) from_buff));
|
||||
VOID((*file)->ha_delete_table((const char*) from_buff));
|
||||
name_buffer_ptr= strend(name_buffer_ptr) + 1;
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
|
@ -2318,7 +2317,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
|||
}
|
||||
|
||||
/* Recalculate table flags as they may change after open */
|
||||
m_table_flags= m_file[0]->table_flags();
|
||||
m_table_flags= m_file[0]->ha_table_flags();
|
||||
file= m_file;
|
||||
do
|
||||
{
|
||||
|
@ -2330,7 +2329,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
|||
m_no_locks+= (*file)->lock_count();
|
||||
name_buffer_ptr+= strlen(name_buffer_ptr) + 1;
|
||||
set_if_bigger(ref_length, ((*file)->ref_length));
|
||||
m_table_flags&= (*file)->table_flags();
|
||||
m_table_flags&= (*file)->ha_table_flags();
|
||||
} while (*(++file));
|
||||
m_table_flags&= ~(HA_CAN_GEOMETRY | HA_CAN_FULLTEXT | HA_DUPLICATE_POS |
|
||||
HA_CAN_SQL_HANDLER | HA_CAN_INSERT_DELAYED);
|
||||
|
@ -2486,7 +2485,7 @@ repeat:
|
|||
{
|
||||
DBUG_PRINT("info", ("external_lock(thd, %d) iteration %d",
|
||||
lock_type, (int) (file - m_file)));
|
||||
if ((error= (*file)->external_lock(thd, lock_type)))
|
||||
if ((error= (*file)->ha_external_lock(thd, lock_type)))
|
||||
{
|
||||
if (F_UNLCK != lock_type)
|
||||
goto err_handler;
|
||||
|
@ -2505,7 +2504,7 @@ repeat:
|
|||
err_handler:
|
||||
while (file-- != m_file)
|
||||
{
|
||||
(*file)->external_lock(thd, F_UNLCK);
|
||||
(*file)->ha_external_lock(thd, F_UNLCK);
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
@ -2913,6 +2912,7 @@ int ha_partition::delete_row(const uchar *buf)
|
|||
{
|
||||
uint32 part_id;
|
||||
int error;
|
||||
THD *thd= ha_thd();
|
||||
DBUG_ENTER("ha_partition::delete_row");
|
||||
|
||||
if ((error= get_part_for_delete(buf, m_rec0, m_part_info, &part_id)))
|
||||
|
@ -2920,7 +2920,10 @@ int ha_partition::delete_row(const uchar *buf)
|
|||
DBUG_RETURN(error);
|
||||
}
|
||||
m_last_part= part_id;
|
||||
DBUG_RETURN(m_file[part_id]->delete_row(buf));
|
||||
tmp_disable_binlog(thd);
|
||||
error= m_file[part_id]->ha_delete_row(buf);
|
||||
reenable_binlog(thd);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2955,7 +2958,7 @@ int ha_partition::delete_all_rows()
|
|||
file= m_file;
|
||||
do
|
||||
{
|
||||
if ((error= (*file)->delete_all_rows()))
|
||||
if ((error= (*file)->ha_delete_all_rows()))
|
||||
DBUG_RETURN(error);
|
||||
} while (*(++file));
|
||||
DBUG_RETURN(0);
|
||||
|
@ -4016,7 +4019,7 @@ int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same)
|
|||
}
|
||||
else if (!(error= file->index_next(buf)))
|
||||
{
|
||||
if (!(file->table_flags() & HA_READ_ORDER) ||
|
||||
if (!(file->ha_table_flags() & HA_READ_ORDER) ||
|
||||
compare_key(end_range) <= 0)
|
||||
{
|
||||
m_last_part= m_part_spec.start_part;
|
||||
|
@ -4094,7 +4097,7 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
|
|||
}
|
||||
if (!error)
|
||||
{
|
||||
if (!(file->table_flags() & HA_READ_ORDER) ||
|
||||
if (!(file->ha_table_flags() & HA_READ_ORDER) ||
|
||||
compare_key(end_range) <= 0)
|
||||
{
|
||||
m_last_part= i;
|
||||
|
@ -5016,7 +5019,7 @@ int ha_partition::reset(void)
|
|||
file= m_file;
|
||||
do
|
||||
{
|
||||
if ((tmp= (*file)->reset()))
|
||||
if ((tmp= (*file)->ha_reset()))
|
||||
result= tmp;
|
||||
} while (*(++file));
|
||||
DBUG_RETURN(result);
|
||||
|
@ -5658,7 +5661,7 @@ void ha_partition::release_auto_increment()
|
|||
|
||||
for (uint i= 0; i < m_tot_parts; i++)
|
||||
{
|
||||
m_file[i]->release_auto_increment();
|
||||
m_file[i]->ha_release_auto_increment();
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -5694,7 +5697,7 @@ int ha_partition::disable_indexes(uint mode)
|
|||
|
||||
for (file= m_file; *file; file++)
|
||||
{
|
||||
if ((error= (*file)->disable_indexes(mode)))
|
||||
if ((error= (*file)->ha_disable_indexes(mode)))
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
@ -5718,7 +5721,7 @@ int ha_partition::enable_indexes(uint mode)
|
|||
|
||||
for (file= m_file; *file; file++)
|
||||
{
|
||||
if ((error= (*file)->enable_indexes(mode)))
|
||||
if ((error= (*file)->ha_enable_indexes(mode)))
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
337
sql/handler.cc
337
sql/handler.cc
|
@ -1468,7 +1468,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
|
|||
DBUG_RETURN(ENOENT);
|
||||
|
||||
path= check_lowercase_names(file, path, tmp_path);
|
||||
if ((error= file->delete_table(path)) && generate_warning)
|
||||
if ((error= file->ha_delete_table(path)) && generate_warning)
|
||||
{
|
||||
/*
|
||||
Because file->print_error() use my_error() to generate the error message
|
||||
|
@ -1487,8 +1487,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
|
|||
dummy_share.table_name.length= strlen(alias);
|
||||
dummy_table.alias= alias;
|
||||
|
||||
file->table_share= &dummy_share;
|
||||
file->table= &dummy_table;
|
||||
file->change_table_ptr(&dummy_table, &dummy_share);
|
||||
|
||||
thd->push_internal_handler(&ha_delete_table_error_handler);
|
||||
file->print_error(error, 0);
|
||||
|
@ -2502,6 +2501,12 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Repair table: public interface.
|
||||
|
||||
@sa handler::repair()
|
||||
*/
|
||||
|
||||
int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
int result;
|
||||
|
@ -2511,6 +2516,328 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Bulk update row: public interface.
|
||||
|
||||
@sa handler::bulk_update_row()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_bulk_update_row(const uchar *old_data, uchar *new_data,
|
||||
uint *dup_key_found)
|
||||
{
|
||||
return bulk_update_row(old_data, new_data, dup_key_found);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Delete all rows: public interface.
|
||||
|
||||
@sa handler::delete_all_rows()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_delete_all_rows()
|
||||
{
|
||||
return delete_all_rows();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset auto increment: public interface.
|
||||
|
||||
@sa handler::reset_auto_increment()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_reset_auto_increment(ulonglong value)
|
||||
{
|
||||
return reset_auto_increment(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Backup table: public interface.
|
||||
|
||||
@sa handler::backup()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_backup(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
return backup(thd, check_opt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Restore table: public interface.
|
||||
|
||||
@sa handler::restore()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_restore(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
return restore(thd, check_opt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Optimize table: public interface.
|
||||
|
||||
@sa handler::optimize()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_optimize(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
return optimize(thd, check_opt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Analyze table: public interface.
|
||||
|
||||
@sa handler::analyze()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_analyze(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{
|
||||
return analyze(thd, check_opt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check and repair table: public interface.
|
||||
|
||||
@sa handler::check_and_repair()
|
||||
*/
|
||||
|
||||
bool
|
||||
handler::ha_check_and_repair(THD *thd)
|
||||
{
|
||||
return check_and_repair(thd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Disable indexes: public interface.
|
||||
|
||||
@sa handler::disable_indexes()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_disable_indexes(uint mode)
|
||||
{
|
||||
return disable_indexes(mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Enable indexes: public interface.
|
||||
|
||||
@sa handler::enable_indexes()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_enable_indexes(uint mode)
|
||||
{
|
||||
return enable_indexes(mode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Discard or import tablespace: public interface.
|
||||
|
||||
@sa handler::discard_or_import_tablespace()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_discard_or_import_tablespace(my_bool discard)
|
||||
{
|
||||
return discard_or_import_tablespace(discard);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Prepare for alter: public interface.
|
||||
|
||||
Called to prepare an *online* ALTER.
|
||||
|
||||
@sa handler::prepare_for_alter()
|
||||
*/
|
||||
|
||||
void
|
||||
handler::ha_prepare_for_alter()
|
||||
{
|
||||
prepare_for_alter();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Rename table: public interface.
|
||||
|
||||
@sa handler::rename_table()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_rename_table(const char *from, const char *to)
|
||||
{
|
||||
return rename_table(from, to);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Delete table: public interface.
|
||||
|
||||
@sa handler::delete_table()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_delete_table(const char *name)
|
||||
{
|
||||
return delete_table(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Drop table in the engine: public interface.
|
||||
|
||||
@sa handler::drop_table()
|
||||
*/
|
||||
|
||||
void
|
||||
handler::ha_drop_table(const char *name)
|
||||
{
|
||||
return drop_table(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create a table in the engine: public interface.
|
||||
|
||||
@sa handler::create()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info)
|
||||
{
|
||||
return create(name, form, info);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create handler files for CREATE TABLE: public interface.
|
||||
|
||||
@sa handler::create_handler_files()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_create_handler_files(const char *name, const char *old_name,
|
||||
int action_flag, HA_CREATE_INFO *info)
|
||||
{
|
||||
return create_handler_files(name, old_name, action_flag, info);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Change partitions: public interface.
|
||||
|
||||
@sa handler::change_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_change_partitions(HA_CREATE_INFO *create_info,
|
||||
const char *path,
|
||||
ulonglong *copied,
|
||||
ulonglong *deleted,
|
||||
const uchar *pack_frm_data,
|
||||
size_t pack_frm_len)
|
||||
{
|
||||
return change_partitions(create_info, path, copied, deleted,
|
||||
pack_frm_data, pack_frm_len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Drop partitions: public interface.
|
||||
|
||||
@sa handler::drop_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_drop_partitions(const char *path)
|
||||
{
|
||||
return drop_partitions(path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Rename partitions: public interface.
|
||||
|
||||
@sa handler::rename_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_rename_partitions(const char *path)
|
||||
{
|
||||
return rename_partitions(path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Optimize partitions: public interface.
|
||||
|
||||
@sa handler::optimize_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_optimize_partitions(THD *thd)
|
||||
{
|
||||
return optimize_partitions(thd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Analyze partitions: public interface.
|
||||
|
||||
@sa handler::analyze_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_analyze_partitions(THD *thd)
|
||||
{
|
||||
return analyze_partitions(thd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check partitions: public interface.
|
||||
|
||||
@sa handler::check_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_check_partitions(THD *thd)
|
||||
{
|
||||
return check_partitions(thd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Repair partitions: public interface.
|
||||
|
||||
@sa handler::repair_partitions()
|
||||
*/
|
||||
|
||||
int
|
||||
handler::ha_repair_partitions(THD *thd)
|
||||
{
|
||||
return repair_partitions(thd);
|
||||
}
|
||||
|
||||
|
||||
/** @brief
|
||||
Tell the storage engine that it is allowed to "disable transaction" in the
|
||||
handler. It is a hint that ACID is not required - it is used in NDB for
|
||||
|
@ -2654,7 +2981,7 @@ int ha_create_table(THD *thd, const char *path,
|
|||
|
||||
name= check_lowercase_names(table.file, share.path.str, name_buff);
|
||||
|
||||
error= table.file->create(name, &table, create_info);
|
||||
error= table.file->ha_create(name, &table, create_info);
|
||||
VOID(closefrm(&table, 0));
|
||||
if (error)
|
||||
{
|
||||
|
@ -2724,7 +3051,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
|
|||
create_info.table_options|= HA_OPTION_CREATE_FROM_ENGINE;
|
||||
|
||||
check_lowercase_names(table.file, path, path);
|
||||
error=table.file->create(path,&table,&create_info);
|
||||
error=table.file->ha_create(path, &table, &create_info);
|
||||
VOID(closefrm(&table, 1));
|
||||
|
||||
DBUG_RETURN(error != 0);
|
||||
|
|
212
sql/handler.h
212
sql/handler.h
|
@ -967,10 +967,6 @@ uint calculate_key_len(TABLE *, uint, const uchar *, key_part_map);
|
|||
|
||||
class handler :public Sql_alloc
|
||||
{
|
||||
friend class ha_partition;
|
||||
friend int ha_delete_table(THD*,handlerton*,const char*,const char*,
|
||||
const char*,bool);
|
||||
|
||||
public:
|
||||
typedef ulonglong Table_flags;
|
||||
protected:
|
||||
|
@ -1118,6 +1114,40 @@ public:
|
|||
estimation_rows_to_insert= 0;
|
||||
return end_bulk_insert();
|
||||
}
|
||||
int ha_bulk_update_row(const uchar *old_data, uchar *new_data,
|
||||
uint *dup_key_found);
|
||||
int ha_delete_all_rows();
|
||||
int ha_reset_auto_increment(ulonglong value);
|
||||
int ha_backup(THD* thd, HA_CHECK_OPT* check_opt);
|
||||
int ha_restore(THD* thd, HA_CHECK_OPT* check_opt);
|
||||
int ha_optimize(THD* thd, HA_CHECK_OPT* check_opt);
|
||||
int ha_analyze(THD* thd, HA_CHECK_OPT* check_opt);
|
||||
bool ha_check_and_repair(THD *thd);
|
||||
int ha_disable_indexes(uint mode);
|
||||
int ha_enable_indexes(uint mode);
|
||||
int ha_discard_or_import_tablespace(my_bool discard);
|
||||
void ha_prepare_for_alter();
|
||||
int ha_rename_table(const char *from, const char *to);
|
||||
int ha_delete_table(const char *name);
|
||||
void ha_drop_table(const char *name);
|
||||
|
||||
int ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info);
|
||||
|
||||
int ha_create_handler_files(const char *name, const char *old_name,
|
||||
int action_flag, HA_CREATE_INFO *info);
|
||||
|
||||
int ha_change_partitions(HA_CREATE_INFO *create_info,
|
||||
const char *path,
|
||||
ulonglong *copied,
|
||||
ulonglong *deleted,
|
||||
const uchar *pack_frm_data,
|
||||
size_t pack_frm_len);
|
||||
int ha_drop_partitions(const char *path);
|
||||
int ha_rename_partitions(const char *path);
|
||||
int ha_optimize_partitions(THD *thd);
|
||||
int ha_analyze_partitions(THD *thd);
|
||||
int ha_check_partitions(THD *thd);
|
||||
int ha_repair_partitions(THD *thd);
|
||||
|
||||
void adjust_next_insert_id_after_explicit_value(ulonglong nr);
|
||||
int update_auto_increment();
|
||||
|
@ -1203,25 +1233,6 @@ public:
|
|||
@retval 1 Bulk delete not used, normal operation used
|
||||
*/
|
||||
virtual bool start_bulk_delete() { return 1; }
|
||||
/**
|
||||
This method is similar to update_row, however the handler doesn't need
|
||||
to execute the updates at this point in time. The handler can be certain
|
||||
that another call to bulk_update_row will occur OR a call to
|
||||
exec_bulk_update before the set of updates in this query is concluded.
|
||||
|
||||
@param old_data Old record
|
||||
@param new_data New record
|
||||
@param dup_key_found Number of duplicate keys found
|
||||
|
||||
@retval 0 Bulk delete used by handler
|
||||
@retval 1 Bulk delete not used, normal operation used
|
||||
*/
|
||||
virtual int bulk_update_row(const uchar *old_data, uchar *new_data,
|
||||
uint *dup_key_found)
|
||||
{
|
||||
DBUG_ASSERT(FALSE);
|
||||
return HA_ERR_WRONG_COMMAND;
|
||||
}
|
||||
/**
|
||||
After this call all outstanding updates must be performed. The number
|
||||
of duplicate key errors are reported in the duplicate key parameter.
|
||||
|
@ -1365,14 +1376,6 @@ public:
|
|||
virtual void try_semi_consistent_read(bool) {}
|
||||
virtual void unlock_row() {}
|
||||
virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
|
||||
/**
|
||||
This is called to delete all rows in a table
|
||||
If the handler don't support this, then this function will
|
||||
return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
|
||||
by one.
|
||||
*/
|
||||
virtual int delete_all_rows()
|
||||
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
|
||||
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
|
||||
ulonglong nb_desired_values,
|
||||
ulonglong *first_value,
|
||||
|
@ -1397,42 +1400,17 @@ public:
|
|||
next_insert_id= (prev_insert_id > 0) ? prev_insert_id :
|
||||
insert_id_for_cur_row;
|
||||
}
|
||||
/**
|
||||
Reset the auto-increment counter to the given value, i.e. the next row
|
||||
inserted will get the given value. This is called e.g. after TRUNCATE
|
||||
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
|
||||
returned by storage engines that don't support this operation.
|
||||
*/
|
||||
virtual int reset_auto_increment(ulonglong value)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
|
||||
virtual void update_create_info(HA_CREATE_INFO *create_info) {}
|
||||
int check_old_types();
|
||||
virtual int backup(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
/**
|
||||
Restore assumes .frm file must exist, and that generate_table() has been
|
||||
called; It will just copy the data file and run repair.
|
||||
*/
|
||||
virtual int restore(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual int optimize(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual int preload_keys(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
/* end of the list of admin commands */
|
||||
|
||||
virtual bool check_and_repair(THD *thd) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int dump(THD* thd, int fd = -1) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int indexes_are_disabled(void) {return 0;}
|
||||
virtual int discard_or_import_tablespace(my_bool discard)
|
||||
{return HA_ERR_WRONG_COMMAND;}
|
||||
virtual int net_read_dump(NET* net) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual char *update_table_comment(const char * comment)
|
||||
{ return (char*) comment;}
|
||||
|
@ -1489,7 +1467,6 @@ public:
|
|||
|
||||
virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
|
||||
|
||||
virtual void prepare_for_alter() { return; }
|
||||
virtual int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys)
|
||||
{ return (HA_ERR_WRONG_COMMAND); }
|
||||
virtual int prepare_drop_index(TABLE *table_arg, uint *key_num,
|
||||
|
@ -1521,44 +1498,12 @@ public:
|
|||
virtual bool is_crashed() const { return 0; }
|
||||
virtual bool auto_repair() const { return 0; }
|
||||
|
||||
/**
|
||||
default rename_table() and delete_table() rename/delete files with a
|
||||
given name and extensions from bas_ext()
|
||||
*/
|
||||
virtual int rename_table(const char *from, const char *to);
|
||||
virtual int delete_table(const char *name);
|
||||
virtual void drop_table(const char *name);
|
||||
|
||||
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
|
||||
|
||||
#define CHF_CREATE_FLAG 0
|
||||
#define CHF_DELETE_FLAG 1
|
||||
#define CHF_RENAME_FLAG 2
|
||||
#define CHF_INDEX_FLAG 3
|
||||
|
||||
virtual int create_handler_files(const char *name, const char *old_name,
|
||||
int action_flag, HA_CREATE_INFO *info)
|
||||
{ return FALSE; }
|
||||
|
||||
virtual int change_partitions(HA_CREATE_INFO *create_info,
|
||||
const char *path,
|
||||
ulonglong *copied,
|
||||
ulonglong *deleted,
|
||||
const uchar *pack_frm_data,
|
||||
size_t pack_frm_len)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int drop_partitions(const char *path)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int rename_partitions(const char *path)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int optimize_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int analyze_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int check_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int repair_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
|
||||
/**
|
||||
@note lock_count() can return > 1 if the table is MERGE or partitioned.
|
||||
|
@ -1686,6 +1631,16 @@ protected:
|
|||
void ha_statistic_increment(ulong SSV::*offset) const;
|
||||
void **ha_data(THD *) const;
|
||||
THD *ha_thd(void) const;
|
||||
|
||||
/**
|
||||
Default rename_table() and delete_table() rename/delete files with a
|
||||
given name and extensions from bas_ext().
|
||||
|
||||
These methods can be overridden, but their default implementation
|
||||
provide useful functionality.
|
||||
*/
|
||||
virtual int rename_table(const char *from, const char *to);
|
||||
virtual int delete_table(const char *name);
|
||||
private:
|
||||
/*
|
||||
Low-level primitives for storage engines. These should be
|
||||
|
@ -1775,6 +1730,85 @@ private:
|
|||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int index_read_last(uchar * buf, const uchar * key, uint key_len)
|
||||
{ return (my_errno= HA_ERR_WRONG_COMMAND); }
|
||||
/**
|
||||
This method is similar to update_row, however the handler doesn't need
|
||||
to execute the updates at this point in time. The handler can be certain
|
||||
that another call to bulk_update_row will occur OR a call to
|
||||
exec_bulk_update before the set of updates in this query is concluded.
|
||||
|
||||
@param old_data Old record
|
||||
@param new_data New record
|
||||
@param dup_key_found Number of duplicate keys found
|
||||
|
||||
@retval 0 Bulk delete used by handler
|
||||
@retval 1 Bulk delete not used, normal operation used
|
||||
*/
|
||||
virtual int bulk_update_row(const uchar *old_data, uchar *new_data,
|
||||
uint *dup_key_found)
|
||||
{
|
||||
DBUG_ASSERT(FALSE);
|
||||
return HA_ERR_WRONG_COMMAND;
|
||||
}
|
||||
/**
|
||||
This is called to delete all rows in a table
|
||||
If the handler don't support this, then this function will
|
||||
return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
|
||||
by one.
|
||||
*/
|
||||
virtual int delete_all_rows()
|
||||
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
|
||||
/**
|
||||
Reset the auto-increment counter to the given value, i.e. the next row
|
||||
inserted will get the given value. This is called e.g. after TRUNCATE
|
||||
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
|
||||
returned by storage engines that don't support this operation.
|
||||
*/
|
||||
virtual int reset_auto_increment(ulonglong value)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int backup(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
/**
|
||||
Restore assumes .frm file must exist, and that generate_table() has been
|
||||
called; It will just copy the data file and run repair.
|
||||
*/
|
||||
virtual int restore(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual int optimize(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual int analyze(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
{ return HA_ADMIN_NOT_IMPLEMENTED; }
|
||||
virtual bool check_and_repair(THD *thd) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int disable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int enable_indexes(uint mode) { return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int discard_or_import_tablespace(my_bool discard)
|
||||
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
|
||||
virtual void prepare_for_alter() { return; }
|
||||
virtual void drop_table(const char *name);
|
||||
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
|
||||
|
||||
virtual int create_handler_files(const char *name, const char *old_name,
|
||||
int action_flag, HA_CREATE_INFO *info)
|
||||
{ return FALSE; }
|
||||
|
||||
virtual int change_partitions(HA_CREATE_INFO *create_info,
|
||||
const char *path,
|
||||
ulonglong *copied,
|
||||
ulonglong *deleted,
|
||||
const uchar *pack_frm_data,
|
||||
size_t pack_frm_len)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int drop_partitions(const char *path)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int rename_partitions(const char *path)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int optimize_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int analyze_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int check_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
virtual int repair_partitions(THD *thd)
|
||||
{ return HA_ERR_WRONG_COMMAND; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2603,7 +2603,7 @@ void Item_sum_count_distinct::clear()
|
|||
else if (table)
|
||||
{
|
||||
table->file->extra(HA_EXTRA_NO_CACHE);
|
||||
table->file->delete_all_rows();
|
||||
table->file->ha_delete_all_rows();
|
||||
table->file->extra(HA_EXTRA_WRITE_CACHE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3934,7 +3934,7 @@ retry:
|
|||
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
|
||||
ha_open_options | HA_OPEN_FOR_REPAIR,
|
||||
entry, FALSE) || ! entry->file ||
|
||||
(entry->file->is_crashed() && entry->file->check_and_repair(thd)))
|
||||
(entry->file->is_crashed() && entry->file->ha_check_and_repair(thd)))
|
||||
{
|
||||
/* Give right error message */
|
||||
thd->clear_error();
|
||||
|
@ -5400,7 +5400,7 @@ bool rm_temporary_table(handlerton *base, char *path)
|
|||
error=1; /* purecov: inspected */
|
||||
*ext= 0; // remove extension
|
||||
file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base);
|
||||
if (file && file->delete_table(path))
|
||||
if (file && file->ha_delete_table(path))
|
||||
{
|
||||
error=1;
|
||||
sql_print_warning("Could not remove temporary table: '%s', error: %d",
|
||||
|
@ -8070,7 +8070,7 @@ my_bool mysql_rm_tmp_tables(void)
|
|||
((handler_file= get_new_handler(&share, thd->mem_root,
|
||||
share.db_type()))))
|
||||
{
|
||||
handler_file->delete_table(filePathCopy);
|
||||
handler_file->ha_delete_table(filePathCopy);
|
||||
delete handler_file;
|
||||
}
|
||||
free_table_share(&share);
|
||||
|
|
|
@ -123,7 +123,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||
ha_rows const maybe_deleted= table->file->stats.records;
|
||||
DBUG_PRINT("debug", ("Trying to use delete_all_rows()"));
|
||||
if (!(error=table->file->delete_all_rows()))
|
||||
if (!(error=table->file->ha_delete_all_rows()))
|
||||
{
|
||||
error= -1; // ok
|
||||
deleted= maybe_deleted;
|
||||
|
@ -328,7 +328,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
|||
We're really doing a truncate and need to reset the table's
|
||||
auto-increment counter.
|
||||
*/
|
||||
int error2= table->file->reset_auto_increment(0);
|
||||
int error2= table->file->ha_reset_auto_increment(0);
|
||||
|
||||
if (error2 && (error2 != HA_ERR_WRONG_COMMAND))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1534,14 +1534,14 @@ JOIN::reinit()
|
|||
if (exec_tmp_table1)
|
||||
{
|
||||
exec_tmp_table1->file->extra(HA_EXTRA_RESET_STATE);
|
||||
exec_tmp_table1->file->delete_all_rows();
|
||||
exec_tmp_table1->file->ha_delete_all_rows();
|
||||
free_io_cache(exec_tmp_table1);
|
||||
filesort_free_buffers(exec_tmp_table1,0);
|
||||
}
|
||||
if (exec_tmp_table2)
|
||||
{
|
||||
exec_tmp_table2->file->extra(HA_EXTRA_RESET_STATE);
|
||||
exec_tmp_table2->file->delete_all_rows();
|
||||
exec_tmp_table2->file->ha_delete_all_rows();
|
||||
free_io_cache(exec_tmp_table2);
|
||||
filesort_free_buffers(exec_tmp_table2,0);
|
||||
}
|
||||
|
@ -10467,9 +10467,9 @@ free_tmp_table(THD *thd, TABLE *entry)
|
|||
if (entry->file)
|
||||
{
|
||||
if (entry->db_stat)
|
||||
entry->file->drop_table(entry->s->table_name.str);
|
||||
entry->file->ha_drop_table(entry->s->table_name.str);
|
||||
else
|
||||
entry->file->delete_table(entry->s->table_name.str);
|
||||
entry->file->ha_delete_table(entry->s->table_name.str);
|
||||
delete entry->file;
|
||||
}
|
||||
|
||||
|
@ -10525,7 +10525,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
|
|||
if (open_tmp_table(&new_table))
|
||||
goto err1;
|
||||
if (table->file->indexes_are_disabled())
|
||||
new_table.file->disable_indexes(HA_KEY_SWITCH_ALL);
|
||||
new_table.file->ha_disable_indexes(HA_KEY_SWITCH_ALL);
|
||||
table->file->ha_index_or_rnd_end();
|
||||
table->file->ha_rnd_init(1);
|
||||
if (table->no_rows)
|
||||
|
@ -10591,7 +10591,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param,
|
|||
(void) table->file->ha_rnd_end();
|
||||
(void) new_table.file->close();
|
||||
err1:
|
||||
new_table.file->delete_table(new_table.s->table_name.str);
|
||||
new_table.file->ha_delete_table(new_table.s->table_name.str);
|
||||
err2:
|
||||
delete new_table.file;
|
||||
thd->proc_info=save_proc_info;
|
||||
|
|
|
@ -5864,7 +5864,7 @@ bool get_schema_tables_result(JOIN *join,
|
|||
{
|
||||
table_list->table->file->extra(HA_EXTRA_NO_CACHE);
|
||||
table_list->table->file->extra(HA_EXTRA_RESET_STATE);
|
||||
table_list->table->file->delete_all_rows();
|
||||
table_list->table->file->ha_delete_all_rows();
|
||||
free_io_cache(table_list->table);
|
||||
filesort_free_buffers(table_list->table,1);
|
||||
table_list->table->null_row= 0;
|
||||
|
|
|
@ -625,7 +625,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((error= file->delete_table(ddl_log_entry->name)))
|
||||
if ((error= file->ha_delete_table(ddl_log_entry->name)))
|
||||
{
|
||||
if (error != ENOENT && error != HA_ERR_NO_SUCH_TABLE)
|
||||
break;
|
||||
|
@ -662,8 +662,8 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (file->rename_table(ddl_log_entry->from_name,
|
||||
ddl_log_entry->name))
|
||||
if (file->ha_rename_table(ddl_log_entry->from_name,
|
||||
ddl_log_entry->name))
|
||||
break;
|
||||
}
|
||||
if ((deactivate_ddl_log_entry(ddl_log_entry->entry_pos)))
|
||||
|
@ -1294,9 +1294,9 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
|||
lpt->table_name, lpt->create_info,
|
||||
lpt->alter_info->create_list, lpt->key_count,
|
||||
lpt->key_info_buffer, lpt->table->file)) ||
|
||||
lpt->table->file->create_handler_files(shadow_path, NULL,
|
||||
CHF_CREATE_FLAG,
|
||||
lpt->create_info))
|
||||
lpt->table->file->ha_create_handler_files(shadow_path, NULL,
|
||||
CHF_CREATE_FLAG,
|
||||
lpt->create_info))
|
||||
{
|
||||
my_delete(shadow_frm_name, MYF(0));
|
||||
error= 1;
|
||||
|
@ -1348,15 +1348,15 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
|
|||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (my_delete(frm_name, MYF(MY_WME)) ||
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
lpt->table->file->create_handler_files(path, shadow_path,
|
||||
CHF_DELETE_FLAG, NULL) ||
|
||||
lpt->table->file->ha_create_handler_files(path, shadow_path,
|
||||
CHF_DELETE_FLAG, NULL) ||
|
||||
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos) ||
|
||||
(sync_ddl_log(), FALSE) ||
|
||||
#endif
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
my_rename(shadow_frm_name, frm_name, MYF(MY_WME)) ||
|
||||
lpt->table->file->create_handler_files(path, shadow_path,
|
||||
CHF_RENAME_FLAG, NULL))
|
||||
lpt->table->file->ha_create_handler_files(path, shadow_path,
|
||||
CHF_RENAME_FLAG, NULL))
|
||||
#else
|
||||
my_rename(shadow_frm_name, frm_name, MYF(MY_WME)))
|
||||
#endif
|
||||
|
@ -3713,14 +3713,14 @@ mysql_rename_table(handlerton *base, const char *old_db,
|
|||
to_base= lc_to;
|
||||
}
|
||||
|
||||
if (!file || !(error=file->rename_table(from_base, to_base)))
|
||||
if (!file || !(error=file->ha_rename_table(from_base, to_base)))
|
||||
{
|
||||
if (!(flags & NO_FRM_RENAME) && rename_file_ext(from,to,reg_ext))
|
||||
{
|
||||
error=my_errno;
|
||||
/* Restore old file name */
|
||||
if (file)
|
||||
file->rename_table(to_base, from_base);
|
||||
file->ha_rename_table(to_base, from_base);
|
||||
}
|
||||
}
|
||||
delete file;
|
||||
|
@ -4371,7 +4371,7 @@ send_result_message:
|
|||
if (!result_code) // recreation went ok
|
||||
{
|
||||
if ((table->table= open_ltable(thd, table, lock_type, 0)) &&
|
||||
((result_code= table->table->file->analyze(thd, check_opt)) > 0))
|
||||
((result_code= table->table->file->ha_analyze(thd, check_opt)) > 0))
|
||||
result_code= 0; // analyze went ok
|
||||
}
|
||||
if (result_code) // either mysql_recreate_table or analyze failed
|
||||
|
@ -4481,7 +4481,7 @@ bool mysql_backup_table(THD* thd, TABLE_LIST* table_list)
|
|||
"MySQL Administrator (mysqldump, mysql)");
|
||||
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
|
||||
"backup", TL_READ, 0, 0, 0, 0,
|
||||
&handler::backup, 0));
|
||||
&handler::ha_backup, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -4493,7 +4493,7 @@ bool mysql_restore_table(THD* thd, TABLE_LIST* table_list)
|
|||
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
|
||||
"restore", TL_WRITE, 1, 1, 0,
|
||||
&prepare_for_restore,
|
||||
&handler::restore, 0));
|
||||
&handler::ha_restore, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -4514,7 +4514,7 @@ bool mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
|||
DBUG_ENTER("mysql_optimize_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
"optimize", TL_WRITE, 1,0,0,0,
|
||||
&handler::optimize, 0));
|
||||
&handler::ha_optimize, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -4928,7 +4928,7 @@ bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
|||
DBUG_ENTER("mysql_analyze_table");
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
|
||||
"analyze", lock_type, 1, 0, 0, 0,
|
||||
&handler::analyze, 0));
|
||||
&handler::ha_analyze, 0));
|
||||
}
|
||||
|
||||
|
||||
|
@ -4975,7 +4975,7 @@ mysql_discard_or_import_tablespace(THD *thd,
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
error=table->file->discard_or_import_tablespace(discard);
|
||||
error= table->file->ha_discard_or_import_tablespace(discard);
|
||||
|
||||
thd->proc_info="end";
|
||||
|
||||
|
@ -5348,14 +5348,14 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
|
|||
|
||||
switch (keys_onoff) {
|
||||
case ENABLE:
|
||||
error= table->file->enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
break;
|
||||
case LEAVE_AS_IS:
|
||||
if (!indexes_were_disabled)
|
||||
break;
|
||||
/* fall-through: disabled indexes */
|
||||
case DISABLE:
|
||||
error= table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
error= table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
}
|
||||
|
||||
if (error == HA_ERR_WRONG_COMMAND)
|
||||
|
@ -6125,14 +6125,14 @@ view_err:
|
|||
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_EXECUTE_IF("sleep_alter_enable_indexes", my_sleep(6000000););
|
||||
error= table->file->enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
/* COND_refresh will be signaled in close_thread_tables() */
|
||||
break;
|
||||
case DISABLE:
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
error=table->file->disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
|
||||
/* COND_refresh will be signaled in close_thread_tables() */
|
||||
break;
|
||||
default:
|
||||
|
@ -6540,7 +6540,7 @@ view_err:
|
|||
KEY_PART_INFO *part_end;
|
||||
DBUG_PRINT("info", ("No new_table, checking add/drop index"));
|
||||
|
||||
table->file->prepare_for_alter();
|
||||
table->file->ha_prepare_for_alter();
|
||||
if (index_add_count)
|
||||
{
|
||||
/* The add_index() method takes an array of KEY structs. */
|
||||
|
@ -6758,8 +6758,8 @@ view_err:
|
|||
t_table= table;
|
||||
}
|
||||
/* Tell the handler that a new frm file is in place. */
|
||||
if (t_table->file->create_handler_files(path, NULL, CHF_INDEX_FLAG,
|
||||
create_info))
|
||||
if (t_table->file->ha_create_handler_files(path, NULL, CHF_INDEX_FLAG,
|
||||
create_info))
|
||||
goto err_with_placeholders;
|
||||
if (thd->locked_tables && new_name == table_name && new_db == db)
|
||||
{
|
||||
|
|
|
@ -440,10 +440,10 @@ bool st_select_lex_unit::exec()
|
|||
{
|
||||
item->assigned(0); // We will reinit & rexecute unit
|
||||
item->reset();
|
||||
table->file->delete_all_rows();
|
||||
table->file->ha_delete_all_rows();
|
||||
}
|
||||
/* re-enabling indexes for next subselect iteration */
|
||||
if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
|
||||
if (union_distinct && table->file->ha_enable_indexes(HA_KEY_SWITCH_ALL))
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ bool st_select_lex_unit::exec()
|
|||
sl->join->exec();
|
||||
if (sl == union_distinct)
|
||||
{
|
||||
if (table->file->disable_indexes(HA_KEY_SWITCH_ALL))
|
||||
if (table->file->ha_disable_indexes(HA_KEY_SWITCH_ALL))
|
||||
DBUG_RETURN(TRUE);
|
||||
table->no_keyread=1;
|
||||
}
|
||||
|
|
|
@ -623,9 +623,9 @@ int mysql_update(THD *thd,
|
|||
call then it should be included in the count of dup_key_found
|
||||
and error should be set to 0 (only if these errors are ignored).
|
||||
*/
|
||||
error= table->file->bulk_update_row(table->record[1],
|
||||
table->record[0],
|
||||
&dup_key_found);
|
||||
error= table->file->ha_bulk_update_row(table->record[1],
|
||||
table->record[0],
|
||||
&dup_key_found);
|
||||
limit+= dup_key_found;
|
||||
updated-= dup_key_found;
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ int rea_create_table(THD *thd, const char *path,
|
|||
DBUG_ASSERT(*fn_rext(frm_name));
|
||||
if (thd->variables.keep_files_on_create)
|
||||
create_info->options|= HA_CREATE_KEEP_FILES;
|
||||
if (file->create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info))
|
||||
if (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info))
|
||||
goto err_handler;
|
||||
if (!create_info->frm_only && ha_create_table(thd, path, db, table_name,
|
||||
create_info,0))
|
||||
|
@ -401,7 +401,7 @@ int rea_create_table(THD *thd, const char *path,
|
|||
DBUG_RETURN(0);
|
||||
|
||||
err_handler:
|
||||
VOID(file->create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info));
|
||||
VOID(file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info));
|
||||
my_delete(frm_name, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
} /* rea_create_table */
|
||||
|
|
Loading…
Reference in a new issue