Skip to content

Commit 3e206a5

Browse files
committed
Merge branch 'kentoku/10.0' into 10.0
2 parents 6b4cc43 + 14eea2f commit 3e206a5

23 files changed

+1462
-286
lines changed

storage/spider/ha_spider.cc

Lines changed: 150 additions & 1 deletion
Large diffs are not rendered by default.

storage/spider/ha_spider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2008-2014 Kentoku Shiba
1+
/* Copyright (C) 2008-2015 Kentoku Shiba
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -738,6 +738,7 @@ class ha_spider: public handler
738738
void set_ft_discard_bitmap();
739739
void set_searched_bitmap();
740740
void set_clone_searched_bitmap();
741+
void set_searched_bitmap_from_item_list();
741742
void set_select_column_mode();
742743
#ifdef WITH_PARTITION_STORAGE_ENGINE
743744
void check_select_column(bool rnd);

storage/spider/spd_conn.cc

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2008-2014 Kentoku Shiba
1+
/* Copyright (C) 2008-2015 Kentoku Shiba
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -662,6 +662,7 @@ SPIDER_CONN *spider_create_conn(
662662

663663
spider_conn_queue_connect(share, conn, link_idx);
664664
conn->ping_time = (time_t) time((time_t*) 0);
665+
conn->connect_error_time = conn->ping_time;
665666
pthread_mutex_lock(&spider_conn_id_mutex);
666667
conn->conn_id = spider_conn_id;
667668
++spider_conn_id;
@@ -1085,6 +1086,17 @@ SPIDER_CONN *spider_get_conn(
10851086
}
10861087
conn->link_idx = base_link_idx;
10871088

1089+
if (conn->queued_connect)
1090+
spider_conn_queue_connect_rewrite(share, conn, link_idx);
1091+
1092+
if (conn->queued_ping)
1093+
{
1094+
if (spider)
1095+
spider_conn_queue_ping_rewrite(spider, conn, base_link_idx);
1096+
else
1097+
conn->queued_ping = FALSE;
1098+
}
1099+
10881100
DBUG_PRINT("info",("spider conn=%p", conn));
10891101
DBUG_RETURN(conn);
10901102

@@ -1195,8 +1207,10 @@ void spider_conn_queue_connect(
11951207
DBUG_ENTER("spider_conn_queue_connect");
11961208
DBUG_PRINT("info", ("spider conn=%p", conn));
11971209
conn->queued_connect = TRUE;
1210+
/*
11981211
conn->queued_connect_share = share;
11991212
conn->queued_connect_link_idx = link_idx;
1213+
*/
12001214
DBUG_VOID_RETURN;
12011215
}
12021216

@@ -1225,6 +1239,18 @@ void spider_conn_queue_ping(
12251239
DBUG_VOID_RETURN;
12261240
}
12271241

1242+
void spider_conn_queue_ping_rewrite(
1243+
ha_spider *spider,
1244+
SPIDER_CONN *conn,
1245+
int link_idx
1246+
) {
1247+
DBUG_ENTER("spider_conn_queue_ping_rewrite");
1248+
DBUG_PRINT("info", ("spider conn=%p", conn));
1249+
conn->queued_ping_spider = spider;
1250+
conn->queued_ping_link_idx = link_idx;
1251+
DBUG_VOID_RETURN;
1252+
}
1253+
12281254
void spider_conn_queue_trx_isolation(
12291255
SPIDER_CONN *conn,
12301256
int trx_isolation
@@ -1285,6 +1311,7 @@ void spider_conn_queue_start_transaction(
12851311
) {
12861312
DBUG_ENTER("spider_conn_queue_start_transaction");
12871313
DBUG_PRINT("info", ("spider conn=%p", conn));
1314+
DBUG_ASSERT(!conn->trx_start);
12881315
conn->queued_trx_start = TRUE;
12891316
conn->trx_start = TRUE;
12901317
DBUG_VOID_RETURN;
@@ -1325,7 +1352,11 @@ void spider_conn_clear_queue_at_commit(
13251352
) {
13261353
DBUG_ENTER("spider_conn_clear_queue_at_commit");
13271354
DBUG_PRINT("info", ("spider conn=%p", conn));
1328-
conn->queued_trx_start = FALSE;
1355+
if (conn->queued_trx_start)
1356+
{
1357+
conn->queued_trx_start = FALSE;
1358+
conn->trx_start = FALSE;
1359+
}
13291360
conn->queued_xa_start = FALSE;
13301361
DBUG_VOID_RETURN;
13311362
}
@@ -2280,6 +2311,13 @@ void *spider_bg_conn_action(
22802311
thd->clear_error();
22812312
pthread_cond_wait(&conn->bg_conn_cond, &conn->bg_conn_mutex);
22822313
DBUG_PRINT("info",("spider bg roop start"));
2314+
#ifndef DBUG_OFF
2315+
DBUG_PRINT("info",("spider conn->thd=%p", conn->thd));
2316+
if (conn->thd)
2317+
{
2318+
DBUG_PRINT("info",("spider query_id=%lld", conn->thd->query_id));
2319+
}
2320+
#endif
22832321
if (conn->bg_caller_sync_wait)
22842322
{
22852323
pthread_mutex_lock(&conn->bg_conn_sync_mutex);
@@ -2925,6 +2963,7 @@ void *spider_bg_sts_action(
29252963
0,
29262964
share->monitoring_kind[spider.search_link_idx],
29272965
share->monitoring_limit[spider.search_link_idx],
2966+
share->monitoring_flag[spider.search_link_idx],
29282967
TRUE
29292968
);
29302969
lex_end(thd->lex);
@@ -2934,6 +2973,7 @@ void *spider_bg_sts_action(
29342973
}
29352974
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
29362975
{
2976+
DBUG_ASSERT(!conns[spider.search_link_idx]->thd);
29372977
#ifdef WITH_PARTITION_STORAGE_ENGINE
29382978
if (spider_get_sts(share, spider.search_link_idx,
29392979
share->bg_sts_try_time, &spider,
@@ -2965,6 +3005,7 @@ void *spider_bg_sts_action(
29653005
0,
29663006
share->monitoring_kind[spider.search_link_idx],
29673007
share->monitoring_limit[spider.search_link_idx],
3008+
share->monitoring_flag[spider.search_link_idx],
29683009
TRUE
29693010
);
29703011
lex_end(thd->lex);
@@ -3317,6 +3358,7 @@ void *spider_bg_crd_action(
33173358
0,
33183359
share->monitoring_kind[spider.search_link_idx],
33193360
share->monitoring_limit[spider.search_link_idx],
3361+
share->monitoring_flag[spider.search_link_idx],
33203362
TRUE
33213363
);
33223364
lex_end(thd->lex);
@@ -3326,6 +3368,7 @@ void *spider_bg_crd_action(
33263368
}
33273369
if (spider.search_link_idx != -1 && conns[spider.search_link_idx])
33283370
{
3371+
DBUG_ASSERT(!conns[spider.search_link_idx]->thd);
33293372
#ifdef WITH_PARTITION_STORAGE_ENGINE
33303373
if (spider_get_crd(share, spider.search_link_idx,
33313374
share->bg_crd_try_time, &spider, &table,
@@ -3357,6 +3400,7 @@ void *spider_bg_crd_action(
33573400
0,
33583401
share->monitoring_kind[spider.search_link_idx],
33593402
share->monitoring_limit[spider.search_link_idx],
3403+
share->monitoring_flag[spider.search_link_idx],
33603404
TRUE
33613405
);
33623406
lex_end(thd->lex);
@@ -3714,6 +3758,7 @@ void *spider_bg_mon_action(
37143758
0,
37153759
share->monitoring_bg_kind[link_idx],
37163760
share->monitoring_limit[link_idx],
3761+
share->monitoring_bg_flag[link_idx],
37173762
TRUE
37183763
);
37193764
lex_end(thd->lex);

storage/spider/spd_conn.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ void spider_conn_queue_ping(
100100
int link_idx
101101
);
102102

103+
void spider_conn_queue_ping_rewrite(
104+
ha_spider *spider,
105+
SPIDER_CONN *conn,
106+
int link_idx
107+
);
108+
103109
void spider_conn_queue_trx_isolation(
104110
SPIDER_CONN *conn,
105111
int trx_isolation

storage/spider/spd_copy_tables.cc

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,36 +1032,47 @@ long long spider_copy_tables_body(
10321032
else
10331033
copy_tables->access_charset = system_charset_info;
10341034

1035-
src_tbl_conn = copy_tables->table_conn[0];
1036-
select_ct = src_tbl_conn->copy_table;
1037-
src_tbl_conn->share->access_charset = copy_tables->access_charset;
1038-
select_ct->set_sql_charset(copy_tables->access_charset);
1039-
if (
1040-
select_ct->append_select_str() ||
1041-
select_ct->append_table_columns(table_share)
1042-
) {
1043-
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1044-
goto error;
1045-
}
1035+
bulk_insert_rows = spider_param_udf_ct_bulk_insert_rows(
1036+
copy_tables->bulk_insert_rows);
1037+
for (src_tbl_conn = copy_tables->table_conn[0]; src_tbl_conn;
1038+
src_tbl_conn = src_tbl_conn->next)
1039+
{
1040+
select_ct = src_tbl_conn->copy_table;
1041+
src_tbl_conn->share->access_charset = copy_tables->access_charset;
1042+
select_ct->set_sql_charset(copy_tables->access_charset);
1043+
if (
1044+
select_ct->append_select_str() ||
1045+
select_ct->append_table_columns(table_share)
1046+
) {
1047+
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1048+
goto error;
1049+
}
10461050

1047-
if (
1048-
select_ct->append_from_str() ||
1049-
select_ct->append_table_name(0)
1050-
) {
1051-
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1052-
goto error;
1053-
}
1051+
if (
1052+
select_ct->append_from_str() ||
1053+
select_ct->append_table_name(0)
1054+
) {
1055+
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1056+
goto error;
1057+
}
10541058

1055-
select_ct->set_sql_pos();
1059+
select_ct->set_sql_pos();
10561060

1057-
bulk_insert_rows = spider_param_udf_ct_bulk_insert_rows(
1058-
copy_tables->bulk_insert_rows);
1059-
if (
1060-
select_ct->append_key_order_str(key_info, 0, FALSE) ||
1061-
select_ct->append_limit(0, bulk_insert_rows)
1062-
) {
1063-
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1064-
goto error;
1061+
if (
1062+
select_ct->append_key_order_str(key_info, 0, FALSE) ||
1063+
select_ct->append_limit(0, bulk_insert_rows)
1064+
) {
1065+
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1066+
goto error;
1067+
}
1068+
1069+
if (
1070+
copy_tables->use_transaction &&
1071+
select_ct->append_select_lock_str(SPIDER_LOCK_MODE_SHARED)
1072+
) {
1073+
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1074+
goto error;
1075+
}
10651076
}
10661077

10671078
for (dst_tbl_conn = copy_tables->table_conn[1]; dst_tbl_conn;
@@ -1188,14 +1199,6 @@ long long spider_copy_tables_body(
11881199
table_conn->spider = tmp_spider;
11891200
}
11901201

1191-
if (
1192-
copy_tables->use_transaction &&
1193-
select_ct->append_select_lock_str(SPIDER_LOCK_MODE_SHARED)
1194-
) {
1195-
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
1196-
goto error;
1197-
}
1198-
11991202
if ((error_num = spider_db_udf_copy_tables(copy_tables, spider, table,
12001203
bulk_insert_rows)))
12011204
goto error_db_udf_copy_tables;

0 commit comments

Comments
 (0)