Commit 8871e236 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

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
parent d7a64b5e
#if TOKU_INCLUDE_ALTER_55 #if TOKU_INCLUDE_ALTER_55
#include "ha_tokudb_alter_common.cc"
class ha_tokudb_add_index : public handler_add_index { class ha_tokudb_add_index : public handler_add_index {
public: public:
DB_TXN *txn; DB_TXN *txn;
...@@ -14,8 +16,7 @@ public: ...@@ -14,8 +16,7 @@ public:
volatile int ha_tokudb_add_index_wait = 0; volatile int ha_tokudb_add_index_wait = 0;
int int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, handler_add_index **add) {
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"); TOKUDB_DBUG_ENTER("ha_tokudb::add_index");
while (ha_tokudb_add_index_wait) sleep(1); // debug while (ha_tokudb_add_index_wait) sleep(1); // debug
...@@ -52,8 +53,7 @@ cleanup: ...@@ -52,8 +53,7 @@ cleanup:
volatile int ha_tokudb_final_add_index_wait = 0; volatile int ha_tokudb_final_add_index_wait = 0;
int int ha_tokudb::final_add_index(handler_add_index *add_arg, bool commit) {
ha_tokudb::final_add_index(handler_add_index *add_arg, bool commit) {
TOKUDB_DBUG_ENTER("ha_tokudb::final_add_index"); TOKUDB_DBUG_ENTER("ha_tokudb::final_add_index");
while (ha_tokudb_final_add_index_wait) sleep(1); // debug while (ha_tokudb_final_add_index_wait) sleep(1); // debug
...@@ -104,8 +104,7 @@ volatile int ha_tokudb_prepare_drop_index_wait = 0; //debug ...@@ -104,8 +104,7 @@ volatile int ha_tokudb_prepare_drop_index_wait = 0; //debug
// Returns: // Returns:
// 0 on success, error otherwise // 0 on success, error otherwise
// //
int int ha_tokudb::prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys) {
ha_tokudb::prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys) {
TOKUDB_DBUG_ENTER("ha_tokudb::prepare_drop_index"); TOKUDB_DBUG_ENTER("ha_tokudb::prepare_drop_index");
while (ha_tokudb_prepare_drop_index_wait) sleep(1); // debug while (ha_tokudb_prepare_drop_index_wait) sleep(1); // debug
...@@ -128,8 +127,7 @@ volatile int ha_tokudb_final_drop_index_wait = 0; // 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 // 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 // that are not NO_WRITES are not worth it at the moments, therefore, we can make
// this function just return // this function just return
int int ha_tokudb::final_drop_index(TABLE *table_arg) {
ha_tokudb::final_drop_index(TABLE *table_arg) {
TOKUDB_DBUG_ENTER("ha_tokudb::final_drop_index"); TOKUDB_DBUG_ENTER("ha_tokudb::final_drop_index");
while (ha_tokudb_final_drop_index_wait) sleep(1); // debug while (ha_tokudb_final_drop_index_wait) sleep(1); // debug
...@@ -140,8 +138,7 @@ ha_tokudb::final_drop_index(TABLE *table_arg) { ...@@ -140,8 +138,7 @@ ha_tokudb::final_drop_index(TABLE *table_arg) {
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
bool bool ha_tokudb::is_alter_table_hot() {
ha_tokudb::is_alter_table_hot() {
TOKUDB_DBUG_ENTER("is_alter_table_hot"); TOKUDB_DBUG_ENTER("is_alter_table_hot");
bool is_hot = false; bool is_hot = false;
THD *thd = ha_thd(); THD *thd = ha_thd();
...@@ -156,13 +153,11 @@ ha_tokudb::is_alter_table_hot() { ...@@ -156,13 +153,11 @@ ha_tokudb::is_alter_table_hot() {
TOKUDB_DBUG_RETURN(is_hot); TOKUDB_DBUG_RETURN(is_hot);
} }
int int ha_tokudb::new_alter_table_frm_data(const uchar *frm_data, size_t frm_len) {
ha_tokudb::new_alter_table_frm_data(const uchar *frm_data, size_t frm_len) {
return write_frm_data(frm_data, frm_len); return write_frm_data(frm_data, frm_len);
} }
void void ha_tokudb::prepare_for_alter() {
ha_tokudb::prepare_for_alter() {
TOKUDB_DBUG_ENTER("prepare_for_alter"); TOKUDB_DBUG_ENTER("prepare_for_alter");
// this is here because mysql commits the transaction before prepare_for_alter is called. // this is here because mysql commits the transaction before prepare_for_alter is called.
...@@ -185,8 +180,7 @@ ha_tokudb::prepare_for_alter() { ...@@ -185,8 +180,7 @@ ha_tokudb::prepare_for_alter() {
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
bool bool ha_tokudb::try_hot_alter_table() {
ha_tokudb::try_hot_alter_table() {
TOKUDB_DBUG_ENTER("try_hot_alter_table"); TOKUDB_DBUG_ENTER("try_hot_alter_table");
THD *thd = ha_thd(); THD *thd = ha_thd();
bool disable_hot_alter = get_disable_hot_alter(thd); bool disable_hot_alter = get_disable_hot_alter(thd);
......
static bool #if !defined(TOKUDB_ALTER_COMMON)
tables_have_same_keys(TABLE* table, TABLE* altered_table, bool print_error, bool check_field_index) { #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; bool retval;
if (table->s->keys != altered_table->s->keys) { if (table->s->keys != altered_table->s->keys) {
if (print_error) { if (print_error) {
...@@ -115,8 +118,8 @@ cleanup: ...@@ -115,8 +118,8 @@ cleanup:
// to evaluate whether a field is NULL or not. This value is a power of 2, from // 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 // 2^0 to 2^7. We return the position of the bit within the byte, which is
// lg null_bit // lg null_bit
static inline uint32_t static inline uint32_t get_null_bit_position(uint32_t null_bit) __attribute__((unused));
get_null_bit_position(uint32_t null_bit) { static inline uint32_t get_null_bit_position(uint32_t null_bit) {
uint32_t retval = 0; uint32_t retval = 0;
switch(null_bit) { switch(null_bit) {
case (1): case (1):
...@@ -150,16 +153,16 @@ get_null_bit_position(uint32_t null_bit) { ...@@ -150,16 +153,16 @@ get_null_bit_position(uint32_t null_bit) {
} }
// returns the index of the null bit of field. // returns the index of the null bit of field.
static inline uint32_t static inline uint32_t get_overall_null_bit_position(TABLE* table, Field* field) __attribute__((unused));
get_overall_null_bit_position(TABLE* table, Field* field) { static inline uint32_t get_overall_null_bit_position(TABLE* table, Field* field) {
uint32_t offset = get_null_offset(table, field); uint32_t offset = get_null_offset(table, field);
uint32_t null_bit = field->null_bit; uint32_t null_bit = field->null_bit;
return offset*8 + get_null_bit_position(null_bit); return offset*8 + get_null_bit_position(null_bit);
} }
// not static since 51 uses this and 56 does not // not static since 51 uses this and 56 does not
bool static bool are_null_bits_in_order(TABLE* table) __attribute__((unused));
are_null_bits_in_order(TABLE* table) { static bool are_null_bits_in_order(TABLE* table) {
uint32_t curr_null_pos = 0; uint32_t curr_null_pos = 0;
bool first = true; bool first = true;
bool retval = true; bool retval = true;
...@@ -182,8 +185,8 @@ are_null_bits_in_order(TABLE* table) { ...@@ -182,8 +185,8 @@ are_null_bits_in_order(TABLE* table) {
return retval; return retval;
} }
static uint32_t static uint32_t get_first_null_bit_pos(TABLE* table) __attribute__((unused));
get_first_null_bit_pos(TABLE* table) { static uint32_t get_first_null_bit_pos(TABLE* table) {
uint32_t table_pos = 0; uint32_t table_pos = 0;
for (uint i = 0; i < table->s->fields; i++) { for (uint i = 0; i < table->s->fields; i++) {
Field* curr_field = table->field[i]; Field* curr_field = table->field[i];
...@@ -199,9 +202,8 @@ get_first_null_bit_pos(TABLE* table) { ...@@ -199,9 +202,8 @@ get_first_null_bit_pos(TABLE* table) {
return table_pos; return table_pos;
} }
#if 0 static bool is_column_default_null(TABLE* src_table, uint32_t field_index) __attribute__((unused));
static bool static bool is_column_default_null(TABLE* src_table, uint32_t field_index) {
is_column_default_null(TABLE* src_table, uint32_t field_index) {
Field* curr_field = src_table->field[field_index]; Field* curr_field = src_table->field[field_index];
bool is_null_default = false; bool is_null_default = false;
bool nullable = curr_field->null_bit != 0; bool nullable = curr_field->null_bit != 0;
...@@ -214,10 +216,8 @@ is_column_default_null(TABLE* src_table, uint32_t field_index) { ...@@ -214,10 +216,8 @@ is_column_default_null(TABLE* src_table, uint32_t field_index) {
} }
return is_null_default; return is_null_default;
} }
#endif
static uint32_t static uint32_t fill_static_row_mutator(
fill_static_row_mutator(
uchar* buf, uchar* buf,
TABLE* orig_table, TABLE* orig_table,
TABLE* altered_table, TABLE* altered_table,
...@@ -283,8 +283,7 @@ fill_static_row_mutator( ...@@ -283,8 +283,7 @@ fill_static_row_mutator(
return pos - buf; return pos - buf;
} }
static uint32_t static uint32_t fill_dynamic_row_mutator(
fill_dynamic_row_mutator(
uchar* buf, uchar* buf,
uint32_t* columns, uint32_t* columns,
uint32_t num_columns, uint32_t num_columns,
...@@ -391,8 +390,7 @@ fill_dynamic_row_mutator( ...@@ -391,8 +390,7 @@ fill_dynamic_row_mutator(
return pos-buf; return pos-buf;
} }
static uint32_t static uint32_t fill_static_blob_row_mutator(
fill_static_blob_row_mutator(
uchar* buf, uchar* buf,
TABLE* src_table, TABLE* src_table,
KEY_AND_COL_INFO* src_kc_info KEY_AND_COL_INFO* src_kc_info
...@@ -415,8 +413,7 @@ fill_static_blob_row_mutator( ...@@ -415,8 +413,7 @@ fill_static_blob_row_mutator(
return pos-buf; return pos-buf;
} }
static uint32_t static uint32_t fill_dynamic_blob_row_mutator(
fill_dynamic_blob_row_mutator(
uchar* buf, uchar* buf,
uint32_t* columns, uint32_t* columns,
uint32_t num_columns, uint32_t num_columns,
...@@ -471,8 +468,7 @@ fill_dynamic_blob_row_mutator( ...@@ -471,8 +468,7 @@ fill_dynamic_blob_row_mutator(
// TODO: carefully review to make sure that the right information is used // 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: 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 // TODO: it from altered_kc_info, and when is keynr associated with the right thing
uint32_t uint32_t ha_tokudb::fill_row_mutator(
ha_tokudb::fill_row_mutator(
uchar* buf, uchar* buf,
uint32_t* columns, uint32_t* columns,
uint32_t num_columns, uint32_t num_columns,
...@@ -565,8 +561,7 @@ ha_tokudb::fill_row_mutator( ...@@ -565,8 +561,7 @@ ha_tokudb::fill_row_mutator(
return pos-buf; return pos-buf;
} }
static bool static bool all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
if (table_a->s->fields != table_b->s->fields) if (table_a->s->fields != table_b->s->fields)
return false; return false;
for (uint i = 0; i < table_a->s->fields; i++) { 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) { ...@@ -578,13 +573,8 @@ all_fields_are_same_type(TABLE *table_a, TABLE *table_b) {
return true; return true;
} }
static bool static bool column_rename_supported(TABLE* orig_table, TABLE* new_table, bool alter_column_order) __attribute__((unused));
column_rename_supported( static bool column_rename_supported(TABLE* orig_table, TABLE* new_table, bool alter_column_order) {
TABLE* orig_table,
TABLE* new_table,
bool alter_column_order
)
{
bool retval = false; bool retval = false;
bool keys_same_for_cr; bool keys_same_for_cr;
uint num_fields_with_different_names = 0; uint num_fields_with_different_names = 0;
...@@ -637,14 +627,8 @@ cleanup: ...@@ -637,14 +627,8 @@ cleanup:
return retval; return retval;
} }
static int static int find_changed_columns(uint32_t* changed_columns, uint32_t* num_changed_columns, TABLE* smaller_table, TABLE* bigger_table) __attribute__((unused));
find_changed_columns( static int find_changed_columns(uint32_t* changed_columns, uint32_t* num_changed_columns, TABLE* smaller_table, TABLE* bigger_table) {
uint32_t* changed_columns,
uint32_t* num_changed_columns,
TABLE* smaller_table,
TABLE* bigger_table
)
{
int retval; int retval;
uint curr_new_col_index = 0; uint curr_new_col_index = 0;
uint32_t curr_num_changed_columns=0; uint32_t curr_num_changed_columns=0;
...@@ -691,8 +675,8 @@ cleanup: ...@@ -691,8 +675,8 @@ cleanup:
return retval; return retval;
} }
static bool static bool tables_have_same_keys_and_columns(TABLE* first_table, TABLE* second_table, bool print_error) __attribute__((unused));
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) {
bool retval; bool retval;
if (first_table->s->null_bytes != second_table->s->null_bytes) { if (first_table->s->null_bytes != second_table->s->null_bytes) {
retval = false; retval = false;
...@@ -740,8 +724,7 @@ exit: ...@@ -740,8 +724,7 @@ exit:
#if TOKU_INCLUDE_WRITE_FRM_DATA #if TOKU_INCLUDE_WRITE_FRM_DATA
// write the new frm data to the status dictionary using the alter table transaction // write the new frm data to the status dictionary using the alter table transaction
int int ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
TOKUDB_DBUG_ENTER("write_frm_data"); TOKUDB_DBUG_ENTER("write_frm_data");
int error = 0; int error = 0;
...@@ -758,3 +741,5 @@ ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) { ...@@ -758,3 +741,5 @@ ha_tokudb::write_frm_data(const uchar *frm_data, size_t frm_len) {
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
#endif #endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment