Skip to content

Commit

Permalink
Merge Spider 3.2.18
Browse files Browse the repository at this point in the history
  • Loading branch information
Kentoku committed Feb 19, 2015
1 parent 865b83e commit cf3b51b
Show file tree
Hide file tree
Showing 20 changed files with 275 additions and 65 deletions.
5 changes: 5 additions & 0 deletions storage/spider/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_HANDLERSOCKET")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_HANDLERSOCKET")

IF(HAVE_WVLA)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla")
ENDIF()

SET(SPIDER_SOURCES
spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc
spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc
Expand Down
87 changes: 81 additions & 6 deletions storage/spider/ha_spider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#endif

#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
Expand All @@ -28,6 +27,9 @@
#include "probes_mysql.h"
#include "sql_class.h"
#include "key.h"
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
#include "sql_select.h"
#endif
#endif
#include "ha_partition.h"
#include "spd_param.h"
Expand Down Expand Up @@ -92,7 +94,7 @@ ha_spider::ha_spider(
mrr_key_buff = NULL;
#endif
append_tblnm_alias = NULL;
has_clone_for_merge = FALSE;
use_index_merge = FALSE;
is_clone = FALSE;
clone_bitmap_init = FALSE;
pt_clone_source_handler = NULL;
Expand Down Expand Up @@ -162,6 +164,7 @@ ha_spider::ha_spider(
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
result_list.in_cmp_ref = FALSE;
DBUG_VOID_RETURN;
}

Expand Down Expand Up @@ -199,7 +202,7 @@ ha_spider::ha_spider(
mrr_key_buff = NULL;
#endif
append_tblnm_alias = NULL;
has_clone_for_merge = FALSE;
use_index_merge = FALSE;
is_clone = FALSE;
clone_bitmap_init = FALSE;
pt_clone_source_handler = NULL;
Expand Down Expand Up @@ -269,6 +272,7 @@ ha_spider::ha_spider(
result_list.direct_distinct = FALSE;
result_list.casual_read = NULL;
result_list.use_both_key = FALSE;
result_list.in_cmp_ref = FALSE;
ref_length = sizeof(SPIDER_POSITION);
DBUG_VOID_RETURN;
}
Expand Down Expand Up @@ -300,7 +304,7 @@ handler *ha_spider::clone(
HA_OPEN_IGNORE_IF_LOCKED))
DBUG_RETURN(NULL);
spider->sync_from_clone_source_base(this);
has_clone_for_merge = TRUE;
use_index_merge = TRUE;

DBUG_RETURN((handler *) spider);
}
Expand Down Expand Up @@ -1735,7 +1739,8 @@ int ha_spider::reset()
result_list.use_both_key = FALSE;
pt_clone_last_searcher = NULL;
conn_kinds = SPIDER_CONN_KIND_MYSQL;
has_clone_for_merge = FALSE;
use_index_merge = FALSE;
init_rnd_handler = FALSE;
while (condition)
{
tmp_cond = condition->next;
Expand Down Expand Up @@ -1853,6 +1858,35 @@ int ha_spider::extra(
if (!(trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
DBUG_RETURN(error_num);
break;
#endif
#ifdef HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF
case HA_EXTRA_USE_CMP_REF:
DBUG_PRINT("info",("spider HA_EXTRA_USE_CMP_REF"));
if (table_share->primary_key != MAX_KEY)
{
DBUG_PRINT("info",("spider need primary key columns"));
KEY *key_info = &table->key_info[table->s->primary_key];
KEY_PART_INFO *key_part;
uint part_num;
for (
key_part = key_info->key_part, part_num = 0;
part_num < spider_user_defined_key_parts(key_info);
key_part++, part_num++
) {
spider_set_bit(searched_bitmap, key_part->field->field_index);
}
} else {
DBUG_PRINT("info",("spider need all columns"));
Field **field;
for (
field = table->field;
*field;
field++
) {
spider_set_bit(searched_bitmap, (*field)->field_index);
}
}
break;
#endif
default:
break;
Expand Down Expand Up @@ -4437,6 +4471,7 @@ int ha_spider::read_multi_range_first_internal(
result_list.keyread = TRUE;
else
result_list.keyread = FALSE;
mrr_with_cnt = FALSE;
if (
(error_num = spider_db_append_select(this)) ||
(error_num = spider_db_append_select_columns(this))
Expand Down Expand Up @@ -7649,6 +7684,7 @@ int ha_spider::cmp_ref(
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider ref1=%p", ref1));
DBUG_PRINT("info",("spider ref2=%p", ref2));
result_list.in_cmp_ref = TRUE;
if (table_share->primary_key < MAX_KEY)
{
uchar table_key[MAX_KEY_LENGTH];
Expand Down Expand Up @@ -7680,6 +7716,7 @@ int ha_spider::cmp_ref(
}
}
}
result_list.in_cmp_ref = FALSE;
DBUG_PRINT("info",("spider ret=%d", ret));
DBUG_RETURN(ret);
}
Expand Down Expand Up @@ -8685,7 +8722,7 @@ ha_rows ha_spider::records_in_range(
key_part_map end_key_part_map;
key_part_map tgt_key_part_map;
KEY_PART_INFO *key_part;
Field *field;
Field *field = NULL;
double rows = (double) share->records;
double weight, rate;
DBUG_PRINT("info",("spider rows1=%f", rows));
Expand Down Expand Up @@ -10967,7 +11004,11 @@ bool ha_spider::is_crashed() const
DBUG_RETURN(FALSE);
}

#ifdef SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
bool ha_spider::auto_repair(int error) const
#else
bool ha_spider::auto_repair() const
#endif
{
DBUG_ENTER("ha_spider::auto_repair");
DBUG_PRINT("info",("spider this=%p", this));
Expand Down Expand Up @@ -11452,6 +11493,16 @@ TABLE *ha_spider::get_table()
DBUG_RETURN(table);
}

TABLE *ha_spider::get_top_table()
{
DBUG_ENTER("ha_spider::get_top_table");
#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
if (set_top_table_fields)
DBUG_RETURN(top_table);
#endif
DBUG_RETURN(table);
}

void ha_spider::set_ft_discard_bitmap()
{
DBUG_ENTER("ha_spider::set_ft_discard_bitmap");
Expand Down Expand Up @@ -13819,6 +13870,18 @@ int ha_spider::append_key_order_for_merge_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_for_merge_with_alias_sql_part");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (result_list.direct_aggregate)
{
st_select_lex *select_lex = spider_get_select_lex(this);
ORDER *group = (ORDER *) select_lex->group_list.first;
if (!group && *(select_lex->join->sum_funcs))
{
DBUG_PRINT("info",("spider skip order by"));
DBUG_RETURN(0);
}
}
#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
Expand Down Expand Up @@ -13868,6 +13931,18 @@ int ha_spider::append_key_order_with_alias_sql_part(
uint roop_count, dbton_id;
spider_db_handler *dbton_hdl;
DBUG_ENTER("ha_spider::append_key_order_with_alias_sql_part");
#ifdef HANDLER_HAS_DIRECT_AGGREGATE
if (result_list.direct_aggregate)
{
st_select_lex *select_lex = spider_get_select_lex(this);
ORDER *group = (ORDER *) select_lex->group_list.first;
if (!group && *(select_lex->join->sum_funcs))
{
DBUG_PRINT("info",("spider skip order by"));
DBUG_RETURN(0);
}
}
#endif
for (roop_count = 0; roop_count < share->use_sql_dbton_count; roop_count++)
{
dbton_id = share->use_sql_dbton_ids[roop_count];
Expand Down
7 changes: 6 additions & 1 deletion storage/spider/ha_spider.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class ha_spider: public handler
bool clone_bitmap_init;
ha_spider *pt_clone_source_handler;
ha_spider *pt_clone_last_searcher;
bool has_clone_for_merge;
bool use_index_merge;

bool init_index_handler;
bool init_rnd_handler;
Expand Down Expand Up @@ -682,7 +682,11 @@ class ha_spider: public handler
const char *name
);
bool is_crashed() const;
#ifdef SPIDER_HANDLER_AUTO_REPAIR_HAS_ERROR
bool auto_repair(int error) const;
#else
bool auto_repair() const;
#endif
int disable_indexes(
uint mode
);
Expand Down Expand Up @@ -730,6 +734,7 @@ class ha_spider: public handler
void return_record_by_parent();
#endif
TABLE *get_table();
TABLE *get_top_table();
void set_ft_discard_bitmap();
void set_searched_bitmap();
void set_clone_searched_bitmap();
Expand Down
1 change: 0 additions & 1 deletion storage/spider/spd_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
Expand Down
1 change: 0 additions & 1 deletion storage/spider/spd_copy_tables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

#define MYSQL_SERVER 1
#include <my_global.h>
#include "mysql_version.h"
#if MYSQL_VERSION_ID < 50500
#include "mysql_priv.h"
Expand Down
Loading

0 comments on commit cf3b51b

Please sign in to comment.