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
061c767c
Commit
061c767c
authored
Mar 29, 2018
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15773 - Simplified away trx_t::in_mysql_trx_list
parent
d6d58836
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
39 deletions
+20
-39
storage/innobase/dict/dict0crea.cc
storage/innobase/dict/dict0crea.cc
+6
-6
storage/innobase/dict/dict0stats.cc
storage/innobase/dict/dict0stats.cc
+1
-1
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0trx.h
+2
-7
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+1
-1
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0purge.cc
+1
-1
storage/innobase/trx/trx0roll.cc
storage/innobase/trx/trx0roll.cc
+6
-6
storage/innobase/trx/trx0trx.cc
storage/innobase/trx/trx0trx.cc
+3
-17
No files found.
storage/innobase/dict/dict0crea.cc
View file @
061c767c
...
...
@@ -1504,7 +1504,7 @@ dict_create_or_check_foreign_constraint_tables(void)
return
(
DB_READ_ONLY
);
}
trx
=
trx_
allocate_for_mysql
();
trx
=
trx_
create
();
trx_set_dict_operation
(
trx
,
TRX_DICT_OP_TABLE
);
...
...
@@ -1588,7 +1588,7 @@ dict_create_or_check_foreign_constraint_tables(void)
row_mysql_unlock_data_dictionary
(
trx
);
trx_free_for_
mysql
(
trx
);
trx_free_for_
background
(
trx
);
srv_file_per_table
=
srv_file_per_table_backup
;
...
...
@@ -1634,7 +1634,7 @@ dict_create_or_check_sys_virtual()
return
(
DB_READ_ONLY
);
}
trx
=
trx_
allocate_for_mysql
();
trx
=
trx_
create
();
trx_set_dict_operation
(
trx
,
TRX_DICT_OP_TABLE
);
...
...
@@ -1692,7 +1692,7 @@ dict_create_or_check_sys_virtual()
row_mysql_unlock_data_dictionary
(
trx
);
trx_free_for_
mysql
(
trx
);
trx_free_for_
background
(
trx
);
srv_file_per_table
=
srv_file_per_table_backup
;
...
...
@@ -2289,7 +2289,7 @@ dict_create_or_check_sys_tablespace(void)
return
(
DB_READ_ONLY
);
}
trx
=
trx_
allocate_for_mysql
();
trx
=
trx_
create
();
trx_set_dict_operation
(
trx
,
TRX_DICT_OP_TABLE
);
...
...
@@ -2356,7 +2356,7 @@ dict_create_or_check_sys_tablespace(void)
row_mysql_unlock_data_dictionary
(
trx
);
trx_free_for_
mysql
(
trx
);
trx_free_for_
background
(
trx
);
srv_file_per_table
=
srv_file_per_table_backup
;
...
...
storage/innobase/dict/dict0stats.cc
View file @
061c767c
...
...
@@ -2320,7 +2320,7 @@ dict_stats_save_index_stat(
char
db_utf8
[
MAX_DB_UTF8_LEN
];
char
table_utf8
[
MAX_TABLE_UTF8_LEN
];
ut_ad
(
!
trx
||
trx
->
internal
||
trx
->
in_mysql_trx_list
);
ut_ad
(
!
trx
||
trx
->
internal
||
trx
->
mysql_thd
);
ut_ad
(
rw_lock_own
(
dict_operation_lock
,
RW_LOCK_X
));
ut_ad
(
mutex_own
(
&
dict_sys
->
mutex
));
...
...
storage/innobase/include/trx0trx.h
View file @
061c767c
...
...
@@ -521,7 +521,7 @@ The tranasction must be in the mysql_trx_list. */
trx_state_t t_state = (t)->state; \
ut_ad((t)->read_only); \
ut_ad(!(t)->is_recovered); \
ut_ad((t)->
in_mysql_trx_list);
\
ut_ad((t)->
mysql_thd);
\
ut_ad(t_state == TRX_STATE_NOT_STARTED \
|| t_state == TRX_STATE_ACTIVE); \
} else { \
...
...
@@ -854,7 +854,7 @@ struct trx_t {
do we remove it from the read-only list and put it on the read-write
list. During this switch we assign it a rollback segment.
When a transaction is NOT_STARTED, it can be in
_
mysql_trx_list if
When a transaction is NOT_STARTED, it can be in
mysql_trx_list if
it is a user transaction. It cannot be in rw_trx_hash.
ACTIVE->PREPARED->COMMITTED is only possible when trx is in rw_trx_hash.
...
...
@@ -976,11 +976,6 @@ struct trx_t {
UT_LIST_NODE_T
(
trx_t
)
mysql_trx_list
;
/*!< list of transactions created for
MySQL; protected by trx_sys.mutex */
#ifdef UNIV_DEBUG
bool
in_mysql_trx_list
;
/*!< true if in
trx_sys.mysql_trx_list */
#endif
/* UNIV_DEBUG */
/*------------------------------*/
dberr_t
error_state
;
/*!< 0 if no error, otherwise error
number; NOTE That ONLY the thread
...
...
storage/innobase/lock/lock0lock.cc
View file @
061c767c
...
...
@@ -4674,7 +4674,7 @@ struct PrintNotStarted {
void
operator
()(
const
trx_t
*
trx
)
{
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
ut_ad
(
mutex_own
(
&
trx_sys
.
mutex
));
/* See state transitions and locking rules in trx0trx.h */
...
...
storage/innobase/trx/trx0purge.cc
View file @
061c767c
...
...
@@ -279,7 +279,7 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr)
&&
purge_sys
.
state
==
PURGE_STATE_INIT
)
||
(
srv_force_recovery
>=
SRV_FORCE_NO_BACKGROUND
&&
purge_sys
.
state
==
PURGE_STATE_DISABLED
)
||
((
trx
->
undo_no
==
0
||
trx
->
in_mysql_trx_list
||
((
trx
->
undo_no
==
0
||
trx
->
mysql_thd
||
trx
->
internal
)
&&
srv_fast_shutdown
));
...
...
storage/innobase/trx/trx0roll.cc
View file @
061c767c
...
...
@@ -201,11 +201,11 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
switch
(
trx
->
state
)
{
case
TRX_STATE_NOT_STARTED
:
trx
->
will_lock
=
0
;
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
return
(
DB_SUCCESS
);
case
TRX_STATE_ACTIVE
:
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
assert_trx_nonlocking_or_in_list
(
trx
);
return
(
trx_rollback_for_mysql_low
(
trx
));
...
...
@@ -282,7 +282,7 @@ trx_rollback_last_sql_stat_for_mysql(
here, because the statement rollback should be invoked for a
running active MySQL transaction that is associated with the
current thread. */
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
switch
(
trx
->
state
)
{
case
TRX_STATE_NOT_STARTED
:
...
...
@@ -404,7 +404,7 @@ trx_rollback_to_savepoint_for_mysql_low(
dberr_t
err
;
ut_ad
(
trx_state_eq
(
trx
,
TRX_STATE_ACTIVE
));
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
/* Free all savepoints strictly later than savep. */
...
...
@@ -461,7 +461,7 @@ trx_rollback_to_savepoint_for_mysql(
here, because the savepoint rollback should be invoked for a
running active MySQL transaction that is associated with the
current thread. */
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
savep
=
trx_savepoint_find
(
trx
,
savepoint_name
);
...
...
@@ -554,7 +554,7 @@ trx_release_savepoint_for_mysql(
ut_ad
(
trx_state_eq
(
trx
,
TRX_STATE_ACTIVE
,
true
)
||
trx_state_eq
(
trx
,
TRX_STATE_PREPARED
,
true
));
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_ad
(
trx
->
mysql_thd
);
savep
=
trx_savepoint_find
(
trx
,
savepoint_name
);
...
...
storage/innobase/trx/trx0trx.cc
View file @
061c767c
...
...
@@ -238,7 +238,7 @@ struct TrxFactory {
static
void
destroy
(
trx_t
*
trx
)
{
ut_a
(
trx
->
magic_n
==
TRX_MAGIC_N
);
ut_ad
(
!
trx
->
in_mysql_trx_list
);
ut_ad
(
!
trx
->
mysql_thd
);
ut_a
(
trx
->
lock
.
wait_lock
==
NULL
);
ut_a
(
trx
->
lock
.
wait_thr
==
NULL
);
...
...
@@ -303,8 +303,6 @@ struct TrxFactory {
ut_ad
(
trx
->
mysql_thd
==
0
);
ut_ad
(
!
trx
->
in_mysql_trx_list
);
ut_a
(
trx
->
lock
.
wait_thr
==
NULL
);
ut_a
(
trx
->
lock
.
wait_lock
==
NULL
);
ut_a
(
trx
->
dict_operation_lock_mode
==
0
);
...
...
@@ -475,10 +473,7 @@ trx_allocate_for_mysql(void)
trx
=
trx_create
();
mutex_enter
(
&
trx_sys
.
mutex
);
ut_d
(
trx
->
in_mysql_trx_list
=
TRUE
);
UT_LIST_ADD_FIRST
(
trx_sys
.
mysql_trx_list
,
trx
);
mutex_exit
(
&
trx_sys
.
mutex
);
return
(
trx
);
...
...
@@ -586,13 +581,10 @@ trx_disconnect_from_mysql(
trx_t
*
trx
,
bool
prepared
)
{
ut_ad
(
trx
->
mysql_thd
);
trx
->
read_view
.
close
();
mutex_enter
(
&
trx_sys
.
mutex
);
ut_ad
(
trx
->
in_mysql_trx_list
);
ut_d
(
trx
->
in_mysql_trx_list
=
FALSE
);
UT_LIST_REMOVE
(
trx_sys
.
mysql_trx_list
,
trx
);
if
(
prepared
)
{
...
...
@@ -604,7 +596,6 @@ trx_disconnect_from_mysql(
/* todo/fixme: suggest to do it at innodb prepare */
trx
->
will_lock
=
0
;
}
mutex_exit
(
&
trx_sys
.
mutex
);
}
...
...
@@ -1061,11 +1052,6 @@ trx_start_low(
ut_a
(
ib_vector_is_empty
(
trx
->
autoinc_locks
));
ut_a
(
trx
->
lock
.
table_locks
.
empty
());
/* If this transaction came from trx_allocate_for_mysql(),
trx->in_mysql_trx_list would hold. In that case, the trx->state
change must be protected by the trx_sys.mutex, so that
lock_print_info_all_transactions() will have a consistent view. */
/* No other thread can access this trx object through rw_trx_hash, thus
we don't need trx_sys.mutex protection for that purpose. Still this
trx can be found through trx_sys.mysql_trx_list, which means state
...
...
@@ -1541,7 +1527,7 @@ trx_commit_in_memory(
DBUG_LOG
(
"trx"
,
"Commit in memory: "
<<
trx
);
trx
->
state
=
TRX_STATE_NOT_STARTED
;
/* trx->
in_mysql_trx_list
would hold between
/* trx->
mysql_thd != 0
would hold between
trx_allocate_for_mysql() and trx_free_for_mysql(). It does not
hold for recovered transactions or system transactions. */
assert_trx_is_free
(
trx
);
...
...
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