Commit 528df9e2 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

refs #6026, merge fix to main from tokudb-engine.6026

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@53434 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4ecd9e7f
...@@ -300,7 +300,7 @@ ulong ha_tokudb::index_flags(uint idx, uint part, bool all_parts) const { ...@@ -300,7 +300,7 @@ ulong ha_tokudb::index_flags(uint idx, uint part, bool all_parts) const {
TOKUDB_DBUG_ENTER("ha_tokudb::index_flags"); TOKUDB_DBUG_ENTER("ha_tokudb::index_flags");
assert(table_share); assert(table_share);
ulong flags = (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE); ulong flags = (HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE);
#ifdef MARIADB_BASE_VERSION #if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
flags |= HA_DO_INDEX_COND_PUSHDOWN; flags |= HA_DO_INDEX_COND_PUSHDOWN;
#endif #endif
if (table_share->key_info[idx].flags & HA_CLUSTERING) { if (table_share->key_info[idx].flags & HA_CLUSTERING) {
...@@ -4914,13 +4914,21 @@ smart_dbt_bf_callback(DBT const *key, DBT const *row, void *context) { ...@@ -4914,13 +4914,21 @@ smart_dbt_bf_callback(DBT const *key, DBT const *row, void *context) {
return info->ha->fill_range_query_buf(info->need_val, key, row, info->direction, info->thd, info->buf); return info->ha->fill_range_query_buf(info->need_val, key, row, info->direction, info->thd, info->buf);
} }
#ifdef MARIADB_BASE_VERSION #if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
enum icp_result ha_tokudb::toku_handler_index_cond_check(Item* pushed_idx_cond) enum icp_result ha_tokudb::toku_handler_index_cond_check(Item* pushed_idx_cond)
{ {
enum icp_result res; enum icp_result res;
if (end_range && compare_key2(end_range) > 0) { if (end_range ) {
int cmp;
#ifdef MARIADB_BASE_VERSION
cmp = compare_key2(end_range);
#else
cmp = compare_key_icp(end_range);
#endif
if (cmp > 0) {
return ICP_OUT_OF_RANGE; return ICP_OUT_OF_RANGE;
} }
}
res = pushed_idx_cond->val_int() ? ICP_MATCH : ICP_NO_MATCH; res = pushed_idx_cond->val_int() ? ICP_MATCH : ICP_NO_MATCH;
return res; return res;
} }
...@@ -4944,13 +4952,13 @@ int ha_tokudb::fill_range_query_buf( ...@@ -4944,13 +4952,13 @@ int ha_tokudb::fill_range_query_buf(
uint32_t user_defined_size = get_tokudb_read_buf_size(thd); uint32_t user_defined_size = get_tokudb_read_buf_size(thd);
uchar* curr_pos = NULL; uchar* curr_pos = NULL;
#ifdef MARIADB_BASE_VERSION #if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
// if we have an index condition pushed down, we check it // if we have an index condition pushed down, we check it
if (toku_pushed_idx_cond && (tokudb_active_index == toku_pushed_idx_cond_keyno)) { if (toku_pushed_idx_cond && (tokudb_active_index == toku_pushed_idx_cond_keyno)) {
unpack_key(buf, key, tokudb_active_index); unpack_key(buf, key, tokudb_active_index);
enum icp_result result = toku_handler_index_cond_check(toku_pushed_idx_cond); enum icp_result result = toku_handler_index_cond_check(toku_pushed_idx_cond);
// If we have reason to stop, we set icp_went_out_of_range and get out // If we have reason to stop, we set icp_went_out_of_range and get out
if (result == ICP_ABORTED_BY_USER || result == ICP_OUT_OF_RANGE || thd_killed(thd)) { if (result == ICP_OUT_OF_RANGE || thd_killed(thd)) {
icp_went_out_of_range = true; icp_went_out_of_range = true;
error = 0; error = 0;
goto cleanup; goto cleanup;
...@@ -5286,7 +5294,7 @@ int ha_tokudb::index_read_last(uchar * buf, const uchar * key, uint key_len) { ...@@ -5286,7 +5294,7 @@ int ha_tokudb::index_read_last(uchar * buf, const uchar * key, uint key_len) {
// //
int ha_tokudb::index_prev(uchar * buf) { int ha_tokudb::index_prev(uchar * buf) {
TOKUDB_DBUG_ENTER("ha_tokudb::index_prev"); TOKUDB_DBUG_ENTER("ha_tokudb::index_prev");
ha_statistic_increment(&SSV::ha_read_next_count); ha_statistic_increment(&SSV::ha_read_prev_count);
int error = get_next(buf, -1); int error = get_next(buf, -1);
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
......
...@@ -721,7 +721,8 @@ private: ...@@ -721,7 +721,8 @@ private:
int __close(int mutex_is_locked); int __close(int mutex_is_locked);
int get_next(uchar* buf, int direction); int get_next(uchar* buf, int direction);
int read_data_from_range_query_buff(uchar* buf, bool need_val); int read_data_from_range_query_buff(uchar* buf, bool need_val);
#if defined(MARIADB_BASE_VERSION) // for ICP, only in MariaDB and MySQL 5.6
#if defined(MARIADB_BASE_VERSION) || (50600 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699)
enum icp_result toku_handler_index_cond_check(Item* pushed_idx_cond); enum icp_result toku_handler_index_cond_check(Item* pushed_idx_cond);
#endif #endif
void invalidate_bulk_fetch(); void invalidate_bulk_fetch();
......
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