mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
refs #5640 port handlerton to maria-5.5.28a
git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@50677 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
13c9009f9f
commit
2168c92094
2 changed files with 40 additions and 61 deletions
|
@ -1,5 +1,7 @@
|
|||
#if TOKU_INCLUDE_ALTER_55
|
||||
|
||||
#include "ha_tokudb_alter_common.cc"
|
||||
|
||||
class ha_tokudb_add_index : public handler_add_index {
|
||||
public:
|
||||
DB_TXN *txn;
|
||||
|
@ -14,8 +16,7 @@ public:
|
|||
|
||||
volatile int ha_tokudb_add_index_wait = 0;
|
||||
|
||||
int
|
||||
ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, handler_add_index **add) {
|
||||
int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, handler_add_index **add) {
|
||||
TOKUDB_DBUG_ENTER("ha_tokudb::add_index");
|
||||
while (ha_tokudb_add_index_wait) sleep(1); // debug
|
||||
|
||||
|
@ -52,8 +53,7 @@ cleanup:
|
|||
|
||||
volatile int ha_tokudb_final_add_index_wait = 0;
|
||||
|
||||
int
|
||||
ha_tokudb::final_add_index(handler_add_index *add_arg, bool commit) {
|
||||
int ha_tokudb::final_add_index(handler_add_index *add_arg, bool commit) {
|
||||
TOKUDB_DBUG_ENTER("ha_tokudb::final_add_index");
|
||||
while (ha_tokudb_final_add_index_wait) sleep(1); // debug
|
||||
|
||||
|
@ -104,8 +104,7 @@ volatile int ha_tokudb_prepare_drop_index_wait = 0; //debug
|
|||
// Returns:
|
||||
// 0 on success, error otherwise
|
||||
//
|
||||
int
|
||||
ha_tokudb::prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys) {
|
||||
int ha_tokudb::prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys) {
|
||||
TOKUDB_DBUG_ENTER("ha_tokudb::prepare_drop_index");
|
||||
while (ha_tokudb_prepare_drop_index_wait) sleep(1); // debug
|
||||
|
||||
|
@ -128,8 +127,7 @@ volatile int ha_tokudb_final_drop_index_wait = 0; // debug
|
|||
// Changes for "future-proofing" this so that it works when we have the equivalent flags
|
||||
// that are not NO_WRITES are not worth it at the moments, therefore, we can make
|
||||
// this function just return
|
||||
int
|
||||
ha_tokudb::final_drop_index(TABLE *table_arg) {
|
||||
int ha_tokudb::final_drop_index(TABLE *table_arg) {
|
||||
TOKUDB_DBUG_ENTER("ha_tokudb::final_drop_index");
|
||||
while (ha_tokudb_final_drop_index_wait) sleep(1); // debug
|
||||
|
||||
|
@ -140,8 +138,7 @@ ha_tokudb::final_drop_index(TABLE *table_arg) {
|
|||
TOKUDB_DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
bool
|
||||
ha_tokudb::is_alter_table_hot() {
|
||||
bool ha_tokudb::is_alter_table_hot() {
|
||||
TOKUDB_DBUG_ENTER("is_alter_table_hot");
|
||||
bool is_hot = false;
|
||||
THD *thd = ha_thd();
|
||||
|
@ -156,13 +153,11 @@ ha_tokudb::is_alter_table_hot() {
|
|||
TOKUDB_DBUG_RETURN(is_hot);
|
||||
}
|
||||
|
||||
int
|
||||
ha_tokudb::new_alter_table_frm_data(const uchar *frm_data, size_t frm_len) {
|
||||
int ha_tokudb::new_alter_table_frm_data(const uchar *frm_data, size_t frm_len) {
|
||||
return write_frm_data(frm_data, frm_len);
|
||||
}
|
||||
|
||||
void
|
||||
ha_tokudb::prepare_for_alter() {
|
||||
void ha_tokudb::prepare_for_alter() {
|
||||
TOKUDB_DBUG_ENTER("prepare_for_alter");
|
||||
|
||||
// this is here because mysql commits the transaction before prepare_for_alter is called.
|
||||
|
@ -185,8 +180,7 @@ ha_tokudb::prepare_for_alter() {
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
bool
|
||||
ha_tokudb::try_hot_alter_table() {
|
||||
bool ha_tokudb::try_hot_alter_table() {
|
||||
TOKUDB_DBUG_ENTER("try_hot_alter_table");
|
||||
THD *thd = ha_thd();
|
||||
bool disable_hot_alter = get_disable_hot_alter(thd);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
static bool
|
||||
tables_have_same_keys(TABLE* table, TABLE* altered_table, bool print_error, bool check_field_index) {
|
||||
#if !defined(TOKUDB_ALTER_COMMON)
|
||||
#define TOKUDB_ALTER_COMMON
|
||||
|
||||
static bool tables_have_same_keys(TABLE* table, TABLE* altered_table, bool print_error, bool check_field_index) __attribute__((unused));
|
||||
static bool tables_have_same_keys(TABLE* table, TABLE* altered_table, bool print_error, bool check_field_index) {
|
||||
bool retval;
|
||||
if (table->s->keys != altered_table->s->keys) {
|
||||
if (print_error) {
|
||||
|
@ -115,8 +118,8 @@ cleanup:
|
|||
// to evaluate whether a field is NULL or not. This value is a power of 2, from
|
||||
// 2^0 to 2^7. We return the position of the bit within the byte, which is
|
||||
// lg null_bit
|
||||
static inline uint32_t
|
||||
get_null_bit_position(uint32_t null_bit) {
|
||||
static inline uint32_t get_null_bit_position(uint32_t null_bit) __attribute__((unused));
|
||||
static inline uint32_t get_null_bit_position(uint32_t null_bit) {
|
||||
uint32_t retval = 0;
|
||||
switch(null_bit) {
|
||||
case (1):
|
||||
|
@ -150,16 +153,16 @@ get_null_bit_position(uint32_t null_bit) {
|
|||
}
|
||||
|
||||
// returns the index of the null bit of field.
|
||||
static inline uint32_t
|
||||
get_overall_null_bit_position(TABLE* table, Field* field) {
|
||||
static inline uint32_t get_overall_null_bit_position(TABLE* table, Field* field) __attribute__((unused));
|
||||
static inline uint32_t get_overall_null_bit_position(TABLE* table, Field* field) {
|
||||
uint32_t offset = get_null_offset(table, field);
|
||||
uint32_t null_bit = field->null_bit;
|
||||
return offset*8 + get_null_bit_position(null_bit);
|
||||
}
|
||||
|
||||
// not static since 51 uses this and 56 does not
|
||||
bool
|
||||
are_null_bits_in_order(TABLE* table) {
|
||||
static bool are_null_bits_in_order(TABLE* table) __attribute__((unused));
|
||||
static bool are_null_bits_in_order(TABLE* table) {
|
||||
uint32_t curr_null_pos = 0;
|
||||
bool first = true;
|
||||
bool retval = true;
|
||||
|
@ -182,8 +185,8 @@ are_null_bits_in_order(TABLE* table) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
get_first_null_bit_pos(TABLE* table) {
|
||||
static uint32_t get_first_null_bit_pos(TABLE* table) __attribute__((unused));
|
||||
static uint32_t get_first_null_bit_pos(TABLE* table) {
|
||||
uint32_t table_pos = 0;
|
||||
for (uint i = 0; i < table->s->fields; i++) {
|
||||
Field* curr_field = table->field[i];
|
||||
|
@ -199,9 +202,8 @@ get_first_null_bit_pos(TABLE* table) {
|
|||
return table_pos;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static bool
|
||||
is_column_default_null(TABLE* src_table, uint32_t field_index) {
|
||||
static bool is_column_default_null(TABLE* src_table, uint32_t field_index) __attribute__((unused));
|
||||
static bool is_column_default_null(TABLE* src_table, uint32_t field_index) {
|
||||
Field* curr_field = src_table->field[field_index];
|
||||
bool is_null_default = false;
|
||||
bool nullable = curr_field->null_bit != 0;
|
||||
|
@ -214,10 +216,8 @@ is_column_default_null(TABLE* src_table, uint32_t field_index) {
|
|||
}
|
||||
return is_null_default;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t
|
||||
fill_static_row_mutator(
|
||||
static uint32_t fill_static_row_mutator(
|
||||
uchar* buf,
|
||||
TABLE* orig_table,
|
||||
TABLE* altered_table,
|
||||
|
@ -283,8 +283,7 @@ fill_static_row_mutator(
|
|||
return pos - buf;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
fill_dynamic_row_mutator(
|
||||
static uint32_t fill_dynamic_row_mutator(
|
||||
uchar* buf,
|
||||
uint32_t* columns,
|
||||
uint32_t num_columns,
|
||||
|
@ -391,8 +390,7 @@ fill_dynamic_row_mutator(
|
|||
return pos-buf;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
fill_static_blob_row_mutator(
|
||||
static uint32_t fill_static_blob_row_mutator(
|
||||
uchar* buf,
|
||||
TABLE* src_table,
|
||||
KEY_AND_COL_INFO* src_kc_info
|
||||
|
@ -415,8 +413,7 @@ fill_static_blob_row_mutator(
|
|||
return pos-buf;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
fill_dynamic_blob_row_mutator(
|
||||
static uint32_t fill_dynamic_blob_row_mutator(
|
||||
uchar* buf,
|
||||
uint32_t* columns,
|
||||
uint32_t num_columns,
|
||||
|
@ -471,8 +468,7 @@ fill_dynamic_blob_row_mutator(
|
|||
// TODO: carefully review to make sure that the right information is used
|
||||
// TODO: namely, when do we get stuff from share->kc_info and when we get
|
||||
// TODO: it from altered_kc_info, and when is keynr associated with the right thing
|
||||
uint32_t
|
||||
ha_tokudb::fill_row_mutator(
|
||||
uint32_t ha_tokudb::fill_row_mutator(
|
||||
uchar* buf,
|
||||
uint32_t* columns,
|
||||
uint32_t num_columns,
|
||||
|
@ -565,8 +561,7 @@ ha_tokudb::fill_row_mutator(
|
|||
return pos-buf;
|
||||
}
|
||||
|
||||
static bool
|
||||
all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
|
||||
static bool all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
|
||||
if (table_a->s->fields != table_b->s->fields)
|
||||
return false;
|
||||
for (uint i = 0; i < table_a->s->fields; i++) {
|
||||
|
@ -578,13 +573,8 @@ all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
column_rename_supported(
|
||||
TABLE* orig_table,
|
||||
TABLE* new_table,
|
||||
bool alter_column_order
|
||||
)
|
||||
{
|
||||
static bool column_rename_supported(TABLE* orig_table, TABLE* new_table, bool alter_column_order) __attribute__((unused));
|
||||
static bool column_rename_supported(TABLE* orig_table, TABLE* new_table, bool alter_column_order) {
|
||||
bool retval = false;
|
||||
bool keys_same_for_cr;
|
||||
uint num_fields_with_different_names = 0;
|
||||
|
@ -637,14 +627,8 @@ cleanup:
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
find_changed_columns(
|
||||
uint32_t* changed_columns,
|
||||
uint32_t* num_changed_columns,
|
||||
TABLE* smaller_table,
|
||||
TABLE* bigger_table
|
||||
)
|
||||
{
|
||||
static int find_changed_columns(uint32_t* changed_columns, uint32_t* num_changed_columns, TABLE* smaller_table, TABLE* bigger_table) __attribute__((unused));
|
||||
static int find_changed_columns(uint32_t* changed_columns, uint32_t* num_changed_columns, TABLE* smaller_table, TABLE* bigger_table) {
|
||||
int retval;
|
||||
uint curr_new_col_index = 0;
|
||||
uint32_t curr_num_changed_columns=0;
|
||||
|
@ -691,8 +675,8 @@ cleanup:
|
|||
return retval;
|
||||
}
|
||||
|
||||
static bool
|
||||
tables_have_same_keys_and_columns(TABLE* first_table, TABLE* second_table, bool print_error) {
|
||||
static bool tables_have_same_keys_and_columns(TABLE* first_table, TABLE* second_table, bool print_error) __attribute__((unused));
|
||||
static bool tables_have_same_keys_and_columns(TABLE* first_table, TABLE* second_table, bool print_error) {
|
||||
bool retval;
|
||||
if (first_table->s->null_bytes != second_table->s->null_bytes) {
|
||||
retval = false;
|
||||
|
@ -740,8 +724,7 @@ exit:
|
|||
|
||||
#if TOKU_INCLUDE_WRITE_FRM_DATA
|
||||
// write the new frm data to the status dictionary using the alter table transaction
|
||||
int
|
||||
ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
|
||||
int ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
|
||||
TOKUDB_DBUG_ENTER("write_frm_data");
|
||||
|
||||
int error = 0;
|
||||
|
@ -758,3 +741,5 @@ ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
|
|||
TOKUDB_DBUG_RETURN(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue