Commit 0ba97e4d authored by Yuchen Pei's avatar Yuchen Pei

MDEV-31788 Factor out calls to spider_ping_table_mon_from_table in ha_spider.cc

parent 9e157978
...@@ -1387,6 +1387,58 @@ int ha_spider::index_end() ...@@ -1387,6 +1387,58 @@ int ha_spider::index_end()
DBUG_RETURN(0); DBUG_RETURN(0);
} }
static int spider_maybe_ping(ha_spider *spider, int link_idx, int error_num)
{
if (
spider->share->monitoring_kind[link_idx] &&
spider->need_mons[link_idx]
) {
error_num = spider_ping_table_mon_from_table(
spider->wide_handler->trx,
spider->wide_handler->trx->thd,
spider->share,
link_idx,
(uint32) spider->share->monitoring_sid[link_idx],
spider->share->table_name,
spider->share->table_name_length,
spider->conn_link_idx[link_idx],
NULL,
0,
spider->share->monitoring_kind[link_idx],
spider->share->monitoring_limit[link_idx],
spider->share->monitoring_flag[link_idx],
TRUE
);
}
return spider->check_error_mode_eof(error_num);
}
static int spider_maybe_ping_1(ha_spider *spider,
int link_idx, int error_num)
{
if (
spider->share->monitoring_kind[link_idx] &&
spider->need_mons[link_idx]
) {
error_num = spider_ping_table_mon_from_table(
spider->wide_handler->trx,
spider->wide_handler->trx->thd,
spider->share,
link_idx,
(uint32) spider->share->monitoring_sid[link_idx],
spider->share->table_name,
spider->share->table_name_length,
spider->conn_link_idx[link_idx],
NULL,
0,
spider->share->monitoring_kind[link_idx],
spider->share->monitoring_limit[link_idx],
spider->share->monitoring_flag[link_idx],
TRUE
);
}
return error_num;
}
int ha_spider::index_read_map_internal( int ha_spider::index_read_map_internal(
uchar *buf, uchar *buf,
...@@ -1552,26 +1604,9 @@ int ha_spider::index_read_map_internal( ...@@ -1552,26 +1604,9 @@ int ha_spider::index_read_map_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -1596,28 +1631,7 @@ int ha_spider::index_read_map_internal( ...@@ -1596,28 +1631,7 @@ int ha_spider::index_read_map_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -1628,28 +1642,7 @@ int ha_spider::index_read_map_internal( ...@@ -1628,28 +1642,7 @@ int ha_spider::index_read_map_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -1657,26 +1650,9 @@ int ha_spider::index_read_map_internal( ...@@ -1657,26 +1650,9 @@ int ha_spider::index_read_map_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -1894,26 +1870,9 @@ int ha_spider::index_read_last_map_internal( ...@@ -1894,26 +1870,9 @@ int ha_spider::index_read_last_map_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -1938,28 +1897,7 @@ int ha_spider::index_read_last_map_internal( ...@@ -1938,28 +1897,7 @@ int ha_spider::index_read_last_map_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -1970,28 +1908,7 @@ int ha_spider::index_read_last_map_internal( ...@@ -1970,28 +1908,7 @@ int ha_spider::index_read_last_map_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -1999,26 +1916,9 @@ int ha_spider::index_read_last_map_internal( ...@@ -1999,26 +1916,9 @@ int ha_spider::index_read_last_map_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -2285,26 +2185,9 @@ int ha_spider::index_first_internal( ...@@ -2285,26 +2185,9 @@ int ha_spider::index_first_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -2330,28 +2213,7 @@ int ha_spider::index_first_internal( ...@@ -2330,28 +2213,7 @@ int ha_spider::index_first_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -2362,28 +2224,7 @@ int ha_spider::index_first_internal( ...@@ -2362,28 +2224,7 @@ int ha_spider::index_first_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -2391,26 +2232,9 @@ int ha_spider::index_first_internal( ...@@ -2391,26 +2232,9 @@ int ha_spider::index_first_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -2624,26 +2448,9 @@ int ha_spider::index_last_internal( ...@@ -2624,26 +2448,9 @@ int ha_spider::index_last_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -2669,28 +2476,7 @@ int ha_spider::index_last_internal( ...@@ -2669,28 +2476,7 @@ int ha_spider::index_last_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -2701,28 +2487,7 @@ int ha_spider::index_last_internal( ...@@ -2701,28 +2487,7 @@ int ha_spider::index_last_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -2730,26 +2495,9 @@ int ha_spider::index_last_internal( ...@@ -2730,26 +2495,9 @@ int ha_spider::index_last_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -3006,26 +2754,9 @@ int ha_spider::read_range_first_internal( ...@@ -3006,26 +2754,9 @@ int ha_spider::read_range_first_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -3050,28 +2781,7 @@ int ha_spider::read_range_first_internal( ...@@ -3050,28 +2781,7 @@ int ha_spider::read_range_first_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -3082,28 +2792,7 @@ int ha_spider::read_range_first_internal( ...@@ -3082,28 +2792,7 @@ int ha_spider::read_range_first_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -3111,26 +2800,9 @@ int ha_spider::read_range_first_internal( ...@@ -3111,26 +2800,9 @@ int ha_spider::read_range_first_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -3587,26 +3259,9 @@ int ha_spider::read_multi_range_first_internal( ...@@ -3587,26 +3259,9 @@ int ha_spider::read_multi_range_first_internal(
TRUE, FALSE, (roop_count != link_ok)); TRUE, FALSE, (roop_count != link_ok));
if ( if (
error_num && error_num &&
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
} else { } else {
#endif #endif
...@@ -3630,27 +3285,7 @@ int ha_spider::read_multi_range_first_internal( ...@@ -3630,27 +3285,7 @@ int ha_spider::read_multi_range_first_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
} }
if (!error_num) if (!error_num)
{ {
...@@ -3663,27 +3298,7 @@ int ha_spider::read_multi_range_first_internal( ...@@ -3663,27 +3298,7 @@ int ha_spider::read_multi_range_first_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
} }
} }
if (!error_num) if (!error_num)
...@@ -3694,26 +3309,9 @@ int ha_spider::read_multi_range_first_internal( ...@@ -3694,26 +3309,9 @@ int ha_spider::read_multi_range_first_internal(
error_num = spider_unlock_after_query_2(conn, this, roop_count, table); error_num = spider_unlock_after_query_2(conn, this, roop_count, table);
if ( if (
error_num && error_num &&
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
result_link_idx = link_ok; result_link_idx = link_ok;
} else { } else {
...@@ -4322,26 +3920,9 @@ int ha_spider::read_multi_range_first_internal( ...@@ -4322,26 +3920,9 @@ int ha_spider::read_multi_range_first_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
break; break;
} }
...@@ -4368,27 +3949,7 @@ int ha_spider::read_multi_range_first_internal( ...@@ -4368,27 +3949,7 @@ int ha_spider::read_multi_range_first_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
break; break;
} }
if ( if (
...@@ -4407,27 +3968,7 @@ int ha_spider::read_multi_range_first_internal( ...@@ -4407,27 +3968,7 @@ int ha_spider::read_multi_range_first_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
break; break;
} }
spider_db_discard_multiple_result(this, roop_count, conn); spider_db_discard_multiple_result(this, roop_count, conn);
...@@ -4441,27 +3982,7 @@ int ha_spider::read_multi_range_first_internal( ...@@ -4441,27 +3982,7 @@ int ha_spider::read_multi_range_first_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
break; break;
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
...@@ -4470,26 +3991,9 @@ int ha_spider::read_multi_range_first_internal( ...@@ -4470,26 +3991,9 @@ int ha_spider::read_multi_range_first_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
break; break;
} }
...@@ -4916,26 +4420,9 @@ int ha_spider::read_multi_range_next( ...@@ -4916,26 +4420,9 @@ int ha_spider::read_multi_range_next(
TRUE, FALSE, (roop_count != link_ok)); TRUE, FALSE, (roop_count != link_ok));
if ( if (
error_num && error_num &&
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
} else { } else {
#endif #endif
...@@ -4959,27 +4446,7 @@ int ha_spider::read_multi_range_next( ...@@ -4959,27 +4446,7 @@ int ha_spider::read_multi_range_next(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
} }
if (!error_num) if (!error_num)
{ {
...@@ -4992,27 +4459,7 @@ int ha_spider::read_multi_range_next( ...@@ -4992,27 +4459,7 @@ int ha_spider::read_multi_range_next(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
} }
} }
if (!error_num) if (!error_num)
...@@ -5023,26 +4470,9 @@ int ha_spider::read_multi_range_next( ...@@ -5023,26 +4470,9 @@ int ha_spider::read_multi_range_next(
error_num = spider_unlock_after_query_2(conn, this, roop_count, table); error_num = spider_unlock_after_query_2(conn, this, roop_count, table);
if ( if (
error_num && error_num &&
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
result_link_idx = link_ok; result_link_idx = link_ok;
} else { } else {
...@@ -5650,26 +5080,9 @@ int ha_spider::read_multi_range_next( ...@@ -5650,26 +5080,9 @@ int ha_spider::read_multi_range_next(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, roop_count, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
break; break;
} }
...@@ -5696,27 +5109,7 @@ int ha_spider::read_multi_range_next( ...@@ -5696,27 +5109,7 @@ int ha_spider::read_multi_range_next(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
break; break;
} }
if ( if (
...@@ -5735,27 +5128,7 @@ int ha_spider::read_multi_range_next( ...@@ -5735,27 +5128,7 @@ int ha_spider::read_multi_range_next(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
break; break;
} }
spider_db_discard_multiple_result(this, roop_count, conn); spider_db_discard_multiple_result(this, roop_count, conn);
...@@ -5769,27 +5142,7 @@ int ha_spider::read_multi_range_next( ...@@ -5769,27 +5142,7 @@ int ha_spider::read_multi_range_next(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
break; break;
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
...@@ -5798,26 +5151,9 @@ int ha_spider::read_multi_range_next( ...@@ -5798,26 +5151,9 @@ int ha_spider::read_multi_range_next(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( error_num= spider_maybe_ping_1(this, search_link_idx, error_num);
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
break; break;
} }
...@@ -6247,26 +5583,9 @@ int ha_spider::rnd_next_internal( ...@@ -6247,26 +5583,9 @@ int ha_spider::rnd_next_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -6292,28 +5611,7 @@ int ha_spider::rnd_next_internal( ...@@ -6292,28 +5611,7 @@ int ha_spider::rnd_next_internal(
roop_count))) roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -6324,28 +5622,7 @@ int ha_spider::rnd_next_internal( ...@@ -6324,28 +5622,7 @@ int ha_spider::rnd_next_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -6353,26 +5630,9 @@ int ha_spider::rnd_next_internal( ...@@ -6353,26 +5630,9 @@ int ha_spider::rnd_next_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -6850,26 +6110,9 @@ int ha_spider::ft_read_internal( ...@@ -6850,26 +6110,9 @@ int ha_spider::ft_read_internal(
TRUE, FALSE, (roop_count != link_ok)))) TRUE, FALSE, (roop_count != link_ok))))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -6887,28 +6130,7 @@ int ha_spider::ft_read_internal( ...@@ -6887,28 +6130,7 @@ int ha_spider::ft_read_internal(
if ((error_num = spider_db_set_names(this, conn, roop_count))) if ((error_num = spider_db_set_names(this, conn, roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -6919,28 +6141,7 @@ int ha_spider::ft_read_internal( ...@@ -6919,28 +6141,7 @@ int ha_spider::ft_read_internal(
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode_eof(error_num));
} }
connection_ids[roop_count] = conn->connection_id; connection_ids[roop_count] = conn->connection_id;
if (roop_count == link_ok) if (roop_count == link_ok)
...@@ -6948,26 +6149,9 @@ int ha_spider::ft_read_internal( ...@@ -6948,26 +6149,9 @@ int ha_spider::ft_read_internal(
if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table))) if ((error_num = spider_unlock_after_query_2(conn, this, roop_count, table)))
{ {
if ( if (
error_num != HA_ERR_END_OF_FILE && error_num != HA_ERR_END_OF_FILE
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) { ) {
error_num = spider_ping_table_mon_from_table( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
DBUG_RETURN(check_error_mode_eof(error_num)); DBUG_RETURN(check_error_mode_eof(error_num));
} }
...@@ -7201,27 +6385,7 @@ int ha_spider::info( ...@@ -7201,27 +6385,7 @@ int ha_spider::info(
flag | (share->sts_init ? 0 : HA_STATUS_AUTO))) flag | (share->sts_init ? 0 : HA_STATUS_AUTO)))
) { ) {
pthread_mutex_unlock(&share->sts_mutex); pthread_mutex_unlock(&share->sts_mutex);
if ( error_num= spider_maybe_ping_1(this, search_link_idx, error_num);
share->monitoring_kind[search_link_idx] &&
need_mons[search_link_idx]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
search_link_idx,
(uint32) share->monitoring_sid[search_link_idx],
share->table_name,
share->table_name_length,
conn_link_idx[search_link_idx],
NULL,
0,
share->monitoring_kind[search_link_idx],
share->monitoring_limit[search_link_idx],
share->monitoring_flag[search_link_idx],
TRUE
);
}
if (!share->sts_init) if (!share->sts_init)
{ {
if ( if (
...@@ -7488,27 +6652,7 @@ ha_rows ha_spider::records_in_range( ...@@ -7488,27 +6652,7 @@ ha_rows ha_spider::records_in_range(
share->crd_init ? 2 : 1))) share->crd_init ? 2 : 1)))
{ {
pthread_mutex_unlock(&share->crd_mutex); pthread_mutex_unlock(&share->crd_mutex);
if ( error_num= spider_maybe_ping_1(this, search_link_idx, error_num);
share->monitoring_kind[search_link_idx] &&
need_mons[search_link_idx]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
search_link_idx,
(uint32) share->monitoring_sid[search_link_idx],
share->table_name,
share->table_name_length,
conn_link_idx[search_link_idx],
NULL,
0,
share->monitoring_kind[search_link_idx],
share->monitoring_limit[search_link_idx],
share->monitoring_flag[search_link_idx],
TRUE
);
}
if (!share->crd_init) if (!share->crd_init)
{ {
if ( if (
...@@ -7796,27 +6940,7 @@ int ha_spider::check_crd() ...@@ -7796,27 +6940,7 @@ int ha_spider::check_crd()
share->crd_init ? 2 : 1))) share->crd_init ? 2 : 1)))
{ {
pthread_mutex_unlock(&share->crd_mutex); pthread_mutex_unlock(&share->crd_mutex);
if ( error_num= spider_maybe_ping_1(this, search_link_idx, error_num);
share->monitoring_kind[search_link_idx] &&
need_mons[search_link_idx]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
search_link_idx,
(uint32) share->monitoring_sid[search_link_idx],
share->table_name,
share->table_name_length,
conn_link_idx[search_link_idx],
NULL,
0,
share->monitoring_kind[search_link_idx],
share->monitoring_limit[search_link_idx],
share->monitoring_flag[search_link_idx],
TRUE
);
}
if (!share->crd_init) if (!share->crd_init)
{ {
if ( if (
...@@ -10688,7 +9812,7 @@ int ha_spider::check_ha_range_eof() ...@@ -10688,7 +9812,7 @@ int ha_spider::check_ha_range_eof()
int ha_spider::drop_tmp_tables() int ha_spider::drop_tmp_tables()
{ {
int error_num = 0, tmp_error_num, need_mon; int error_num = 0, need_mon;
DBUG_ENTER("ha_spider::drop_tmp_tables"); DBUG_ENTER("ha_spider::drop_tmp_tables");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
if (result_list.tmp_tables_created) if (result_list.tmp_tables_created)
...@@ -10723,33 +9847,13 @@ int ha_spider::drop_tmp_tables() ...@@ -10723,33 +9847,13 @@ int ha_spider::drop_tmp_tables()
DBUG_RETURN(error_num); DBUG_RETURN(error_num);
} }
spider_lock_before_query(conn, &need_mon); spider_lock_before_query(conn, &need_mon);
if ((tmp_error_num = spider_db_set_names(this, conn, roop_count))) /* todo: double check the logic here w.r.t. tmp_error_num vs error_num */
if ((error_num = spider_db_set_names(this, conn, roop_count)))
{ {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
tmp_error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
} }
error_num = tmp_error_num; if (!error_num)
}
if (!tmp_error_num)
{ {
spider_conn_set_timeout_from_share(conn, roop_count, spider_conn_set_timeout_from_share(conn, roop_count,
wide_handler->trx->thd, share); wide_handler->trx->thd, share);
...@@ -10759,29 +9863,8 @@ int ha_spider::drop_tmp_tables() ...@@ -10759,29 +9863,8 @@ int ha_spider::drop_tmp_tables()
-1, -1,
&need_mons[roop_count]) &need_mons[roop_count])
) { ) {
tmp_error_num= spider_unlock_after_query_1(conn); error_num= spider_unlock_after_query_1(conn);
if ( error_num= spider_maybe_ping_1(this, roop_count, error_num);
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
tmp_error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
error_num = tmp_error_num;
} else { } else {
spider_unlock_after_query(conn, 0); spider_unlock_after_query(conn, 0);
} }
...@@ -10835,37 +9918,16 @@ int ha_spider::close_opened_handler( ...@@ -10835,37 +9918,16 @@ int ha_spider::close_opened_handler(
int link_idx, int link_idx,
bool release_conn bool release_conn
) { ) {
int error_num = 0, error_num2; int error_num = 0;
DBUG_ENTER("ha_spider::close_opened_handler"); DBUG_ENTER("ha_spider::close_opened_handler");
DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider this=%p", this));
if (spider_bit_is_set(m_handler_opened, link_idx)) if (spider_bit_is_set(m_handler_opened, link_idx))
{ {
if ((error_num2 = spider_db_close_handler(this, if ((error_num = spider_db_close_handler(this,
conns[link_idx], link_idx, SPIDER_CONN_KIND_MYSQL)) conns[link_idx], link_idx, SPIDER_CONN_KIND_MYSQL))
) { ) {
if ( error_num= spider_maybe_ping_1(this, link_idx, error_num);
share->monitoring_kind[link_idx] &&
need_mons[link_idx]
) {
error_num2 = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
link_idx,
(uint32) share->monitoring_sid[link_idx],
share->table_name,
share->table_name_length,
conn_link_idx[link_idx],
NULL,
0,
share->monitoring_kind[link_idx],
share->monitoring_limit[link_idx],
share->monitoring_flag[link_idx],
TRUE
);
}
error_num = error_num2;
} }
spider_clear_bit(m_handler_opened, link_idx); spider_clear_bit(m_handler_opened, link_idx);
if (release_conn && !conns[link_idx]->join_trx) if (release_conn && !conns[link_idx]->join_trx)
...@@ -10914,28 +9976,7 @@ int ha_spider::index_handler_init() ...@@ -10914,28 +9976,7 @@ int ha_spider::index_handler_init()
conns[roop_count] conns[roop_count]
, roop_count)) , roop_count))
) { ) {
if ( DBUG_RETURN(spider_maybe_ping_1(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(error_num);
} }
set_handler_opened(roop_count); set_handler_opened(roop_count);
} }
...@@ -11000,28 +10041,7 @@ int ha_spider::rnd_handler_init() ...@@ -11000,28 +10041,7 @@ int ha_spider::rnd_handler_init()
conns[roop_count] conns[roop_count]
, roop_count)) , roop_count))
) { ) {
if ( DBUG_RETURN(spider_maybe_ping_1(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(error_num);
} }
set_handler_opened(roop_count); set_handler_opened(roop_count);
spider_db_handler *dbton_hdl= spider_db_handler *dbton_hdl=
...@@ -13185,28 +12205,7 @@ int ha_spider::lock_tables() ...@@ -13185,28 +12205,7 @@ int ha_spider::lock_tables()
conns[roop_count], conns[roop_count],
roop_count))) roop_count)))
) { ) {
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode(error_num));
} }
reset_first_link_idx(); reset_first_link_idx();
} }
...@@ -13216,29 +12215,8 @@ int ha_spider::lock_tables() ...@@ -13216,29 +12215,8 @@ int ha_spider::lock_tables()
conns[roop_count]->db_conn->have_lock_table_list() && conns[roop_count]->db_conn->have_lock_table_list() &&
(error_num = spider_db_lock_tables(this, roop_count)) (error_num = spider_db_lock_tables(this, roop_count))
) { ) {
if (
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
conns[roop_count]->table_lock = 0; conns[roop_count]->table_lock = 0;
DBUG_RETURN(check_error_mode(error_num)); DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
} }
if (conns[roop_count]->table_lock == 2) if (conns[roop_count]->table_lock == 2)
conns[roop_count]->table_lock = 1; conns[roop_count]->table_lock = 1;
...@@ -13252,28 +12230,7 @@ int ha_spider::lock_tables() ...@@ -13252,28 +12230,7 @@ int ha_spider::lock_tables()
conns[roop_count]->disable_reconnect = FALSE; conns[roop_count]->disable_reconnect = FALSE;
if ((error_num = spider_db_unlock_tables(this, roop_count))) if ((error_num = spider_db_unlock_tables(this, roop_count)))
{ {
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
wide_handler->trx,
wide_handler->trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode(error_num));
} }
} }
} }
...@@ -13323,28 +12280,7 @@ int ha_spider::dml_init() ...@@ -13323,28 +12280,7 @@ int ha_spider::dml_init()
conns[roop_count], conns[roop_count],
roop_count))) roop_count)))
) { ) {
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
trx,
trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode(error_num));
} }
reset_first_link_idx(); reset_first_link_idx();
if ( if (
...@@ -13361,28 +12297,7 @@ int ha_spider::dml_init() ...@@ -13361,28 +12297,7 @@ int ha_spider::dml_init()
if ((error_num = spider_check_and_set_trx_isolation( if ((error_num = spider_check_and_set_trx_isolation(
conns[roop_count], &need_mons[roop_count]))) conns[roop_count], &need_mons[roop_count])))
{ {
if ( DBUG_RETURN(spider_maybe_ping(this, roop_count, error_num));
share->monitoring_kind[roop_count] &&
need_mons[roop_count]
) {
error_num = spider_ping_table_mon_from_table(
trx,
trx->thd,
share,
roop_count,
(uint32) share->monitoring_sid[roop_count],
share->table_name,
share->table_name_length,
conn_link_idx[roop_count],
NULL,
0,
share->monitoring_kind[roop_count],
share->monitoring_limit[roop_count],
share->monitoring_flag[roop_count],
TRUE
);
}
DBUG_RETURN(check_error_mode(error_num));
} }
} }
conns[roop_count]->semi_trx_isolation = -1; conns[roop_count]->semi_trx_isolation = -1;
......
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