summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2013-12-11 15:47:25 -0500
committerRich Prohaska <prohaska@tokutek.com>2013-12-11 15:47:25 -0500
commit521cf40b4ef852deeb8b451bbaaa60aa8ec5862c (patch)
tree35c096b665bac5e2623d992f13ae08e1200fed3a
parenta79eb8e85ae1bf520ff372c76030541426d33c0e (diff)
downloadmariadb-git-521cf40b4ef852deeb8b451bbaaa60aa8ec5862c.tar.gz
port to mysql 5.6.15
-rw-r--r--storage/tokudb/ha_tokudb.cc27
-rw-r--r--storage/tokudb/ha_tokudb_admin.cc4
-rw-r--r--storage/tokudb/ha_tokudb_alter_56.cc12
-rw-r--r--storage/tokudb/ha_tokudb_update.cc6
-rw-r--r--storage/tokudb/hatoku_defines.h3
5 files changed, 27 insertions, 25 deletions
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index c3805b0c78d..6219ee39f75 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -1507,8 +1507,7 @@ static int initialize_key_and_col_info(TABLE_SHARE* table_share, TABLE* table, K
kc_info->num_offset_bytes = 2;
}
-
- for (uint i = 0; i < table_share->keys + test(hidden_primary_key); i++) {
+ for (uint i = 0; i < table_share->keys + tokudb_test(hidden_primary_key); i++) {
//
// do the cluster/primary key filtering calculations
//
@@ -1551,7 +1550,7 @@ exit:
}
bool ha_tokudb::can_replace_into_be_fast(TABLE_SHARE* table_share, KEY_AND_COL_INFO* kc_info, uint pk) {
- uint curr_num_DBs = table_share->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table_share->keys + tokudb_test(hidden_primary_key);
bool ret_val;
if (curr_num_DBs == 1) {
ret_val = true;
@@ -1717,7 +1716,7 @@ int ha_tokudb::initialize_share(
share->try_table_lock = false;
}
- share->num_DBs = table_share->keys + test(hidden_primary_key);
+ share->num_DBs = table_share->keys + tokudb_test(hidden_primary_key);
error = 0;
exit:
@@ -2804,7 +2803,7 @@ DBT *ha_tokudb::pack_key(
{
TOKUDB_DBUG_ENTER("ha_tokudb::pack_key");
#if TOKU_INCLUDE_EXTENDED_KEYS
- if (keynr != primary_key && !test(hidden_primary_key)) {
+ if (keynr != primary_key && !tokudb_test(hidden_primary_key)) {
DBUG_RETURN(pack_ext_key(key, keynr, buff, key_ptr, key_length, inf_byte));
}
#endif
@@ -3229,7 +3228,7 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
abort_loader = false;
rw_rdlock(&share->num_DBs_lock);
- uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
num_DBs_locked_in_bulk = true;
lock_count = 0;
@@ -3743,7 +3742,7 @@ void ha_tokudb::set_main_dict_put_flags(
)
{
uint32_t old_prelock_flags = 0;
- uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
bool in_hot_index = share->num_DBs > curr_num_DBs;
bool using_ignore_flag_opt = do_ignore_flag_optimization(
thd, table, share->replace_into_fast);
@@ -3787,7 +3786,7 @@ int ha_tokudb::insert_row_to_main_dictionary(uchar* record, DBT* pk_key, DBT* pk
int error = 0;
uint32_t put_flags = mult_put_flags[primary_key];
THD *thd = ha_thd();
- uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
assert(curr_num_DBs == 1);
@@ -3997,7 +3996,7 @@ int ha_tokudb::write_row(uchar * record) {
// for #4633
// if we have a duplicate key error, let's check the primary key to see
// if there is a duplicate there. If so, set last_dup_key to the pk
- if (error == DB_KEYEXIST && !test(hidden_primary_key) && last_dup_key != primary_key) {
+ if (error == DB_KEYEXIST && !tokudb_test(hidden_primary_key) && last_dup_key != primary_key) {
int r = share->file->getf_set(
share->file,
txn,
@@ -5829,7 +5828,7 @@ int ha_tokudb::info(uint flag) {
TOKUDB_DBUG_ENTER("ha_tokudb::info %p %d %lld", this, flag, (long long) share->rows);
int error;
DB_TXN* txn = NULL;
- uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
DB_BTREE_STAT64 dict_stats;
if (flag & HA_STATUS_VARIABLE) {
// Just to get optimizations right
@@ -6337,7 +6336,7 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
// if creating a hot index
if (thd_sql_command(thd)== SQLCOM_CREATE_INDEX && get_create_index_online(thd)) {
rw_rdlock(&share->num_DBs_lock);
- if (share->num_DBs == (table->s->keys + test(hidden_primary_key))) {
+ if (share->num_DBs == (table->s->keys + tokudb_test(hidden_primary_key))) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
lock.type = lock_type;
@@ -7589,7 +7588,7 @@ int ha_tokudb::tokudb_add_index(
//
// number of DB files we have open currently, before add_index is executed
//
- uint curr_num_DBs = table_arg->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table_arg->s->keys + tokudb_test(hidden_primary_key);
//
// get the row type to use for the indexes we're adding
@@ -7929,7 +7928,7 @@ To add indexes, make sure no transactions touch the table.", share->table_name);
// Closes added indexes in case of error in error path of add_index and alter_table_phase2
//
void ha_tokudb::restore_add_index(TABLE* table_arg, uint num_of_keys, bool incremented_numDBs, bool modified_DBs) {
- uint curr_num_DBs = table_arg->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table_arg->s->keys + tokudb_test(hidden_primary_key);
uint curr_index = 0;
//
@@ -8150,7 +8149,7 @@ int ha_tokudb::delete_all_rows_internal() {
error = txn_begin(db_env, 0, &txn, 0, ha_thd());
if (error) { goto cleanup; }
- curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
for (uint i = 0; i < curr_num_DBs; i++) {
error = share->key_file[i]->pre_acquire_fileops_lock(
share->key_file[i],
diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc
index 740364a5d4b..9e236966d32 100644
--- a/storage/tokudb/ha_tokudb_admin.cc
+++ b/storage/tokudb/ha_tokudb_admin.cc
@@ -200,7 +200,7 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) {
while (ha_tokudb_optimize_wait) sleep(1); // debug
int error;
- uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
#ifdef HA_TOKUDB_HAS_THD_PROGRESS
// each DB is its own stage. as HOT goes through each db, we'll
@@ -290,7 +290,7 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) {
if (r != 0)
result = HA_ADMIN_INTERNAL_ERROR;
if (result == HA_ADMIN_OK) {
- uint32_t num_DBs = table_share->keys + test(hidden_primary_key);
+ uint32_t num_DBs = table_share->keys + tokudb_test(hidden_primary_key);
snprintf(write_status_msg, sizeof write_status_msg, "%s primary=%d num=%d", share->table_name, primary_key, num_DBs);
if (tokudb_debug & TOKUDB_DEBUG_CHECK) {
ha_tokudb_check_info(thd, table, write_status_msg);
diff --git a/storage/tokudb/ha_tokudb_alter_56.cc b/storage/tokudb/ha_tokudb_alter_56.cc
index 2ef2e9590d7..15b8899b8bc 100644
--- a/storage/tokudb/ha_tokudb_alter_56.cc
+++ b/storage/tokudb/ha_tokudb_alter_56.cc
@@ -473,7 +473,7 @@ bool ha_tokudb::inplace_alter_table(TABLE *altered_table, Alter_inplace_info *ha
// Set the new compression
enum toku_compression_method method = row_type_to_compression_method(create_info->row_type);
- uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint32_t curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
for (uint32_t i = 0; i < curr_num_DBs; i++) {
db = share->key_file[i];
error = db->change_compression_method(db, method);
@@ -597,7 +597,7 @@ int ha_tokudb::alter_table_add_or_drop_column(TABLE *altered_table, Alter_inplac
uint32_t max_column_extra_size;
uint32_t num_column_extra;
uint32_t num_columns = 0;
- uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint32_t curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
uint32_t columns[table->s->fields + altered_table->s->fields]; // set size such that we know it is big enough for both cases
memset(columns, 0, sizeof(columns));
@@ -748,7 +748,7 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
restore_drop_indexes(table, index_drop_offsets, ha_alter_info->index_drop_count);
}
if (ctx->compression_changed) {
- uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint32_t curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
for (uint32_t i = 0; i < curr_num_DBs; i++) {
DB *db = share->key_file[i];
int error = db->change_compression_method(db, ctx->orig_compression_method);
@@ -773,7 +773,7 @@ int ha_tokudb::alter_table_expand_varchar_offsets(TABLE *altered_table, Alter_in
int error = 0;
tokudb_alter_ctx *ctx = static_cast<tokudb_alter_ctx *>(ha_alter_info->handler_ctx);
- uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint32_t curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
for (uint32_t i = 0; i < curr_num_DBs; i++) {
// change to a new descriptor
DBT row_descriptor; memset(&row_descriptor, 0, sizeof row_descriptor);
@@ -955,7 +955,7 @@ int ha_tokudb::alter_table_expand_one_column(TABLE *altered_table, Alter_inplace
assert(0);
}
- uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint32_t curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
for (uint32_t i = 0; i < curr_num_DBs; i++) {
// change to a new descriptor
DBT row_descriptor; memset(&row_descriptor, 0, sizeof row_descriptor);
@@ -1034,7 +1034,7 @@ int ha_tokudb::alter_table_expand_blobs(TABLE *altered_table, Alter_inplace_info
int error = 0;
tokudb_alter_ctx *ctx = static_cast<tokudb_alter_ctx *>(ha_alter_info->handler_ctx);
- uint32_t curr_num_DBs = table->s->keys + test(hidden_primary_key);
+ uint32_t curr_num_DBs = table->s->keys + tokudb_test(hidden_primary_key);
for (uint32_t i = 0; i < curr_num_DBs; i++) {
// change to a new descriptor
DBT row_descriptor; memset(&row_descriptor, 0, sizeof row_descriptor);
diff --git a/storage/tokudb/ha_tokudb_update.cc b/storage/tokudb/ha_tokudb_update.cc
index 94d687da67c..ffacf654c38 100644
--- a/storage/tokudb/ha_tokudb_update.cc
+++ b/storage/tokudb/ha_tokudb_update.cc
@@ -549,7 +549,7 @@ static bool is_strict_mode(THD *thd) {
#if 50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699
return thd->is_strict_mode();
#else
- return test(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
+ return tokudb_test(thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
#endif
}
@@ -837,7 +837,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
rw_rdlock(&share->num_DBs_lock);
- if (share->num_DBs > table->s->keys + test(hidden_primary_key)) { // hot index in progress
+ if (share->num_DBs > table->s->keys + tokudb_test(hidden_primary_key)) { // hot index in progress
error = ENOTSUP; // run on the slow path
} else {
// send the update message
@@ -990,7 +990,7 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite
rw_rdlock(&share->num_DBs_lock);
- if (share->num_DBs > table->s->keys + test(hidden_primary_key)) { // hot index in progress
+ if (share->num_DBs > table->s->keys + tokudb_test(hidden_primary_key)) { // hot index in progress
error = ENOTSUP; // run on the slow path
} else {
// send the upsert message
diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h
index 85d649eb9ca..ceeffd4fe00 100644
--- a/storage/tokudb/hatoku_defines.h
+++ b/storage/tokudb/hatoku_defines.h
@@ -484,4 +484,7 @@ static inline void tokudb_pthread_cond_broadcast(pthread_cond_t *cond) {
assert(r == 0);
}
+// mysql 5.6.15 removed the test macro, so we define our own
+#define tokudb_test(e) ((e) ? 1 : 0)
+
#endif