mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
dry access
This commit is contained in:
@@ -3641,33 +3641,33 @@ int spider_db_store_result(
|
|||||||
}
|
}
|
||||||
DBUG_RETURN(error_num);
|
DBUG_RETURN(error_num);
|
||||||
}
|
}
|
||||||
if (
|
bool call_db_errorno = FALSE;
|
||||||
error_num != HA_ERR_END_OF_FILE &&
|
if (error_num != HA_ERR_END_OF_FILE)
|
||||||
(error_num = spider_db_errorno(conn))
|
{
|
||||||
)
|
call_db_errorno = TRUE;
|
||||||
DBUG_RETURN(error_num);
|
if ((error_num = spider_db_errorno(conn)))
|
||||||
else {
|
DBUG_RETURN(error_num);
|
||||||
DBUG_PRINT("info",("spider set finish_flg point 1"));
|
|
||||||
DBUG_PRINT("info",("spider current->finish_flg = TRUE"));
|
|
||||||
DBUG_PRINT("info",("spider result_list->finish_flg = TRUE"));
|
|
||||||
current->finish_flg = TRUE;
|
|
||||||
result_list->finish_flg = TRUE;
|
|
||||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
|
||||||
if (result_list->bgs_phase <= 1)
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
result_list->current_row_num = 0;
|
|
||||||
table->status = STATUS_NOT_FOUND;
|
|
||||||
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!conn->mta_conn_mutex_unlock_later)
|
|
||||||
{
|
|
||||||
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
|
||||||
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
|
||||||
}
|
|
||||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
|
||||||
}
|
}
|
||||||
|
DBUG_PRINT("info",("spider set finish_flg point 1"));
|
||||||
|
DBUG_PRINT("info",("spider current->finish_flg = TRUE"));
|
||||||
|
DBUG_PRINT("info",("spider result_list->finish_flg = TRUE"));
|
||||||
|
current->finish_flg = TRUE;
|
||||||
|
result_list->finish_flg = TRUE;
|
||||||
|
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||||
|
if (result_list->bgs_phase <= 1)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
result_list->current_row_num = 0;
|
||||||
|
table->status = STATUS_NOT_FOUND;
|
||||||
|
#ifndef WITHOUT_SPIDER_BG_SEARCH
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!conn->mta_conn_mutex_unlock_later && !call_db_errorno)
|
||||||
|
{
|
||||||
|
SPIDER_CLEAR_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||||
|
pthread_mutex_unlock(&conn->mta_conn_mutex);
|
||||||
|
}
|
||||||
|
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||||
} else {
|
} else {
|
||||||
if (!conn->mta_conn_mutex_unlock_later)
|
if (!conn->mta_conn_mutex_unlock_later)
|
||||||
{
|
{
|
||||||
|
@@ -1443,16 +1443,19 @@ int spider_db_mysql::connect(
|
|||||||
if (connect_mutex)
|
if (connect_mutex)
|
||||||
pthread_mutex_lock(&spider_open_conn_mutex);
|
pthread_mutex_lock(&spider_open_conn_mutex);
|
||||||
/* tgt_db not use */
|
/* tgt_db not use */
|
||||||
if (!mysql_real_connect(
|
if (
|
||||||
db_conn,
|
!spider_param_dry_access() &&
|
||||||
tgt_host,
|
!mysql_real_connect(
|
||||||
tgt_username,
|
db_conn,
|
||||||
tgt_password,
|
tgt_host,
|
||||||
NULL,
|
tgt_username,
|
||||||
tgt_port,
|
tgt_password,
|
||||||
tgt_socket,
|
NULL,
|
||||||
CLIENT_MULTI_STATEMENTS
|
tgt_port,
|
||||||
)) {
|
tgt_socket,
|
||||||
|
CLIENT_MULTI_STATEMENTS
|
||||||
|
)
|
||||||
|
) {
|
||||||
if (connect_mutex)
|
if (connect_mutex)
|
||||||
pthread_mutex_unlock(&spider_open_conn_mutex);
|
pthread_mutex_unlock(&spider_open_conn_mutex);
|
||||||
error_num = mysql_errno(db_conn);
|
error_num = mysql_errno(db_conn);
|
||||||
@@ -1484,6 +1487,8 @@ int spider_db_mysql::ping(
|
|||||||
) {
|
) {
|
||||||
DBUG_ENTER("spider_db_mysql::ping");
|
DBUG_ENTER("spider_db_mysql::ping");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
|
if (spider_param_dry_access())
|
||||||
|
DBUG_RETURN(0);
|
||||||
DBUG_RETURN(simple_command(db_conn, COM_PING, 0, 0, 0));
|
DBUG_RETURN(simple_command(db_conn, COM_PING, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1522,7 +1527,7 @@ int spider_db_mysql::exec_query(
|
|||||||
uint length,
|
uint length,
|
||||||
int quick_mode
|
int quick_mode
|
||||||
) {
|
) {
|
||||||
int error_num;
|
int error_num = 0;
|
||||||
uint log_result_errors = spider_param_log_result_errors();
|
uint log_result_errors = spider_param_log_result_errors();
|
||||||
DBUG_ENTER("spider_db_mysql::exec_query");
|
DBUG_ENTER("spider_db_mysql::exec_query");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
@@ -1544,7 +1549,10 @@ int spider_db_mysql::exec_query(
|
|||||||
general_log_write(current_thd, COM_QUERY, tmp_query_str.ptr(),
|
general_log_write(current_thd, COM_QUERY, tmp_query_str.ptr(),
|
||||||
tmp_query_str.length());
|
tmp_query_str.length());
|
||||||
}
|
}
|
||||||
error_num = mysql_real_query(db_conn, query, length);
|
if (!spider_param_dry_access())
|
||||||
|
{
|
||||||
|
error_num = mysql_real_query(db_conn, query, length);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
(error_num && log_result_errors >= 1) ||
|
(error_num && log_result_errors >= 1) ||
|
||||||
(log_result_errors >= 2 && db_conn->warning_count > 0) ||
|
(log_result_errors >= 2 && db_conn->warning_count > 0) ||
|
||||||
@@ -1705,13 +1713,16 @@ void spider_db_mysql::print_warnings(
|
|||||||
pthread_mutex_lock(&conn->mta_conn_mutex);
|
pthread_mutex_lock(&conn->mta_conn_mutex);
|
||||||
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
|
||||||
*/
|
*/
|
||||||
if (!mysql_real_query(db_conn, SPIDER_SQL_SHOW_WARNINGS_STR,
|
if (
|
||||||
SPIDER_SQL_SHOW_WARNINGS_LEN))
|
spider_param_dry_access() ||
|
||||||
{
|
!mysql_real_query(db_conn, SPIDER_SQL_SHOW_WARNINGS_STR,
|
||||||
MYSQL_RES *res;
|
SPIDER_SQL_SHOW_WARNINGS_LEN)
|
||||||
|
) {
|
||||||
|
MYSQL_RES *res = NULL;
|
||||||
MYSQL_ROW row = NULL;
|
MYSQL_ROW row = NULL;
|
||||||
uint num_fields;
|
uint num_fields;
|
||||||
if (
|
if (
|
||||||
|
spider_param_dry_access() ||
|
||||||
!(res = mysql_store_result(db_conn)) ||
|
!(res = mysql_store_result(db_conn)) ||
|
||||||
!(row = mysql_fetch_row(res))
|
!(row = mysql_fetch_row(res))
|
||||||
) {
|
) {
|
||||||
@@ -1772,8 +1783,10 @@ spider_db_result *spider_db_mysql::store_result(
|
|||||||
if ((result = new spider_db_mysql_result()))
|
if ((result = new spider_db_mysql_result()))
|
||||||
{
|
{
|
||||||
*error_num = 0;
|
*error_num = 0;
|
||||||
if (!(result->db_result = mysql_store_result(db_conn)))
|
if (
|
||||||
{
|
spider_param_dry_access() ||
|
||||||
|
!(result->db_result = mysql_store_result(db_conn))
|
||||||
|
) {
|
||||||
delete result;
|
delete result;
|
||||||
result = NULL;
|
result = NULL;
|
||||||
} else {
|
} else {
|
||||||
@@ -1796,8 +1809,10 @@ spider_db_result *spider_db_mysql::use_result(
|
|||||||
if ((result = new spider_db_mysql_result()))
|
if ((result = new spider_db_mysql_result()))
|
||||||
{
|
{
|
||||||
*error_num = 0;
|
*error_num = 0;
|
||||||
if (!(result->db_result = db_conn->methods->use_result(db_conn)))
|
if (
|
||||||
{
|
spider_param_dry_access() ||
|
||||||
|
!(result->db_result = db_conn->methods->use_result(db_conn))
|
||||||
|
) {
|
||||||
delete result;
|
delete result;
|
||||||
result = NULL;
|
result = NULL;
|
||||||
} else {
|
} else {
|
||||||
@@ -1869,6 +1884,8 @@ int spider_db_mysql::set_character_set(
|
|||||||
) {
|
) {
|
||||||
DBUG_ENTER("spider_db_mysql::set_character_set");
|
DBUG_ENTER("spider_db_mysql::set_character_set");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
|
if (spider_param_dry_access())
|
||||||
|
DBUG_RETURN(0);
|
||||||
DBUG_RETURN(mysql_set_character_set(db_conn, csname));
|
DBUG_RETURN(mysql_set_character_set(db_conn, csname));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1877,6 +1894,8 @@ int spider_db_mysql::select_db(
|
|||||||
) {
|
) {
|
||||||
DBUG_ENTER("spider_db_mysql::select_db");
|
DBUG_ENTER("spider_db_mysql::select_db");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
|
if (spider_param_dry_access())
|
||||||
|
DBUG_RETURN(0);
|
||||||
DBUG_RETURN(mysql_select_db(db_conn, dbname));
|
DBUG_RETURN(mysql_select_db(db_conn, dbname));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9879,6 +9898,14 @@ int spider_mysql_handler::show_table_status(
|
|||||||
request_key.handler = spider;
|
request_key.handler = spider;
|
||||||
request_key.request_id = 1;
|
request_key.request_id = 1;
|
||||||
request_key.next = NULL;
|
request_key.next = NULL;
|
||||||
|
if (spider_param_dry_access())
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
|
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
|
||||||
{
|
{
|
||||||
conn->mta_conn_mutex_lock_already = FALSE;
|
conn->mta_conn_mutex_lock_already = FALSE;
|
||||||
@@ -10004,6 +10031,14 @@ int spider_mysql_handler::show_table_status(
|
|||||||
request_key.handler = spider;
|
request_key.handler = spider;
|
||||||
request_key.request_id = 1;
|
request_key.request_id = 1;
|
||||||
request_key.next = NULL;
|
request_key.next = NULL;
|
||||||
|
if (spider_param_dry_access())
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
|
if (!(res = conn->db_conn->store_result(NULL, &request_key, &error_num)))
|
||||||
{
|
{
|
||||||
conn->mta_conn_mutex_lock_already = FALSE;
|
conn->mta_conn_mutex_lock_already = FALSE;
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
#define SPIDER_DETAIL_VERSION "3.1.12"
|
#define SPIDER_DETAIL_VERSION "3.1.13"
|
||||||
#define SPIDER_HEX_VERSION 0x0301
|
#define SPIDER_HEX_VERSION 0x0301
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID < 50500
|
#if MYSQL_VERSION_ID < 50500
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
#define SPIDER_SET_FILE_POS(A) \
|
#define SPIDER_SET_FILE_POS(A) \
|
||||||
{(A)->thd = current_thd; (A)->func_name = __func__; (A)->file_name = __FILE__; (A)->line_no = __LINE__;}
|
{(A)->thd = current_thd; (A)->func_name = __func__; (A)->file_name = __FILE__; (A)->line_no = __LINE__;}
|
||||||
#define SPIDER_CLEAR_FILE_POS(A) \
|
#define SPIDER_CLEAR_FILE_POS(A) \
|
||||||
{(A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;}
|
{DBUG_PRINT("info", ("spider thd=%p func_name=%s file_name=%s line_no=%lu", (A)->thd, (A)->func_name ? (A)->func_name : "NULL", (A)->file_name ? (A)->file_name : "NULL", (A)->line_no)); (A)->thd = NULL; (A)->func_name = NULL; (A)->file_name = NULL; (A)->line_no = 0;}
|
||||||
|
|
||||||
class ha_spider;
|
class ha_spider;
|
||||||
typedef struct st_spider_share SPIDER_SHARE;
|
typedef struct st_spider_share SPIDER_SHARE;
|
||||||
|
@@ -2914,6 +2914,23 @@ int spider_param_casual_read(
|
|||||||
casual_read : THDVAR(thd, casual_read));
|
casual_read : THDVAR(thd, casual_read));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static my_bool spider_dry_access;
|
||||||
|
static MYSQL_SYSVAR_BOOL(
|
||||||
|
dry_access,
|
||||||
|
spider_dry_access,
|
||||||
|
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
|
||||||
|
"dry access",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
my_bool spider_param_dry_access()
|
||||||
|
{
|
||||||
|
DBUG_ENTER("spider_param_dry_access");
|
||||||
|
DBUG_RETURN(spider_dry_access);
|
||||||
|
}
|
||||||
|
|
||||||
static struct st_mysql_storage_engine spider_storage_engine =
|
static struct st_mysql_storage_engine spider_storage_engine =
|
||||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
||||||
|
|
||||||
@@ -3045,6 +3062,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
|
|||||||
MYSQL_SYSVAR(version),
|
MYSQL_SYSVAR(version),
|
||||||
MYSQL_SYSVAR(internal_xa_id_type),
|
MYSQL_SYSVAR(internal_xa_id_type),
|
||||||
MYSQL_SYSVAR(casual_read),
|
MYSQL_SYSVAR(casual_read),
|
||||||
|
MYSQL_SYSVAR(dry_access),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -378,3 +378,4 @@ int spider_param_casual_read(
|
|||||||
THD *thd,
|
THD *thd,
|
||||||
int casual_read
|
int casual_read
|
||||||
);
|
);
|
||||||
|
my_bool spider_param_dry_access();
|
||||||
|
Reference in New Issue
Block a user