mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-7098 spider/bg.spider_fixes failed in buildbot with safe_mutex: Trying to unlock mutex conn->mta_conn_mutex that wasn't locked at storage/spider/spd_db_conn.cc, line 671
This commit is contained in:
@@ -2331,6 +2331,7 @@ int ha_spider::index_read_map_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -2338,6 +2339,11 @@ int ha_spider::index_read_map_internal(
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -2359,11 +2365,15 @@ int ha_spider::index_read_map_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -2399,6 +2409,8 @@ int ha_spider::index_read_map_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -2426,6 +2438,8 @@ int ha_spider::index_read_map_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -2827,6 +2841,7 @@ int ha_spider::index_read_last_map_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -2834,6 +2849,11 @@ int ha_spider::index_read_last_map_internal(
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -2852,11 +2872,15 @@ int ha_spider::index_read_last_map_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -2892,6 +2916,8 @@ int ha_spider::index_read_last_map_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -2919,6 +2945,8 @@ int ha_spider::index_read_last_map_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -3297,6 +3325,7 @@ int ha_spider::index_first_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -3305,6 +3334,11 @@ int ha_spider::index_first_internal(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -3323,11 +3357,15 @@ int ha_spider::index_first_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -3363,6 +3401,8 @@ int ha_spider::index_first_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -3390,6 +3430,8 @@ int ha_spider::index_first_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -3685,6 +3727,7 @@ int ha_spider::index_last_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -3693,6 +3736,11 @@ int ha_spider::index_last_internal(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -3711,11 +3759,15 @@ int ha_spider::index_last_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -3751,6 +3803,8 @@ int ha_spider::index_last_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -3778,6 +3832,8 @@ int ha_spider::index_last_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -4133,6 +4189,7 @@ int ha_spider::read_range_first_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -4140,6 +4197,11 @@ int ha_spider::read_range_first_internal(
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -4158,11 +4220,15 @@ int ha_spider::read_range_first_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -4198,6 +4264,8 @@ int ha_spider::read_range_first_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -4225,6 +4293,8 @@ int ha_spider::read_range_first_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -4763,6 +4833,7 @@ int ha_spider::read_multi_range_first_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -4771,6 +4842,11 @@ int ha_spider::read_multi_range_first_internal(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -4795,11 +4871,15 @@ int ha_spider::read_multi_range_first_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -4836,6 +4916,8 @@ int ha_spider::read_multi_range_first_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -4865,6 +4947,8 @@ int ha_spider::read_multi_range_first_internal(
|
||||
if (!error_num)
|
||||
{
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -5560,6 +5644,7 @@ int ha_spider::read_multi_range_first_internal(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -5568,6 +5653,11 @@ int ha_spider::read_multi_range_first_internal(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -5593,11 +5683,15 @@ int ha_spider::read_multi_range_first_internal(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -5640,6 +5734,8 @@ int ha_spider::read_multi_range_first_internal(
|
||||
-1,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -5676,6 +5772,8 @@ int ha_spider::read_multi_range_first_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -5703,6 +5801,8 @@ int ha_spider::read_multi_range_first_internal(
|
||||
break;
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -6212,6 +6312,7 @@ int ha_spider::read_multi_range_next(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -6220,6 +6321,11 @@ int ha_spider::read_multi_range_next(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -6244,11 +6350,15 @@ int ha_spider::read_multi_range_next(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -6285,6 +6395,8 @@ int ha_spider::read_multi_range_next(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -6314,6 +6426,8 @@ int ha_spider::read_multi_range_next(
|
||||
if (!error_num)
|
||||
{
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -7013,6 +7127,7 @@ int ha_spider::read_multi_range_next(
|
||||
}
|
||||
#endif
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -7021,6 +7136,11 @@ int ha_spider::read_multi_range_next(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -7046,11 +7166,15 @@ int ha_spider::read_multi_range_next(
|
||||
} else {
|
||||
#endif
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -7093,6 +7217,8 @@ int ha_spider::read_multi_range_next(
|
||||
-1,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -7129,6 +7255,8 @@ int ha_spider::read_multi_range_next(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -7156,6 +7284,8 @@ int ha_spider::read_multi_range_next(
|
||||
break;
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -7675,6 +7805,7 @@ int ha_spider::rnd_next_internal(
|
||||
sql_type = SPIDER_SQL_TYPE_HANDLER;
|
||||
}
|
||||
spider_db_handler *dbton_hdl = dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -7683,6 +7814,11 @@ int ha_spider::rnd_next_internal(
|
||||
if ((error_num =
|
||||
dbton_hdl->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(sql_type))
|
||||
@@ -7692,11 +7828,15 @@ int ha_spider::rnd_next_internal(
|
||||
}
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn,
|
||||
roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -7732,6 +7872,8 @@ int ha_spider::rnd_next_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -7759,6 +7901,8 @@ int ha_spider::rnd_next_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -8291,6 +8435,7 @@ int ha_spider::ft_read_internal(
|
||||
uint dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
|
||||
SPIDER_CONN *conn = conns[roop_count];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL))
|
||||
{
|
||||
@@ -8300,6 +8445,12 @@ int ha_spider::ft_read_internal(
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
@@ -8309,10 +8460,14 @@ int ha_spider::ft_read_internal(
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(this, conn, roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -8347,6 +8502,8 @@ int ha_spider::ft_read_internal(
|
||||
result_list.quick_mode,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -8374,6 +8531,8 @@ int ha_spider::ft_read_internal(
|
||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||
}
|
||||
connection_ids[roop_count] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (roop_count == link_ok)
|
||||
@@ -11135,9 +11294,12 @@ void ha_spider::bulk_req_exec()
|
||||
if (conn->bulk_access_requests)
|
||||
{
|
||||
spider_bg_conn_wait(conn);
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &need_mon;
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
/* currently only used for HS */
|
||||
@@ -11155,6 +11317,8 @@ void ha_spider::bulk_req_exec()
|
||||
conn->bulk_access_sended += conn->bulk_access_requests;
|
||||
*/
|
||||
conn->bulk_access_requests = 0;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -12970,6 +13134,7 @@ int ha_spider::drop_tmp_tables()
|
||||
uint dbton_id = share->use_sql_dbton_ids[roop_count];
|
||||
spider_db_handler *dbton_hdl = dbton_handler[dbton_id];
|
||||
SPIDER_CONN *conn = conns[roop_count];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_TMP_SQL))
|
||||
{
|
||||
@@ -12979,6 +13144,12 @@ int ha_spider::drop_tmp_tables()
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_TMP_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_TMP_SQL))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
@@ -12988,10 +13159,14 @@ int ha_spider::drop_tmp_tables()
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
conn->need_mon = &need_mon;
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((tmp_error_num = spider_db_set_names(this, conn, roop_count)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -13029,6 +13204,8 @@ int ha_spider::drop_tmp_tables()
|
||||
-1,
|
||||
&need_mons[roop_count])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
tmp_error_num = spider_db_errorno(conn);
|
||||
@@ -13055,6 +13232,8 @@ int ha_spider::drop_tmp_tables()
|
||||
}
|
||||
error_num = tmp_error_num;
|
||||
} else {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
|
@@ -2594,6 +2594,7 @@ void *spider_bg_conn_action(
|
||||
sql_type = SPIDER_SQL_TYPE_SELECT_HS;
|
||||
}
|
||||
#endif
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
@@ -2634,6 +2635,8 @@ void *spider_bg_conn_action(
|
||||
if (!result_list->bgs_error)
|
||||
{
|
||||
conn->need_mon = &spider->need_mons[conn->link_idx];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
@@ -2711,6 +2714,8 @@ void *spider_bg_conn_action(
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
}
|
||||
#endif
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -2721,11 +2726,14 @@ void *spider_bg_conn_action(
|
||||
}
|
||||
} else {
|
||||
spider->connection_ids[conn->link_idx] = conn->connection_id;
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
result_list->bgs_error =
|
||||
spider_db_store_result(spider, conn->link_idx, result_list->table);
|
||||
if ((result_list->bgs_error_with_message = thd->is_error()))
|
||||
strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
}
|
||||
conn->bg_search = FALSE;
|
||||
@@ -2789,12 +2797,26 @@ void *spider_bg_conn_action(
|
||||
{
|
||||
DBUG_PRINT("info",("spider bg exec sql start"));
|
||||
spider = (ha_spider*) conn->bg_target;
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &spider->need_mons[conn->link_idx];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
*conn->bg_error_num = spider_db_query_with_set_names(
|
||||
conn->bg_sql_type,
|
||||
spider,
|
||||
conn,
|
||||
conn->link_idx
|
||||
);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
conn->bg_exec_sql = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1410,6 +1410,7 @@ int spider_group_by_handler::init_scan()
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL))
|
||||
{
|
||||
@@ -1420,6 +1421,12 @@ int spider_group_by_handler::init_scan()
|
||||
dbton_hdl->set_sql_for_exec(SPIDER_SQL_TYPE_SELECT_SQL, link_idx,
|
||||
link_idx_chain)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
@@ -1429,11 +1436,15 @@ int spider_group_by_handler::init_scan()
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
conn->need_mon = &spider->need_mons[link_idx];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_set_names(spider, conn,
|
||||
link_idx)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -1458,6 +1469,8 @@ int spider_group_by_handler::init_scan()
|
||||
spider->result_list.quick_mode,
|
||||
&spider->need_mons[link_idx])
|
||||
) {
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
error_num = spider_db_errorno(conn);
|
||||
@@ -1474,6 +1487,8 @@ int spider_group_by_handler::init_scan()
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
spider->connection_ids[link_idx] = conn->connection_id;
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
if (fields->is_first_link_ok_chain(link_idx_chain))
|
||||
|
@@ -18,6 +18,8 @@
|
||||
|
||||
#if MYSQL_VERSION_ID < 50500
|
||||
#define spider_my_free(A,B) my_free(A,B)
|
||||
#define pthread_mutex_assert_owner(A)
|
||||
#define pthread_mutex_assert_not_owner(A)
|
||||
#else
|
||||
#define spider_my_free(A,B) my_free(A)
|
||||
#ifdef pthread_mutex_t
|
||||
@@ -40,6 +42,8 @@
|
||||
#undef pthread_mutex_destroy
|
||||
#endif
|
||||
#define pthread_mutex_destroy mysql_mutex_destroy
|
||||
#define pthread_mutex_assert_owner(A) mysql_mutex_assert_owner(A)
|
||||
#define pthread_mutex_assert_not_owner(A) mysql_mutex_assert_not_owner(A)
|
||||
#ifdef pthread_cond_t
|
||||
#undef pthread_cond_t
|
||||
#endif
|
||||
|
@@ -6355,13 +6355,18 @@ int spider_open_all_tables(
|
||||
}
|
||||
conn->error_mode &= spider_param_error_read_mode(thd, 0);
|
||||
conn->error_mode &= spider_param_error_write_mode(thd, 0);
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &mon_val;
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
conn->mta_conn_mutex_unlock_later = TRUE;
|
||||
if ((error_num = spider_db_before_query(conn, &mon_val)))
|
||||
{
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
@@ -6374,6 +6379,8 @@ int spider_open_all_tables(
|
||||
free_root(&mem_root, MYF(0));
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = FALSE;
|
||||
conn->mta_conn_mutex_unlock_later = FALSE;
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
|
Reference in New Issue
Block a user