Commit f18599a1 authored by Sergei Golubchik's avatar Sergei Golubchik

tokudb compilation warnings

5.5 patch only
parent d1fe928c
......@@ -3140,189 +3140,3 @@ static uint32_t pack_key_from_desc(
return (uint32_t)(packed_key_pos - buf); //
}
static bool fields_have_same_name(Field* a, Field* b) {
return strcmp(a->field_name, b->field_name) == 0;
}
static bool fields_are_same_type(Field* a, Field* b) {
bool retval = true;
enum_field_types a_mysql_type = a->real_type();
enum_field_types b_mysql_type = b->real_type();
TOKU_TYPE a_toku_type = mysql_to_toku_type(a);
TOKU_TYPE b_toku_type = mysql_to_toku_type(b);
// make sure have same names
// make sure have same types
if (a_mysql_type != b_mysql_type) {
retval = false;
goto cleanup;
}
// Thanks to MariaDB 5.5, we can have two fields
// be the same MySQL type but not the same toku type,
// This is an issue introduced with MariaDB's fractional time
// implementation
if (a_toku_type != b_toku_type) {
retval = false;
goto cleanup;
}
// make sure that either both are nullable, or both not nullable
if ((a->null_bit && !b->null_bit) || (!a->null_bit && b->null_bit)) {
retval = false;
goto cleanup;
}
switch (a_mysql_type) {
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
// length, unsigned, auto increment
if (a->pack_length() != b->pack_length() ||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
(a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT:
// length, unsigned, auto increment
if (a->pack_length() != b->pack_length() ||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG) ||
(a->flags & AUTO_INCREMENT_FLAG) != (b->flags & AUTO_INCREMENT_FLAG)) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_NEWDECIMAL:
// length, unsigned
if (a->pack_length() != b->pack_length() ||
(a->flags & UNSIGNED_FLAG) != (b->flags & UNSIGNED_FLAG)) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_ENUM: {
Field_enum *a_enum = static_cast<Field_enum *>(a);
if (!a_enum->eq_def(b)) {
retval = false;
goto cleanup;
}
break;
}
case MYSQL_TYPE_SET: {
Field_set *a_set = static_cast<Field_set *>(a);
if (!a_set->eq_def(b)) {
retval = false;
goto cleanup;
}
break;
}
case MYSQL_TYPE_BIT:
// length
if (a->pack_length() != b->pack_length()) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_NEWDATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_TIMESTAMP:
#if (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) || \
(100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099)
case MYSQL_TYPE_DATETIME2:
case MYSQL_TYPE_TIMESTAMP2:
case MYSQL_TYPE_TIME2:
#endif
// length
if (a->pack_length() != b->pack_length()) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_LONG_BLOB:
// test the charset
if (a->charset()->number != b->charset()->number) {
retval = false;
goto cleanup;
}
if (a->row_pack_length() != b->row_pack_length()) {
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_STRING:
if (a->pack_length() != b->pack_length()) {
retval = false;
goto cleanup;
}
// if both are binary, we know have same pack lengths,
// so we can goto end
if (a->binary() && b->binary()) {
// nothing to do, we are good
}
else if (!a->binary() && !b->binary()) {
// test the charset
if (a->charset()->number != b->charset()->number) {
retval = false;
goto cleanup;
}
}
else {
// one is binary and the other is not, so not the same
retval = false;
goto cleanup;
}
break;
case MYSQL_TYPE_VARCHAR:
if (a->field_length != b->field_length) {
retval = false;
goto cleanup;
}
// if both are binary, we know have same pack lengths,
// so we can goto end
if (a->binary() && b->binary()) {
// nothing to do, we are good
}
else if (!a->binary() && !b->binary()) {
// test the charset
if (a->charset()->number != b->charset()->number) {
retval = false;
goto cleanup;
}
}
else {
// one is binary and the other is not, so not the same
retval = false;
goto cleanup;
}
break;
//
// I believe these are old types that are no longer
// in any 5.1 tables, so tokudb does not need
// to worry about them
// Putting in this assert in case I am wrong.
// Do not support geometry yet.
//
case MYSQL_TYPE_GEOMETRY:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_NULL:
assert(false);
}
cleanup:
return retval;
}
static bool are_two_fields_same(Field* a, Field* b) {
return fields_have_same_name(a, b) && fields_are_same_type(a, b);
}
......@@ -208,10 +208,6 @@ static bool is_variable_field(KEY_AND_COL_INFO *kcinfo, uint field_num) {
return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_VARIABLE_FIELD;
}
static bool is_blob_field(KEY_AND_COL_INFO *kcinfo, uint field_num) {
return kcinfo->field_types[field_num] == KEY_AND_COL_INFO::TOKUDB_BLOB_FIELD;
}
static bool field_valid_for_tokudb_table(Field* field);
static void get_var_field_info(
......@@ -472,20 +468,5 @@ static uint32_t pack_key_from_desc(
const DBT* pk_val
);
static bool fields_have_same_name(
Field* a,
Field* b
);
static bool fields_are_same_type(
Field* a,
Field* b
);
static bool are_two_fields_same(
Field* a,
Field* b
);
#endif
......@@ -193,10 +193,6 @@ static MYSQL_THDVAR_BOOL(disable_slow_alter,
false
);
static bool get_disable_slow_alter(THD* thd) {
return (THDVAR(thd, disable_slow_alter) != 0);
}
static MYSQL_THDVAR_BOOL(disable_hot_alter,
0,
"if on, hot alter table is disabled",
......@@ -205,10 +201,6 @@ static MYSQL_THDVAR_BOOL(disable_hot_alter,
false
);
static bool get_disable_hot_alter(THD* thd) {
return THDVAR(thd, disable_hot_alter) != 0;
}
static MYSQL_THDVAR_BOOL(create_index_online,
0,
"if on, create index done online",
......
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