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:
@@ -2106,6 +2106,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);
|
||||
@@ -2113,6 +2114,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))
|
||||
@@ -2134,11 +2140,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);
|
||||
@@ -2174,6 +2184,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);
|
||||
@@ -2201,6 +2213,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)
|
||||
@@ -2603,6 +2617,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);
|
||||
@@ -2610,6 +2625,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))
|
||||
@@ -2628,11 +2648,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);
|
||||
@@ -2668,6 +2692,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);
|
||||
@@ -2695,6 +2721,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)
|
||||
@@ -3074,6 +3102,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);
|
||||
@@ -3082,6 +3111,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))
|
||||
@@ -3100,11 +3134,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);
|
||||
@@ -3140,6 +3178,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);
|
||||
@@ -3167,6 +3207,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)
|
||||
@@ -3463,6 +3505,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);
|
||||
@@ -3471,6 +3514,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))
|
||||
@@ -3489,11 +3537,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);
|
||||
@@ -3529,6 +3581,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);
|
||||
@@ -3556,6 +3610,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)
|
||||
@@ -3912,6 +3968,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);
|
||||
@@ -3919,6 +3976,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))
|
||||
@@ -3937,11 +3999,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);
|
||||
@@ -3977,6 +4043,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);
|
||||
@@ -4004,6 +4072,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)
|
||||
@@ -4604,6 +4674,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);
|
||||
@@ -4612,6 +4683,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))
|
||||
@@ -4636,11 +4712,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);
|
||||
@@ -4677,6 +4757,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);
|
||||
@@ -4706,6 +4788,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)
|
||||
@@ -5415,6 +5499,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);
|
||||
@@ -5423,6 +5508,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))
|
||||
@@ -5448,11 +5538,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);
|
||||
@@ -5495,6 +5589,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);
|
||||
@@ -5531,6 +5627,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);
|
||||
@@ -5558,6 +5656,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)
|
||||
@@ -6076,6 +6176,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);
|
||||
@@ -6084,6 +6185,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))
|
||||
@@ -6108,11 +6214,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);
|
||||
@@ -6149,6 +6259,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);
|
||||
@@ -6178,6 +6290,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)
|
||||
@@ -6882,6 +6996,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);
|
||||
@@ -6890,6 +7005,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))
|
||||
@@ -6915,11 +7035,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);
|
||||
@@ -6962,6 +7086,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);
|
||||
@@ -6998,6 +7124,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);
|
||||
@@ -7025,6 +7153,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)
|
||||
@@ -7557,6 +7687,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);
|
||||
@@ -7565,6 +7696,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))
|
||||
@@ -7574,11 +7710,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);
|
||||
@@ -7614,6 +7754,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);
|
||||
@@ -7641,6 +7783,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)
|
||||
@@ -8174,6 +8318,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))
|
||||
{
|
||||
@@ -8183,6 +8328,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(
|
||||
@@ -8192,10 +8343,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);
|
||||
@@ -8231,6 +8386,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);
|
||||
@@ -8258,6 +8415,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)
|
||||
@@ -11269,9 +11428,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 */
|
||||
@@ -11289,6 +11451,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);
|
||||
@@ -13080,6 +13244,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))
|
||||
{
|
||||
@@ -13089,6 +13254,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(
|
||||
@@ -13098,10 +13269,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);
|
||||
@@ -13139,6 +13314,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);
|
||||
@@ -13165,6 +13342,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);
|
||||
|
@@ -3230,6 +3230,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);
|
||||
@@ -3270,6 +3271,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
|
||||
@@ -3347,6 +3350,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);
|
||||
@@ -3357,11 +3362,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;
|
||||
@@ -3425,12 +3433,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
@@ -1411,6 +1411,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))
|
||||
{
|
||||
@@ -1421,6 +1422,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(
|
||||
@@ -1430,11 +1437,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);
|
||||
@@ -1459,6 +1470,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);
|
||||
@@ -1475,6 +1488,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))
|
||||
|
@@ -19,6 +19,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
|
||||
@@ -41,6 +43,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
|
||||
|
@@ -6698,13 +6698,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);
|
||||
@@ -6717,6 +6722,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