mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Merge branch '10.4' into 10.5
This commit is contained in:
commit
e95e9a221f
21 changed files with 280 additions and 590 deletions
|
@ -5,15 +5,15 @@
|
|||
# need to change topology after they have sourced include/rpl_init.inc
|
||||
#
|
||||
# This file sets up variables needed by include/rpl_sync.inc and many
|
||||
# other replication scripts in the include/ directory. It also issues
|
||||
# other replication scripts in the include/ directory. It also issues
|
||||
# CHANGE MASTER on all servers where the configuration changes from
|
||||
# what it was before. It does not issue START SLAVE (use
|
||||
# what it was before. It does not issue START SLAVE (use
|
||||
# include/rpl_start_slaves.inc for that).
|
||||
#
|
||||
# Note: it is not currently possible to change the number of servers
|
||||
# after the rpl_init.inc, without first calling rpl_end.inc. So the
|
||||
# test has to set $rpl_server_count to the total number of servers
|
||||
# that the test uses, before it sources include/rpl_init.inc. After
|
||||
# that the test uses, before it sources include/rpl_init.inc. After
|
||||
# that, $rpl_server_count must not change until after next time the
|
||||
# test sources include/rpl_end.inc.
|
||||
#
|
||||
|
@ -37,7 +37,7 @@
|
|||
# By default, CHANGE MASTER is executed with MASTER_LOG_FILE set
|
||||
# to the name of the last binlog file on the master (retrieved by
|
||||
# executing SHOW MASTER STATUS). This variable can be set to
|
||||
# specify another filename. This variable should be a
|
||||
# specify another filename. This variable should be a
|
||||
# comma-separated list of the following form:
|
||||
#
|
||||
# SERVER_NUMBER_1:FILE_NAME_1,SERVER_NUMBER_2:FILE_NAME_2,...
|
||||
|
@ -45,7 +45,7 @@
|
|||
# Before CHANGE MASTER is executed on server N, this script checks
|
||||
# if $rpl_master_log_file contains the text N:FILE_NAME. If it
|
||||
# does, then MASTER_LOG_FILE is set to FILE_NAME. Otherwise,
|
||||
# MASTER_LOG_FILE is set to the last binlog on the master. For
|
||||
# MASTER_LOG_FILE is set to the last binlog on the master. For
|
||||
# example, to specify that server_1 should start replicate from
|
||||
# master-bin.000007 and server_5 should start replicate from
|
||||
# master-bin.012345, do:
|
||||
|
@ -53,9 +53,9 @@
|
|||
#
|
||||
# $rpl_master_log_pos
|
||||
# By default, CHANGE MASTER is executed without specifying the
|
||||
# MASTER_LOG_POS parameter. This variable can be set to set a
|
||||
# specific position. It has the same form as $rpl_master_log_file
|
||||
# (see above). For example, to specify that server_3 should start
|
||||
# MASTER_LOG_POS parameter. This variable can be set to set a
|
||||
# specific position. It has the same form as $rpl_master_log_file
|
||||
# (see above). For example, to specify that server_3 should start
|
||||
# replicate from position 4711 of its master, do:
|
||||
# --let $rpl_master_log_pos= 3:4711
|
||||
#
|
||||
|
@ -72,7 +72,7 @@
|
|||
# include/rpl_stop_slaves.inc
|
||||
# include/rpl_end.inc
|
||||
#
|
||||
# $rpl_server_count_length:
|
||||
# $rpl_server_count_length
|
||||
# Set to LENGTH($rpl_server_count). So if $rpl_server_count < 10,
|
||||
# then $rpl_server_count_length = 1; if 10 <= $rpl_server_count <
|
||||
# 100, then $rpl_server_count_length = 2, etc.
|
||||
|
@ -83,12 +83,12 @@
|
|||
# server N is a slave, then the N'th number is the master of server
|
||||
# N. If server N is not a slave, then the N'th number is just spaces
|
||||
# (so in fact it is not a number). For example, if $rpl_topology is
|
||||
# '1->2,2->3,3->1,2->4,5->6', then $rpl_master_list is '3122 6'.
|
||||
# '1->2,2->3,3->1,2->4,5->6', then $rpl_master_list is '3122 5'.
|
||||
#
|
||||
# $rpl_sync_chain_dirty
|
||||
# This variable is set to 1. This tells include/rpl_sync.inc to
|
||||
# This variable is set to 1. This tells include/rpl_sync.inc to
|
||||
# compute a new value for $rpl_sync_chain next time that
|
||||
# include/rpl_sync.inc is sourced. See
|
||||
# include/rpl_sync.inc is sourced. See
|
||||
# include/rpl_generate_sync_chain.inc and include/rpl_sync.inc for
|
||||
# details.
|
||||
|
||||
|
@ -124,7 +124,7 @@ if ($rpl_master_list == '')
|
|||
if ($rpl_debug)
|
||||
{
|
||||
--echo \$rpl_server_count='$rpl_server_count'
|
||||
--echo \$rpl_server_count_length='$rpl_server_count_length'
|
||||
--echo old \$rpl_server_count_length='$rpl_server_count_length'
|
||||
--echo new \$rpl_topology='$_rpl_topology'
|
||||
--echo old \$rpl_master_list='$rpl_master_list'
|
||||
--echo old \$rpl_sync_chain='$rpl_sync_chain'
|
||||
|
@ -210,6 +210,10 @@ if (!$rpl_skip_change_master)
|
|||
--let $rpl_connection_name= server_$_rpl_master
|
||||
--source include/rpl_connection.inc
|
||||
--let $_rpl_master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo "\$rpl_master_log_file parameter not set for the master: $_rpl_master, use the latest binlog file by executing SHOW MASTER STATUS."
|
||||
}
|
||||
}
|
||||
# Change connection.
|
||||
--let $rpl_connection_name= server_$_rpl_server
|
||||
|
@ -224,6 +228,10 @@ if (!$rpl_skip_change_master)
|
|||
if (!$_rpl_master_log_pos_index)
|
||||
{
|
||||
--let $_rpl_master_log_pos=
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo "\$rpl_master_log_pos parameter not set for the master: $_rpl_master. Set log position to empty."
|
||||
}
|
||||
}
|
||||
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# This script is normally used internally by rpl_init.inc and
|
||||
# master-slave.inc, but it can also be used in test cases that need to
|
||||
# create more connections or re-create connections after disconnect.
|
||||
#
|
||||
# Default ports SERVER_MYPORT_[1,2] are set by rpl_init.inc.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
|
|
|
@ -103,11 +103,9 @@ while ($_rpl_server)
|
|||
|
||||
--connection default
|
||||
--let $_rpl_server= $rpl_server_count
|
||||
--let $_rpl_one= _1
|
||||
while ($_rpl_server)
|
||||
{
|
||||
--disconnect server_$_rpl_server
|
||||
--disconnect server_$_rpl_server$_rpl_one
|
||||
--dec $_rpl_server
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Execute a .inc file once for each server that was configured as a
|
||||
# slave by rpl_init.inc
|
||||
# slave by rpl_init.inc, for example start_slave.inc or stop_slave.inc file.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
|
@ -14,6 +14,20 @@
|
|||
# $rpl_source_file
|
||||
# The file that will be sourced.
|
||||
#
|
||||
# $rpl_server_count
|
||||
# The number of servers to configure. If this is not set, the largest
|
||||
# number in $rpl_topology will be used.
|
||||
# This parameter is obtained from rpl_init.inc.
|
||||
#
|
||||
# $rpl_master_list
|
||||
# This parameter is calculated from within rpl_init.inc.
|
||||
#
|
||||
# $rpl_server_count_length
|
||||
# Set to LENGTH($rpl_server_count). So if $rpl_server_count < 10,
|
||||
# then $rpl_server_count_length = 1; if 10 <= $rpl_server_count <
|
||||
# 100, then $rpl_server_count_length = 2, etc.
|
||||
# This parameter is calculated from within rpl_change_topology.inc.
|
||||
#
|
||||
# $rpl_debug
|
||||
# See include/rpl_init.inc
|
||||
|
||||
|
|
|
@ -3,18 +3,16 @@
|
|||
# Set up replication on several servers in a specified topology.
|
||||
#
|
||||
# By default, this script does the following:
|
||||
# - Creates the connections server_1, server_2, ..., server_N, as
|
||||
# well as extra connections server_1_1, server_2_1, ...,
|
||||
# server_N_1. server_I and server_I_1 are connections to the same
|
||||
# server.
|
||||
# - Verifies that @@server_id of all servers are different.
|
||||
# - Creates the connections server_1, server_2, ..., server_N.
|
||||
# - Calls RESET MASTER, RESET SLAVE, USE test, CHANGE MASTER, START SLAVE.
|
||||
# - Sets the connection to server_1 before exiting.
|
||||
# With $rpl_check_server_ids parameter, the script does the following:
|
||||
# - Verifies that @@server_id of all servers are different.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# 1. If you are going to use more than two servers, create
|
||||
# rpl_test.cfg with the following contents:
|
||||
# rpl_test.cnf with the following contents:
|
||||
#
|
||||
# !include ../my.cnf
|
||||
# [mysqld.1]
|
||||
|
@ -34,8 +32,9 @@
|
|||
#
|
||||
# (It is allowed, but not required, to configure SERVER_MYPORT_1
|
||||
# and SERVER_MYPORT_2 too. If these variables are not set, the
|
||||
# variables MASTER_MYPORT and SLAVE_MYPORT, configured in the
|
||||
# default my.cnf used by the rpl suite, are used instead.)
|
||||
# variables MASTER_MYPORT and SLAVE_MYPORT are used instead.
|
||||
# These variables are configured in the rpl_1slave_base.cnf,
|
||||
# that is used in the default my.cnf, which is used by the rpl suite.)
|
||||
#
|
||||
# 2. Execute the following near the top of the test:
|
||||
#
|
||||
|
@ -147,18 +146,15 @@ if (!$rpl_debug)
|
|||
}
|
||||
|
||||
|
||||
# Create two connections to each server; reset master/slave, select
|
||||
# Create connection to the server; reset master/slave, select
|
||||
# database, set autoinc variables.
|
||||
--let $_rpl_server= $rpl_server_count
|
||||
--let $_rpl_one= _1
|
||||
while ($_rpl_server)
|
||||
{
|
||||
# Connect.
|
||||
--let $rpl_server_number= $_rpl_server
|
||||
--let $rpl_connection_name= server_$_rpl_server
|
||||
--source include/rpl_connect.inc
|
||||
--let $rpl_connection_name= server_$_rpl_server$_rpl_one
|
||||
--source include/rpl_connect.inc
|
||||
|
||||
# Configure server.
|
||||
--let $rpl_connection_name= server_$_rpl_server
|
||||
|
@ -203,7 +199,7 @@ if ($rpl_check_server_ids)
|
|||
while ($_rpl_server2)
|
||||
{
|
||||
--let $assert_text= Servers $_rpl_server and $_rpl_server2 should have different @@server_id
|
||||
--let $assert_condition= [$_rpl_server:SELECT @@server_id AS i, i, 1] != [$_rpl_server2:SELECT @@server_id AS i, i, 1]
|
||||
--let $assert_cond= [SELECT @@server_id AS i, i, 1] != $_rpl_server
|
||||
|
||||
--source include/assert.inc
|
||||
--dec $_rpl_server2
|
||||
|
@ -212,18 +208,30 @@ if ($rpl_check_server_ids)
|
|||
}
|
||||
}
|
||||
|
||||
# $rpl_master_list must be set so that include/rpl_change_topology.inc
|
||||
# knows which servers are initialized and not.
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo ---- Check the topology and call CHANGE MASTER ----
|
||||
}
|
||||
|
||||
# $rpl_master_list must be set so that include/rpl_change_topology.inc and later
|
||||
# include/rpl_for_each_slave.inc knows which servers are initialized and not.
|
||||
--let $rpl_master_list= `SELECT REPEAT('x', $rpl_server_count * LENGTH($rpl_server_count))`
|
||||
--source include/rpl_change_topology.inc
|
||||
|
||||
|
||||
if (!$rpl_skip_start_slave)
|
||||
{
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo ---- Start slaves ----
|
||||
}
|
||||
--source include/rpl_start_slaves.inc
|
||||
}
|
||||
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo ---- Set connection to the server_1 ----
|
||||
}
|
||||
--let $rpl_connection_name= server_1
|
||||
--source include/rpl_connection.inc
|
||||
|
||||
|
|
|
@ -72,11 +72,6 @@ if (!$_rpl_server_number)
|
|||
--source include/rpl_connection.inc
|
||||
--enable_reconnect
|
||||
|
||||
--let $_rpl_one= _1
|
||||
--let $rpl_connection_name= server_$rpl_server_number$_rpl_one
|
||||
--source include/rpl_connection.inc
|
||||
--enable_reconnect
|
||||
|
||||
if ($rpl_debug)
|
||||
{
|
||||
--echo ---- Wait for reconnect and disable reconnect on all connections ----
|
||||
|
@ -122,11 +117,5 @@ if (!$_rpl_server_number)
|
|||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
|
||||
--let $rpl_connection_name= server_$rpl_server_number$_rpl_one
|
||||
--source include/rpl_connection.inc
|
||||
--source include/wait_until_connected_again.inc
|
||||
--disable_reconnect
|
||||
|
||||
|
||||
--let $include_filename= rpl_reconnect.inc
|
||||
--source include/end_include_file.inc
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#
|
||||
# $slave_timeout
|
||||
# Set the timeout when waiting for slave threads to stop and
|
||||
# start, respectively. See include/wait_for_slave_param.inc
|
||||
# start, respectively. See include/wait_for_slave_param.inc
|
||||
|
||||
|
||||
--let $include_filename= rpl_start_slaves.inc
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
#
|
||||
# Parameters:
|
||||
# $slave_timeout
|
||||
# See include/wait_for_slave_param.inc
|
||||
# Timeout used when waiting for the slave IO thread to start.
|
||||
# See include/wait_for_slave_param.inc.
|
||||
#
|
||||
# $rpl_allow_error
|
||||
# By default, this file fails if there is an error in the IO
|
||||
# thread. However, the IO thread can recover and reconnect after
|
||||
# certain errors. If such an error is expected, can set
|
||||
# $rpl_allow_error=1. This will prevent this file from failing if
|
||||
# thread. However, the IO thread can recover and reconnect after
|
||||
# certain errors. If such an error is expected, can set
|
||||
# $rpl_allow_error=1. This will prevent this file from failing if
|
||||
# there is an error in the IO thread.
|
||||
#
|
||||
# $rpl_debug
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#
|
||||
# Parameters:
|
||||
# $slave_timeout
|
||||
# Timeout used when waiting for the slave SQL thread to start.
|
||||
# See include/wait_for_slave_param.inc
|
||||
#
|
||||
# $rpl_debug
|
||||
|
@ -25,7 +26,7 @@ let $slave_param= Slave_SQL_Running;
|
|||
let $slave_param_value= Yes;
|
||||
|
||||
# Unfortunately, the slave sql thread sets Slave_SQL_Running=Yes
|
||||
# *before* it clears Last_SQL_Errno. So we have to allow errors in
|
||||
# *before* it clears Last_SQL_Errno. So we have to allow errors in
|
||||
# the SQL thread here.
|
||||
|
||||
#--let $slave_error_param= Last_SQL_Errno
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#
|
||||
# Parameters:
|
||||
# $slave_timeout
|
||||
# Timeout used when waiting for the slave threads to start.
|
||||
# See include/wait_for_slave_param.inc
|
||||
#
|
||||
# $rpl_debug
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Use settings from rpl_1slave_base.cnf
|
||||
# add setting to connect the slave to the master by default
|
||||
!include rpl_1slave_base.cnf
|
||||
!include include/default_client.cnf
|
||||
|
||||
|
||||
[mysqld.2]
|
||||
|
||||
# Override specific server settings using [mariadb-x.y] option group
|
||||
# from `test.cnf` file right after including this file.
|
||||
# E.g. after !include ../my.cnf, in your `test.cnf`, specify your configuration
|
||||
# in option group e.g [mysqld.x], so that number `x` corresponds to the number
|
||||
# in the rpl server topology.
|
||||
|
|
|
@ -1983,25 +1983,12 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (
|
||||
|
@ -2494,25 +2481,12 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (is_bulk_access_clone)
|
||||
|
@ -2979,26 +2953,13 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (is_bulk_access_clone)
|
||||
|
@ -3382,26 +3343,13 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (is_bulk_access_clone)
|
||||
|
@ -3845,25 +3793,12 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (is_bulk_access_clone)
|
||||
|
@ -4551,26 +4486,13 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (is_bulk_access_clone)
|
||||
|
@ -5376,26 +5298,13 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
|
@ -6053,26 +5962,13 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (is_bulk_access_clone)
|
||||
|
@ -6873,26 +6769,13 @@ 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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
|
@ -7564,26 +7447,13 @@ int ha_spider::rnd_next_internal(
|
|||
}
|
||||
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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
conn->need_mon = &need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
|
@ -8195,29 +8065,13 @@ int ha_spider::ft_read_internal(
|
|||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
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);
|
||||
|
@ -13135,29 +12989,13 @@ int ha_spider::drop_tmp_tables()
|
|||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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(
|
||||
SPIDER_SQL_TYPE_TMP_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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);
|
||||
|
|
34
storage/spider/mysql-test/spider/bugfix/r/mdev_26151.result
Normal file
34
storage/spider/mysql-test/spider/bugfix/r/mdev_26151.result
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
MDEV-26151 MDEV-31787
|
||||
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
set @old_spider_bgs_mode= @@spider_bgs_mode;
|
||||
set session spider_bgs_mode=1;
|
||||
CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
|
||||
create table td (a int, PRIMARY KEY (a));
|
||||
create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_26151",TABLE "td", casual_read "3"';
|
||||
insert into td values (11), (42);
|
||||
select max(a) from ts;
|
||||
max(a)
|
||||
42
|
||||
drop table td, ts;
|
||||
create table td (a int, PRIMARY KEY (a));
|
||||
create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv_mdev_26151",TABLE "td", casual_read "1"';
|
||||
insert into td values (11), (42);
|
||||
select max(a) from ts;
|
||||
max(a)
|
||||
42
|
||||
select min(a) from ts;
|
||||
min(a)
|
||||
11
|
||||
drop table td, ts;
|
||||
drop server srv_mdev_26151;
|
||||
set session spider_bgs_mode=@old_spider_bgs_mode;
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
|
||||
end of test
|
||||
|
54
storage/spider/mysql-test/spider/bugfix/t/mdev_26151.test
Normal file
54
storage/spider/mysql-test/spider/bugfix/t/mdev_26151.test
Normal file
|
@ -0,0 +1,54 @@
|
|||
--echo
|
||||
--echo MDEV-26151 MDEV-31787
|
||||
--echo
|
||||
|
||||
# This test exercises the code path where a nonzero casual_read takes
|
||||
# effect.
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
--let $srv=srv_mdev_26151
|
||||
set @old_spider_bgs_mode= @@spider_bgs_mode;
|
||||
set session spider_bgs_mode=1;
|
||||
evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
|
||||
|
||||
# casual_read != 0 && casual_read != 1
|
||||
create table td (a int, PRIMARY KEY (a));
|
||||
|
||||
eval create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "td", casual_read "3"';
|
||||
|
||||
insert into td values (11), (42);
|
||||
|
||||
select max(a) from ts;
|
||||
|
||||
drop table td, ts;
|
||||
|
||||
create table td (a int, PRIMARY KEY (a));
|
||||
|
||||
# casual_read = 1
|
||||
eval create table ts (a int, PRIMARY KEY (a)) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "$srv",TABLE "td", casual_read "1"';
|
||||
|
||||
insert into td values (11), (42);
|
||||
|
||||
select max(a) from ts;
|
||||
|
||||
select min(a) from ts;
|
||||
|
||||
drop table td, ts;
|
||||
|
||||
eval drop server $srv;
|
||||
set session spider_bgs_mode=@old_spider_bgs_mode;
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
--echo
|
||||
--echo end of test
|
||||
--echo
|
|
@ -1412,6 +1412,30 @@ int spider_free_conn(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/**
|
||||
May get or create a connection spawning a background thread
|
||||
|
||||
For each link (data node, formally representable as the tuple
|
||||
(spider, link_idx)), there is an associated casual read value
|
||||
(`spider->result_list.casual_read[link_idx]').
|
||||
|
||||
If the CRV is 0, do nothing. Otherwise, An casual read id
|
||||
(`conn->casual_read_current_id`) is associated with the link and
|
||||
query id. The CRI starts from 2, and is used only when CRV is 1, to
|
||||
update the CRV (see below). The updated CRV is then used to
|
||||
construct the connection key used for get or create a connection
|
||||
that spawns a background thread to execute queries.
|
||||
|
||||
If the CRV is 1, it is assigned CRI. The latter is then incremented
|
||||
by 1. The CRI will only go up to 63, before "wrapping" back to 2.
|
||||
|
||||
If 2 <= CRV <= 63, it is left alone.
|
||||
|
||||
Note that this function relies on the assumption that the CRV is
|
||||
reset (e.g. using `spider_param_casual_read()') between consecutive
|
||||
calls of this function for the CRV == 1 case to auto-increment as
|
||||
expected.
|
||||
*/
|
||||
int spider_check_and_get_casual_read_conn(
|
||||
THD *thd,
|
||||
ha_spider *spider,
|
||||
|
@ -1419,41 +1443,35 @@ int spider_check_and_get_casual_read_conn(
|
|||
) {
|
||||
int error_num;
|
||||
DBUG_ENTER("spider_check_and_get_casual_read_conn");
|
||||
if (spider->result_list.casual_read[link_idx])
|
||||
if (!spider->result_list.casual_read[link_idx])
|
||||
DBUG_RETURN(0);
|
||||
SPIDER_CONN *conn = spider->conns[link_idx];
|
||||
if (conn->casual_read_query_id != thd->query_id)
|
||||
{
|
||||
SPIDER_CONN *conn = spider->conns[link_idx];
|
||||
if (conn->casual_read_query_id != thd->query_id)
|
||||
{
|
||||
conn->casual_read_query_id = thd->query_id;
|
||||
conn->casual_read_current_id = 2;
|
||||
}
|
||||
if (spider->result_list.casual_read[link_idx] == 1)
|
||||
{
|
||||
spider->result_list.casual_read[link_idx] = conn->casual_read_current_id;
|
||||
++conn->casual_read_current_id;
|
||||
if (conn->casual_read_current_id > 63)
|
||||
{
|
||||
conn->casual_read_current_id = 2;
|
||||
}
|
||||
}
|
||||
char first_byte_bak = *spider->conn_keys[link_idx];
|
||||
*spider->conn_keys[link_idx] =
|
||||
'0' + spider->result_list.casual_read[link_idx];
|
||||
if (
|
||||
!(spider->conns[link_idx] =
|
||||
spider_get_conn(spider->share, link_idx,
|
||||
spider->conn_keys[link_idx], spider->wide_handler->trx,
|
||||
spider, FALSE, TRUE, SPIDER_CONN_KIND_MYSQL,
|
||||
&error_num))
|
||||
) {
|
||||
*spider->conn_keys[link_idx] = first_byte_bak;
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
*spider->conn_keys[link_idx] = first_byte_bak;
|
||||
spider->conns[link_idx]->casual_read_base_conn = conn;
|
||||
conn = spider->conns[link_idx];
|
||||
spider_check_and_set_autocommit(thd, conn, NULL);
|
||||
conn->casual_read_query_id = thd->query_id;
|
||||
conn->casual_read_current_id = 2;
|
||||
}
|
||||
if (spider->result_list.casual_read[link_idx] == 1)
|
||||
{
|
||||
spider->result_list.casual_read[link_idx] = conn->casual_read_current_id;
|
||||
++conn->casual_read_current_id;
|
||||
if (conn->casual_read_current_id > 63)
|
||||
conn->casual_read_current_id = 2;
|
||||
}
|
||||
char first_byte_bak = *spider->conn_keys[link_idx];
|
||||
*spider->conn_keys[link_idx] =
|
||||
'0' + spider->result_list.casual_read[link_idx];
|
||||
if (!(spider->conns[link_idx]= spider_get_conn(
|
||||
spider->share, link_idx, spider->conn_keys[link_idx],
|
||||
spider->wide_handler->trx, spider, FALSE, TRUE,
|
||||
SPIDER_CONN_KIND_MYSQL, &error_num)))
|
||||
{
|
||||
*spider->conn_keys[link_idx] = first_byte_bak;
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
*spider->conn_keys[link_idx] = first_byte_bak;
|
||||
spider->conns[link_idx]->casual_read_base_conn = conn;
|
||||
spider_check_and_set_autocommit(thd, spider->conns[link_idx], NULL);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -2409,6 +2427,12 @@ int spider_set_conn_bg_param(
|
|||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/**
|
||||
Creates a background thread on `conn' to run `spider_bg_conn_action()'
|
||||
|
||||
Does not create when `conn' is NULL or a bg thread has already been
|
||||
created for `conn'.
|
||||
*/
|
||||
int spider_create_conn_thread(
|
||||
SPIDER_CONN *conn
|
||||
) {
|
||||
|
@ -3238,11 +3262,6 @@ void *spider_bg_conn_action(
|
|||
}
|
||||
#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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if (spider->use_fields)
|
||||
{
|
||||
if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
|
||||
|
@ -3261,11 +3280,8 @@ void *spider_bg_conn_action(
|
|||
strmov(result_list->bgs_error_msg, spider_stmt_da_message(thd));
|
||||
}
|
||||
}
|
||||
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
sql_type &= ~SPIDER_SQL_TYPE_TMP_SQL;
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
|
|
|
@ -5181,27 +5181,14 @@ int spider_db_seek_next(
|
|||
spider_db_handler *dbton_handler =
|
||||
spider->dbton_handler[conn->dbton_id];
|
||||
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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
|
||||
link_idx)))
|
||||
{
|
||||
if (dbton_handler->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_PRINT("info",("spider error_num 6=%d", error_num));
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
if (conn->db_conn->limit_mode() == 1)
|
||||
{
|
||||
conn->db_conn->set_limit(result_list->limit_num);
|
||||
|
@ -5306,27 +5293,14 @@ int spider_db_seek_next(
|
|||
spider_db_handler *dbton_handler =
|
||||
spider->dbton_handler[conn->dbton_id];
|
||||
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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
|
||||
roop_count)))
|
||||
{
|
||||
if (dbton_handler->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_PRINT("info",("spider error_num 6=%d", error_num));
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
if (conn->db_conn->limit_mode() == 1)
|
||||
{
|
||||
conn->db_conn->set_limit(result_list->limit_num);
|
||||
|
@ -5594,25 +5568,12 @@ int spider_db_seek_last(
|
|||
conn = spider->conns[roop_count];
|
||||
spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id];
|
||||
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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_handler->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_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
if (conn->db_conn->limit_mode() == 1)
|
||||
{
|
||||
|
@ -5829,25 +5790,12 @@ int spider_db_seek_last(
|
|||
conn = spider->conns[roop_count];
|
||||
spider_db_handler *dbton_handler = spider->dbton_handler[conn->dbton_id];
|
||||
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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_handler->set_sql_for_exec(sql_type, roop_count)))
|
||||
{
|
||||
if (dbton_handler->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_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_PRINT("info",("spider sql_type=%lu", sql_type));
|
||||
conn->need_mon = &spider->need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
|
@ -6704,28 +6652,15 @@ int spider_db_bulk_insert(
|
|||
conn = spider->conns[roop_count2];
|
||||
dbton_handler = spider->dbton_handler[conn->dbton_id];
|
||||
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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_handler->set_sql_for_exec(sql_type,
|
||||
roop_count2)))
|
||||
{
|
||||
if (spider->sql_kinds & SPIDER_SQL_KIND_SQL)
|
||||
spider->set_insert_to_pos_sql(SPIDER_SQL_TYPE_INSERT_SQL);
|
||||
if (dbton_handler->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_handler->need_lock_before_set_sql_for_exec(sql_type))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
|
||||
} else {
|
||||
sql_type = SPIDER_SQL_TYPE_INSERT_HS;
|
||||
|
@ -7204,29 +7139,13 @@ int spider_db_bulk_update_size_limit(
|
|||
conn = spider->conns[roop_count];
|
||||
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_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(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
if ((error_num = spider_db_query_for_bulk_update(
|
||||
spider, conn, roop_count, &dup_key_found)))
|
||||
{
|
||||
|
@ -7300,33 +7219,17 @@ int spider_db_bulk_update_end(
|
|||
conn = spider->conns[roop_count];
|
||||
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||
}
|
||||
if (error_num == ER_SPIDER_COND_SKIP_NUM)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
DBUG_RETURN(error_num);
|
||||
}
|
||||
if (!dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
if ((error_num = spider_db_query_for_bulk_update(
|
||||
spider, conn, roop_count, dup_key_found)))
|
||||
{
|
||||
|
@ -7359,29 +7262,13 @@ int spider_db_bulk_update_end(
|
|||
conn = spider->conns[roop_count];
|
||||
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_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(
|
||||
SPIDER_SQL_TYPE_BULK_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
if ((error_num = spider_db_query_for_bulk_update(
|
||||
spider, conn, roop_count, dup_key_found)))
|
||||
{
|
||||
|
@ -7457,29 +7344,13 @@ int spider_db_update(
|
|||
conn->ignore_dup_key = spider->wide_handler->ignore_dup_key;
|
||||
#endif
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_UPDATE_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_UPDATE_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(
|
||||
SPIDER_SQL_TYPE_UPDATE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &spider->need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
|
@ -7808,25 +7679,12 @@ int spider_db_direct_update(
|
|||
#endif
|
||||
spider_db_handler *dbton_hdl = spider->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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (spider->is_bulk_access_clone)
|
||||
{
|
||||
|
@ -8087,25 +7945,12 @@ int spider_db_direct_update(
|
|||
sql_type = SPIDER_SQL_TYPE_UPDATE_SQL;
|
||||
spider_db_handler *dbton_hdl = spider->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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (spider->is_bulk_access_clone)
|
||||
{
|
||||
|
@ -8374,29 +8219,13 @@ int spider_db_delete(
|
|||
conn = spider->conns[roop_count];
|
||||
spider_db_handler *dbton_hdl = spider->dbton_handler[conn->dbton_id];
|
||||
pthread_mutex_assert_not_owner(&conn->mta_conn_mutex);
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_DELETE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_DELETE_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_DELETE_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(
|
||||
SPIDER_SQL_TYPE_DELETE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
conn->mta_conn_mutex_lock_already = TRUE;
|
||||
|
@ -8531,25 +8360,12 @@ int spider_db_direct_delete(
|
|||
#endif
|
||||
spider_db_handler *dbton_hdl = spider->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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (spider->is_bulk_access_clone)
|
||||
{
|
||||
|
@ -8770,25 +8586,12 @@ int spider_db_direct_delete(
|
|||
sql_type = SPIDER_SQL_TYPE_DELETE_SQL;
|
||||
spider_db_handler *dbton_hdl = spider->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);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
#ifdef HA_CAN_BULK_ACCESS
|
||||
if (spider->is_bulk_access_clone)
|
||||
{
|
||||
|
@ -8920,29 +8723,13 @@ int spider_db_delete_all_rows(
|
|||
spider_db_handler *dbton_hdl = spider->dbton_handler[dbton_id];
|
||||
conn = spider->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_DELETE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num = dbton_hdl->set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_DELETE_SQL, roop_count)))
|
||||
{
|
||||
if (dbton_hdl->need_lock_before_set_sql_for_exec(
|
||||
SPIDER_SQL_TYPE_DELETE_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(
|
||||
SPIDER_SQL_TYPE_DELETE_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
conn->need_mon = &spider->need_mons[roop_count];
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_lock_already);
|
||||
DBUG_ASSERT(!conn->mta_conn_mutex_unlock_later);
|
||||
|
|
|
@ -1665,9 +1665,6 @@ public:
|
|||
SPIDER_HS_STRING_REF &info
|
||||
) = 0;
|
||||
#endif
|
||||
virtual bool need_lock_before_set_sql_for_exec(
|
||||
ulong sql_type
|
||||
) = 0;
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
virtual int set_sql_for_exec(
|
||||
ulong sql_type,
|
||||
|
|
|
@ -13976,14 +13976,6 @@ int spider_mbase_handler::push_back_upds(
|
|||
}
|
||||
#endif
|
||||
|
||||
bool spider_mbase_handler::need_lock_before_set_sql_for_exec(
|
||||
ulong sql_type
|
||||
) {
|
||||
DBUG_ENTER("spider_mbase_handler::need_lock_before_set_sql_for_exec");
|
||||
DBUG_PRINT("info",("spider this=%p", this));
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int spider_mbase_handler::set_sql_for_exec(
|
||||
ulong sql_type,
|
||||
|
|
|
@ -1487,9 +1487,6 @@ public:
|
|||
SPIDER_HS_STRING_REF &info
|
||||
);
|
||||
#endif
|
||||
bool need_lock_before_set_sql_for_exec(
|
||||
ulong sql_type
|
||||
);
|
||||
#ifdef SPIDER_HAS_GROUP_BY_HANDLER
|
||||
int set_sql_for_exec(
|
||||
ulong sql_type,
|
||||
|
|
|
@ -1412,30 +1412,14 @@ 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))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
if ((error_num =
|
||||
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(
|
||||
SPIDER_SQL_TYPE_SELECT_SQL))
|
||||
{
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||
}
|
||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||
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);
|
||||
|
|
|
@ -1559,27 +1559,9 @@ int spider_check_and_set_autocommit(
|
|||
SPIDER_CONN *conn,
|
||||
int *need_mon
|
||||
) {
|
||||
bool autocommit;
|
||||
DBUG_ENTER("spider_check_and_set_autocommit");
|
||||
|
||||
autocommit = !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT);
|
||||
if (autocommit)
|
||||
{
|
||||
spider_conn_queue_autocommit(conn, TRUE);
|
||||
} else {
|
||||
spider_conn_queue_autocommit(conn, FALSE);
|
||||
}
|
||||
/*
|
||||
if (autocommit && conn->autocommit != 1)
|
||||
{
|
||||
spider_conn_queue_autocommit(conn, TRUE);
|
||||
conn->autocommit = 1;
|
||||
} else if (!autocommit && conn->autocommit != 0)
|
||||
{
|
||||
spider_conn_queue_autocommit(conn, FALSE);
|
||||
conn->autocommit = 0;
|
||||
}
|
||||
*/
|
||||
spider_conn_queue_autocommit(
|
||||
conn, !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -1601,17 +1583,6 @@ int spider_check_and_set_sql_log_off(
|
|||
spider_conn_queue_sql_log_off(conn, FALSE);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (internal_sql_log_off && conn->sql_log_off != 1)
|
||||
{
|
||||
spider_conn_queue_sql_log_off(conn, TRUE);
|
||||
conn->sql_log_off = 1;
|
||||
} else if (!internal_sql_log_off && conn->sql_log_off != 0)
|
||||
{
|
||||
spider_conn_queue_sql_log_off(conn, FALSE);
|
||||
conn->sql_log_off = 0;
|
||||
}
|
||||
*/
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue