Commit b5865c67 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs #5725 support SBR and mixed logging. remove the tokudb_enable_fast_update/upsert variables

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@52231 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9f718b57
...@@ -157,7 +157,6 @@ static uint32_t blob_field_index(TABLE *table, KEY_AND_COL_INFO *kc_info, uint i ...@@ -157,7 +157,6 @@ static uint32_t blob_field_index(TABLE *table, KEY_AND_COL_INFO *kc_info, uint i
// Otherwise, an error is returned. // Otherwise, an error is returned.
int ha_tokudb::fast_update(THD *thd, List<Item> &update_fields, List<Item> &update_values, Item *conds) { int ha_tokudb::fast_update(THD *thd, List<Item> &update_fields, List<Item> &update_values, Item *conds) {
TOKUDB_DBUG_ENTER("ha_tokudb::fast_update"); TOKUDB_DBUG_ENTER("ha_tokudb::fast_update");
int error = 0; int error = 0;
unsigned line = 0; // debug unsigned line = 0; // debug
...@@ -285,7 +284,7 @@ static bool check_decr_floor_expression(Field *lhs_field, Item *item) { ...@@ -285,7 +284,7 @@ static bool check_decr_floor_expression(Field *lhs_field, Item *item) {
} }
// Check if lhs = rhs expression is simple. Return true if it is. // Check if lhs = rhs expression is simple. Return true if it is.
static bool check_simple_update_expression(Item *lhs_item, Item *rhs_item, TABLE *table) { static bool check_update_expression(Item *lhs_item, Item *rhs_item, TABLE *table) {
Field *lhs_field = find_field_by_name(table, lhs_item); Field *lhs_field = find_field_by_name(table, lhs_item);
if (lhs_field == NULL) if (lhs_field == NULL)
return false; return false;
...@@ -335,7 +334,7 @@ static bool check_all_update_expressions(List<Item> &fields, List<Item> &values, ...@@ -335,7 +334,7 @@ static bool check_all_update_expressions(List<Item> &fields, List<Item> &values,
Item *rhs_item = rhs_i++; Item *rhs_item = rhs_i++;
if (rhs_item == NULL) if (rhs_item == NULL)
assert(0); // can not happen assert(0); // can not happen
if (!check_simple_update_expression(lhs_item, rhs_item, table)) if (!check_update_expression(lhs_item, rhs_item, table))
return false; return false;
} }
return true; return true;
...@@ -458,10 +457,6 @@ static bool is_strict_mode(THD *thd) { ...@@ -458,10 +457,6 @@ static bool is_strict_mode(THD *thd) {
// Check if an update operation can be handled by this storage engine. Return true if it can. // Check if an update operation can be handled by this storage engine. Return true if it can.
bool ha_tokudb::check_fast_update(THD *thd, List<Item> &fields, List<Item> &values, Item *conds) { bool ha_tokudb::check_fast_update(THD *thd, List<Item> &fields, List<Item> &values, Item *conds) {
// fast updates disabled
if (!get_enable_fast_update(thd))
return false;
if (!transaction) if (!transaction)
return false; return false;
...@@ -474,7 +469,8 @@ bool ha_tokudb::check_fast_update(THD *thd, List<Item> &fields, List<Item> &valu ...@@ -474,7 +469,8 @@ bool ha_tokudb::check_fast_update(THD *thd, List<Item> &fields, List<Item> &valu
return false; return false;
// no binlog // no binlog
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open() &&
!(thd->variables.binlog_format == BINLOG_FORMAT_STMT || thd->variables.binlog_format == BINLOG_FORMAT_MIXED))
return false; return false;
// no clustering keys (need to broadcast an increment into the clustering keys since we are selecting with the primary key) // no clustering keys (need to broadcast an increment into the clustering keys since we are selecting with the primary key)
...@@ -513,7 +509,7 @@ static void marshall_blobs_descriptor(tokudb::buffer &b, TABLE *table, KEY_AND_C ...@@ -513,7 +509,7 @@ static void marshall_blobs_descriptor(tokudb::buffer &b, TABLE *table, KEY_AND_C
static inline uint32_t get_null_bit_position(uint32_t null_bit); static inline uint32_t get_null_bit_position(uint32_t null_bit);
// Marshall update operatins to a buffer. // Marshall update operatins to a buffer.
static void marshall_simple_update(tokudb::buffer &b, Item *lhs_item, Item *rhs_item, TABLE *table, TOKUDB_SHARE *share) { static void marshall_update(tokudb::buffer &b, Item *lhs_item, Item *rhs_item, TABLE *table, TOKUDB_SHARE *share) {
// figure out the update operation type (again) // figure out the update operation type (again)
Field *lhs_field = find_field_by_name(table, lhs_item); Field *lhs_field = find_field_by_name(table, lhs_item);
assert(lhs_field); // we found it before, so this should work assert(lhs_field); // we found it before, so this should work
...@@ -685,9 +681,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update ...@@ -685,9 +681,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
// construct the update message // construct the update message
tokudb::buffer update_message; tokudb::buffer update_message;
// update_message.append_uint32(UPDATE_OP_UPDATE_2); update_message.append_uint32(UPDATE_OP_UPDATE_2);
uint8_t operation = UPDATE_OP_UPDATE_2;
update_message.append(&operation, sizeof operation);
uint32_t num_updates = update_fields.elements; uint32_t num_updates = update_fields.elements;
uint num_varchars = 0, num_blobs = 0; uint num_varchars = 0, num_blobs = 0;
...@@ -724,7 +718,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update ...@@ -724,7 +718,7 @@ int ha_tokudb::send_update_message(List<Item> &update_fields, List<Item> &update
Item *rhs_item = rhs_i++; Item *rhs_item = rhs_i++;
if (rhs_item == NULL) if (rhs_item == NULL)
assert(0); // can not happen assert(0); // can not happen
marshall_simple_update(update_message, lhs_item, rhs_item, table, share); marshall_update(update_message, lhs_item, rhs_item, table, share);
} }
rw_rdlock(&share->num_DBs_lock); rw_rdlock(&share->num_DBs_lock);
...@@ -792,10 +786,6 @@ return_error: ...@@ -792,10 +786,6 @@ return_error:
// Check if an upsert can be handled by this storage engine. Return trus if it can. // Check if an upsert can be handled by this storage engine. Return trus if it can.
bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &update_values) { bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &update_values) {
// fast upserts disabled
if (!get_enable_fast_upsert(thd))
return false;
if (!transaction) if (!transaction)
return false; return false;
...@@ -806,10 +796,6 @@ bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &up ...@@ -806,10 +796,6 @@ bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &up
// no triggers // no triggers
if (table->triggers) if (table->triggers)
return false; return false;
// no binlog
if (mysql_bin_log.is_open())
return false;
// primary key must exist // primary key must exist
if (table->s->primary_key >= table->s->keys) if (table->s->primary_key >= table->s->keys)
...@@ -819,6 +805,11 @@ bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &up ...@@ -819,6 +805,11 @@ bool ha_tokudb::check_upsert(THD *thd, List<Item> &update_fields, List<Item> &up
if (table->s->keys > 1) if (table->s->keys > 1)
return false; return false;
// no binlog
if (mysql_bin_log.is_open() &&
!(thd->variables.binlog_format == BINLOG_FORMAT_STMT || thd->variables.binlog_format == BINLOG_FORMAT_MIXED))
return false;
if (!check_all_update_expressions(update_fields, update_values, table)) if (!check_all_update_expressions(update_fields, update_values, table))
return false; return false;
...@@ -843,9 +834,7 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite ...@@ -843,9 +834,7 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite
tokudb::buffer update_message; tokudb::buffer update_message;
// append the operation // append the operation
// update_message.append_uint32(UPDATE_OP_UPSERT_2); update_message.append_uint32(UPDATE_OP_UPSERT_2);
uint8_t operation = UPDATE_OP_UPSERT_2;
update_message.append(&operation, sizeof operation);
// append the row // append the row
update_message.append_uint32(row.size); update_message.append_uint32(row.size);
...@@ -886,7 +875,7 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite ...@@ -886,7 +875,7 @@ int ha_tokudb::send_upsert_message(THD *thd, List<Item> &update_fields, List<Ite
Item *rhs_item = rhs_i++; Item *rhs_item = rhs_i++;
if (rhs_item == NULL) if (rhs_item == NULL)
assert(0); // can not happen assert(0); // can not happen
marshall_simple_update(update_message, lhs_item, rhs_item, table, share); marshall_update(update_message, lhs_item, rhs_item, table, share);
} }
rw_rdlock(&share->num_DBs_lock); rw_rdlock(&share->num_DBs_lock);
......
...@@ -140,13 +140,6 @@ static MYSQL_THDVAR_UINT(read_buf_size, ...@@ -140,13 +140,6 @@ static MYSQL_THDVAR_UINT(read_buf_size,
1 // blocksize??? 1 // blocksize???
); );
#if TOKU_INCLUDE_UPSERT #if TOKU_INCLUDE_UPSERT
static MYSQL_THDVAR_BOOL(enable_fast_update,
PLUGIN_VAR_THDLOCAL,
"enable fast update",
NULL, // check
NULL, // update
true // default
);
static MYSQL_THDVAR_BOOL(disable_slow_update, static MYSQL_THDVAR_BOOL(disable_slow_update,
PLUGIN_VAR_THDLOCAL, PLUGIN_VAR_THDLOCAL,
"disable slow update", "disable slow update",
...@@ -154,13 +147,6 @@ static MYSQL_THDVAR_BOOL(disable_slow_update, ...@@ -154,13 +147,6 @@ static MYSQL_THDVAR_BOOL(disable_slow_update,
NULL, // update NULL, // update
false // default false // default
); );
static MYSQL_THDVAR_BOOL(enable_fast_upsert,
PLUGIN_VAR_THDLOCAL,
"enable fast upsert",
NULL, // check
NULL, // update
true // default
);
static MYSQL_THDVAR_BOOL(disable_slow_upsert, static MYSQL_THDVAR_BOOL(disable_slow_upsert,
PLUGIN_VAR_THDLOCAL, PLUGIN_VAR_THDLOCAL,
"disable slow upsert", "disable slow upsert",
...@@ -745,18 +731,10 @@ uint get_tokudb_read_buf_size(THD* thd) { ...@@ -745,18 +731,10 @@ uint get_tokudb_read_buf_size(THD* thd) {
} }
#if TOKU_INCLUDE_UPSERT #if TOKU_INCLUDE_UPSERT
bool get_enable_fast_update(THD* thd) {
return (THDVAR(thd, enable_fast_update) != 0);
}
bool get_disable_slow_update(THD* thd) { bool get_disable_slow_update(THD* thd) {
return (THDVAR(thd, disable_slow_update) != 0); return (THDVAR(thd, disable_slow_update) != 0);
} }
bool get_enable_fast_upsert(THD* thd) {
return (THDVAR(thd, enable_fast_upsert) != 0);
}
bool get_disable_slow_upsert(THD* thd) { bool get_disable_slow_upsert(THD* thd) {
return (THDVAR(thd, disable_slow_upsert) != 0); return (THDVAR(thd, disable_slow_upsert) != 0);
} }
...@@ -1958,9 +1936,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = { ...@@ -1958,9 +1936,7 @@ static struct st_mysql_sys_var *tokudb_system_variables[] = {
MYSQL_SYSVAR(read_buf_size), MYSQL_SYSVAR(read_buf_size),
MYSQL_SYSVAR(row_format), MYSQL_SYSVAR(row_format),
#if TOKU_INCLUDE_UPSERT #if TOKU_INCLUDE_UPSERT
MYSQL_SYSVAR(enable_fast_update),
MYSQL_SYSVAR(disable_slow_update), MYSQL_SYSVAR(disable_slow_update),
MYSQL_SYSVAR(enable_fast_upsert),
MYSQL_SYSVAR(disable_slow_upsert), MYSQL_SYSVAR(disable_slow_upsert),
#endif #endif
NULL NULL
......
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