Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7144f7f2
Commit
7144f7f2
authored
Feb 17, 2013
by
Seppo Jaakola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
References
https://mariadb.atlassian.net/browse/MDEV-4176
Avoiding ha_kill_query for aborts initiated by replicator
parent
2a6aa0a3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
16 deletions
+26
-16
sql/sql_class.cc
sql/sql_class.cc
+8
-3
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+4
-0
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+1
-1
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+5
-5
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/ha_innodb.h
+1
-1
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+5
-5
storage/xtradb/handler/ha_innodb.h
storage/xtradb/handler/ha_innodb.h
+1
-1
No files found.
sql/sql_class.cc
View file @
7144f7f2
...
...
@@ -893,10 +893,11 @@ extern "C" void wsrep_thd_set_wsrep_last_query_id(THD *thd, query_id_t id)
{
thd
->
wsrep_last_query_id
=
id
;
}
extern
"C"
void
wsrep_thd_awake
(
THD
*
thd
,
my_bool
signal
)
extern
"C"
void
wsrep_thd_awake
(
THD
*
bf_thd
,
THD
*
thd
,
my_bool
signal
)
{
if
(
signal
)
{
thd
->
wsrep_bf_thd
=
bf_thd
;
mysql_mutex_lock
(
&
thd
->
LOCK_thd_data
);
thd
->
awake
(
KILL_QUERY
);
mysql_mutex_unlock
(
&
thd
->
LOCK_thd_data
);
...
...
@@ -1114,7 +1115,7 @@ THD::THD()
wsrep_consistency_check
=
NO_CONSISTENCY_CHECK
;
wsrep_status_vars
=
0
;
wsrep_mysql_replicated
=
0
;
wsrep_bf_thd
=
NULL
;
#endif
/* Call to init() below requires fully initialized Open_tables_state. */
reset_open_tables_state
(
this
);
...
...
@@ -1469,6 +1470,7 @@ void THD::init(void)
wsrep_seqno_changed
=
false
;
wsrep_consistency_check
=
NO_CONSISTENCY_CHECK
;
wsrep_mysql_replicated
=
0
;
wsrep_bf_thd
=
NULL
;
#endif
if
(
variables
.
sql_log_bin
)
variables
.
option_bits
|=
OPTION_BIN_LOG
;
...
...
@@ -1836,8 +1838,11 @@ void THD::awake(killed_state state_to_set)
/* Interrupt target waiting inside a storage engine. */
if
(
state_to_set
!=
NOT_KILLED
)
#ifdef WITH_WSREP
if
(
!
wsrep_bf_thd
||
wsrep_bf_thd
->
wsrep_exec_mode
==
LOCAL_STATE
)
#else
ha_kill_query
(
this
,
thd_kill_level
(
this
));
#endif
/* WITH_WSREP */
/* Broadcast a condition to kick the target if it is waiting on it. */
if
(
mysys_var
)
{
...
...
sql/sql_class.h
View file @
7144f7f2
...
...
@@ -2376,6 +2376,7 @@ class THD :public Statement,
wsrep_consistency_check
;
wsrep_stats_var
*
wsrep_status_vars
;
int
wsrep_mysql_replicated
;
THD
*
wsrep_bf_thd
;
#endif
/* WITH_WSREP */
/**
Internal parser state.
...
...
sql/sql_parse.cc
View file @
7144f7f2
...
...
@@ -786,6 +786,7 @@ bool do_command(THD *thd)
else
if
(
thd
->
wsrep_conflict_state
==
ABORTED
)
{
thd
->
store_globals
();
thd
->
wsrep_bf_thd
=
NULL
;
}
thd
->
wsrep_query_state
=
QUERY_EXEC
;
...
...
@@ -1059,6 +1060,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd
->
mysys_var
->
abort
=
0
;
thd
->
wsrep_conflict_state
=
NO_CONFLICT
;
thd
->
wsrep_retry_counter
=
0
;
thd
->
wsrep_bf_thd
=
NULL
;
/*
Increment threads running to compensate dec_thread_running() called
after dispatch_end label.
...
...
@@ -6131,6 +6133,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
my_error
(
ER_LOCK_DEADLOCK
,
MYF
(
0
),
"wsrep aborted transaction"
);
}
thd
->
wsrep_conflict_state
=
ABORTED
;
thd
->
wsrep_bf_thd
=
NULL
;
wsrep
->
post_rollback
(
wsrep
,
&
thd
->
wsrep_trx_handle
);
break
;
default:
...
...
@@ -7992,6 +7995,7 @@ static void wsrep_client_rollback(THD *thd)
}
mysql_mutex_lock
(
&
thd
->
LOCK_wsrep_thd
);
thd
->
wsrep_conflict_state
=
ABORTED
;
thd
->
wsrep_bf_thd
=
NULL
;
}
static
enum
wsrep_status
wsrep_apply_sql
(
...
...
sql/wsrep_mysqld.h
View file @
7144f7f2
...
...
@@ -205,7 +205,7 @@ extern "C" query_id_t wsrep_thd_query_id(THD *thd);
extern
"C"
char
*
wsrep_thd_query
(
THD
*
thd
);
extern
"C"
query_id_t
wsrep_thd_wsrep_last_query_id
(
THD
*
thd
);
extern
"C"
void
wsrep_thd_set_wsrep_last_query_id
(
THD
*
thd
,
query_id_t
id
);
extern
"C"
void
wsrep_thd_awake
(
THD
*
thd
,
my_bool
signal
);
extern
"C"
void
wsrep_thd_awake
(
THD
*
bf_thd
,
THD
*
thd
,
my_bool
signal
);
...
...
storage/innobase/handler/ha_innodb.cc
View file @
7144f7f2
...
...
@@ -12376,7 +12376,7 @@ wsrep_innobase_kill_one_trx(void *bf_thd_ptr, trx_t *bf_trx, trx_t *victim_trx,
WSREP_DEBUG
(
"victim %llu in MUST ABORT state"
,
victim_trx
->
id
);
wsrep_thd_UNLOCK
(
thd
);
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
DBUG_RETURN
(
0
);
break
;
case
ABORTED
:
...
...
@@ -12395,7 +12395,7 @@ wsrep_innobase_kill_one_trx(void *bf_thd_ptr, trx_t *bf_trx, trx_t *victim_trx,
WSREP_DEBUG
(
"kill query for: %ld"
,
wsrep_thd_thread_id
(
thd
));
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
WSREP_DEBUG
(
"kill trx QUERY_COMMITTING for %llu"
,
victim_trx
->
id
);
...
...
@@ -12448,14 +12448,14 @@ wsrep_innobase_kill_one_trx(void *bf_thd_ptr, trx_t *bf_trx, trx_t *victim_trx,
lock_cancel_waiting_and_release
(
wait_lock
);
}
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
}
else
{
/* abort currently executing query */
DBUG_PRINT
(
"wsrep"
,(
"sending KILL_QUERY to: %ld"
,
wsrep_thd_thread_id
(
thd
)));
WSREP_DEBUG
(
"kill query for: %ld"
,
wsrep_thd_thread_id
(
thd
));
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
/* for BF thd, we need to prevent him from committing */
if
(
wsrep_thd_exec_mode
(
thd
)
==
REPL_RECV
)
{
...
...
@@ -12546,7 +12546,7 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
wsrep_thd_LOCK
(
victim_thd
);
wsrep_thd_set_conflict_state
(
victim_thd
,
MUST_ABORT
);
wsrep_thd_UNLOCK
(
victim_thd
);
wsrep_thd_awake
(
victim_thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
victim_thd
,
signal
);
}
DBUG_RETURN
(
-
1
);
}
...
...
storage/innobase/handler/ha_innodb.h
View file @
7144f7f2
...
...
@@ -328,7 +328,7 @@ extern "C" query_id_t wsrep_thd_query_id(THD *thd);
extern
"C"
char
*
wsrep_thd_query
(
THD
*
thd
);
extern
"C"
query_id_t
wsrep_thd_wsrep_last_query_id
(
THD
*
thd
);
extern
"C"
void
wsrep_thd_set_wsrep_last_query_id
(
THD
*
thd
,
query_id_t
id
);
extern
"C"
void
wsrep_thd_awake
(
THD
*
thd
,
my_bool
signal
);
extern
"C"
void
wsrep_thd_awake
(
THD
*
bf_thd
,
THD
*
thd
,
my_bool
signal
);
#endif
typedef
struct
trx_struct
trx_t
;
/********************************************************************//**
...
...
storage/xtradb/handler/ha_innodb.cc
View file @
7144f7f2
...
...
@@ -13502,7 +13502,7 @@ wsrep_innobase_kill_one_trx(trx_t *bf_trx, trx_t *victim_trx, ibool signal)
WSREP_DEBUG
(
"victim %llu in MUST ABORT state"
,
victim_trx
->
id
);
wsrep_thd_UNLOCK
(
thd
);
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
DBUG_RETURN
(
0
);
break
;
case
ABORTED
:
...
...
@@ -13521,7 +13521,7 @@ wsrep_innobase_kill_one_trx(trx_t *bf_trx, trx_t *victim_trx, ibool signal)
WSREP_DEBUG
(
"kill query for: %ld"
,
wsrep_thd_thread_id
(
thd
));
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
WSREP_DEBUG
(
"kill trx QUERY_COMMITTING for %llu"
,
victim_trx
->
id
);
...
...
@@ -13574,14 +13574,14 @@ wsrep_innobase_kill_one_trx(trx_t *bf_trx, trx_t *victim_trx, ibool signal)
lock_cancel_waiting_and_release
(
wait_lock
);
}
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
}
else
{
/* abort currently executing query */
DBUG_PRINT
(
"wsrep"
,(
"sending KILL_QUERY to: %ld"
,
wsrep_thd_thread_id
(
thd
)));
WSREP_DEBUG
(
"kill query for: %ld"
,
wsrep_thd_thread_id
(
thd
));
wsrep_thd_awake
(
thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
thd
,
signal
);
/* for BF thd, we need to prevent him from committing */
if
(
wsrep_thd_exec_mode
(
thd
)
==
REPL_RECV
)
{
...
...
@@ -13672,7 +13672,7 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd,
wsrep_thd_LOCK
(
victim_thd
);
wsrep_thd_set_conflict_state
(
victim_thd
,
MUST_ABORT
);
wsrep_thd_UNLOCK
(
victim_thd
);
wsrep_thd_awake
(
victim_thd
,
signal
);
wsrep_thd_awake
(
bf_thd
,
victim_thd
,
signal
);
}
DBUG_RETURN
(
-
1
);
}
...
...
storage/xtradb/handler/ha_innodb.h
View file @
7144f7f2
...
...
@@ -404,7 +404,7 @@ extern "C" query_id_t wsrep_thd_query_id(THD *thd);
extern
"C"
char
*
wsrep_thd_query
(
THD
*
thd
);
extern
"C"
query_id_t
wsrep_thd_wsrep_last_query_id
(
THD
*
thd
);
extern
"C"
void
wsrep_thd_set_wsrep_last_query_id
(
THD
*
thd
,
query_id_t
id
);
extern
"C"
void
wsrep_thd_awake
(
THD
*
thd
,
my_bool
signal
);
extern
"C"
void
wsrep_thd_awake
(
THD
*
bf_thd
,
THD
*
thd
,
my_bool
signal
);
#endif
typedef
struct
trx_struct
trx_t
;
/********************************************************************//**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment