Commit 3b117933 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2514], this fix is not ready yet, undo it

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@20017 c7de825b-a66e-492c-adef-691d508d4ae1
parent 94f531a2
...@@ -281,8 +281,8 @@ static inline bool is_replace_into(THD* thd) { ...@@ -281,8 +281,8 @@ static inline bool is_replace_into(THD* thd) {
static inline bool do_ignore_flag_optimization(THD* thd, TABLE* table, bool opt_eligible) { static inline bool do_ignore_flag_optimization(THD* thd, TABLE* table, bool opt_eligible) {
uint pk_insert_mode = get_pk_insert_mode(thd); uint pk_insert_mode = get_pk_insert_mode(thd);
return ( return (
(is_replace_into(thd) || is_insert_ignore(thd)) &&
opt_eligible && opt_eligible &&
is_insert_ignore(thd) &&
((!table->triggers && pk_insert_mode < 2) || pk_insert_mode == 0) ((!table->triggers && pk_insert_mode < 2) || pk_insert_mode == 0)
); );
} }
...@@ -1131,7 +1131,6 @@ ha_tokudb::ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg):handler(hton, t ...@@ -1131,7 +1131,6 @@ ha_tokudb::ha_tokudb(handlerton * hton, TABLE_SHARE * table_arg):handler(hton, t
deleted_rows = 0; deleted_rows = 0;
last_dup_key = UINT_MAX; last_dup_key = UINT_MAX;
using_ignore = 0; using_ignore = 0;
write_can_replace = 0;
last_cursor_error = 0; last_cursor_error = 0;
range_lock_grabbed = false; range_lock_grabbed = false;
blob_buff = NULL; blob_buff = NULL;
...@@ -3312,11 +3311,15 @@ void ha_tokudb::set_main_dict_put_flags(THD* thd, u_int32_t* put_flags) { ...@@ -3312,11 +3311,15 @@ void ha_tokudb::set_main_dict_put_flags(THD* thd, u_int32_t* put_flags) {
{ {
*put_flags = DB_YESOVERWRITE; *put_flags = DB_YESOVERWRITE;
} }
else if (share->replace_into_fast && write_can_replace) else if (do_ignore_flag_optimization(thd,table,share->replace_into_fast) &&
is_replace_into(thd)
)
{ {
*put_flags = DB_YESOVERWRITE; *put_flags = DB_YESOVERWRITE;
} }
else if (do_ignore_flag_optimization(thd,table,share->replace_into_fast)) else if (do_ignore_flag_optimization(thd,table,share->replace_into_fast) &&
is_insert_ignore(thd)
)
{ {
*put_flags = DB_NOOVERWRITE_NO_ERROR; *put_flags = DB_NOOVERWRITE_NO_ERROR;
} }
...@@ -3359,6 +3362,7 @@ cleanup: ...@@ -3359,6 +3362,7 @@ cleanup:
int ha_tokudb::insert_rows_to_dictionaries_mult(DBT* pk_key, DBT* pk_val, DB_TXN* txn, THD* thd) { int ha_tokudb::insert_rows_to_dictionaries_mult(DBT* pk_key, DBT* pk_val, DB_TXN* txn, THD* thd) {
int error = 0; int error = 0;
bool is_replace = is_replace_into(thd);
uint curr_num_DBs = table->s->keys + test(hidden_primary_key); uint curr_num_DBs = table->s->keys + test(hidden_primary_key);
ulonglong wait_lock_time = get_write_lock_wait_time(thd); ulonglong wait_lock_time = get_write_lock_wait_time(thd);
u_int32_t mult_put_flags[MAX_KEY + 1] = {DB_YESOVERWRITE}; u_int32_t mult_put_flags[MAX_KEY + 1] = {DB_YESOVERWRITE};
...@@ -3473,11 +3477,7 @@ int ha_tokudb::write_row(uchar * record) { ...@@ -3473,11 +3477,7 @@ int ha_tokudb::write_row(uchar * record) {
goto cleanup; goto cleanup;
} }
create_sub_trans = ( create_sub_trans = (using_ignore && !(do_ignore_flag_optimization(thd,table,share->replace_into_fast)));
using_ignore &&
!(do_ignore_flag_optimization(thd,table,share->replace_into_fast)) &&
!(share->replace_into_fast && write_can_replace)
);
if (create_sub_trans) { if (create_sub_trans) {
error = db_env->txn_begin(db_env, transaction, &sub_trans, DB_INHERIT_ISOLATION); error = db_env->txn_begin(db_env, transaction, &sub_trans, DB_INHERIT_ISOLATION);
if (error) { if (error) {
...@@ -5090,12 +5090,6 @@ int ha_tokudb::extra(enum ha_extra_function operation) { ...@@ -5090,12 +5090,6 @@ int ha_tokudb::extra(enum ha_extra_function operation) {
case HA_EXTRA_NO_IGNORE_DUP_KEY: case HA_EXTRA_NO_IGNORE_DUP_KEY:
using_ignore = 0; using_ignore = 0;
break; break;
case HA_EXTRA_WRITE_CAN_REPLACE:
write_can_replace = 1;
break;
case HA_EXTRA_WRITE_CANNOT_REPLACE:
write_can_replace = 0;
break;
default: default:
break; break;
} }
...@@ -5106,7 +5100,6 @@ int ha_tokudb::reset(void) { ...@@ -5106,7 +5100,6 @@ int ha_tokudb::reset(void) {
TOKUDB_DBUG_ENTER("ha_tokudb::reset"); TOKUDB_DBUG_ENTER("ha_tokudb::reset");
key_read = 0; key_read = 0;
using_ignore = 0; using_ignore = 0;
write_can_replace = 0;
TOKUDB_DBUG_RETURN(0); TOKUDB_DBUG_RETURN(0);
} }
......
...@@ -220,7 +220,7 @@ private: ...@@ -220,7 +220,7 @@ private:
// if non-zero (not necessarily 1), primary key is hidden // if non-zero (not necessarily 1), primary key is hidden
// //
uint hidden_primary_key; uint hidden_primary_key;
bool key_read, using_ignore, write_can_replace; bool key_read, using_ignore;
// //
// After a cursor encounters an error, the cursor will be unusable // After a cursor encounters an error, the cursor will be unusable
......
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