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
8a4ca339
Commit
8a4ca339
authored
Jan 05, 2021
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Declare trx_weight_ge() inline
parent
bd52f1a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
45 deletions
+11
-45
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0trx.h
+0
-10
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+11
-0
storage/innobase/trx/trx0trx.cc
storage/innobase/trx/trx0trx.cc
+0
-35
No files found.
storage/innobase/include/trx0trx.h
View file @
8a4ca339
...
...
@@ -328,16 +328,6 @@ is estimated as the number of altered rows + the number of locked rows.
@return transaction weight */
#define TRX_WEIGHT(t) ((t)->undo_no + UT_LIST_GET_LEN((t)->lock.trx_locks))
/*******************************************************************//**
Compares the "weight" (or size) of two transactions. Transactions that
have edited non-transactional tables are considered heavier than ones
that have not.
@return true if weight(a) >= weight(b) */
bool
trx_weight_ge
(
/*==========*/
const
trx_t
*
a
,
/*!< in: the transaction to be compared */
const
trx_t
*
b
);
/*!< in: the transaction to be compared */
/* Maximum length of a string that can be returned by
trx_get_que_state_str(). */
#define TRX_QUE_STATE_STR_MAX_LEN 12
/* "ROLLING BACK" */
...
...
storage/innobase/lock/lock0lock.cc
View file @
8a4ca339
...
...
@@ -6093,6 +6093,17 @@ DeadlockChecker::notify(const lock_t* lock) const
DBUG_PRINT
(
"ib_lock"
,
(
"deadlock detected"
));
}
/** Compare the "weight" (or size) of two transactions. Transactions that
have edited non-transactional tables are considered heavier than ones
that have not.
@return whether a is heavier than b */
inline
bool
trx_weight_ge
(
const
trx_t
*
a
,
const
trx_t
*
b
)
{
bool
a_notrans
=
a
->
mysql_thd
&&
thd_has_edited_nontrans_tables
(
a
->
mysql_thd
);
bool
b_notrans
=
b
->
mysql_thd
&&
thd_has_edited_nontrans_tables
(
b
->
mysql_thd
);
return
a_notrans
!=
b_notrans
?
a_notrans
:
TRX_WEIGHT
(
a
)
>=
TRX_WEIGHT
(
b
);
}
/** Select the victim transaction that should be rolledback.
@return victim transaction */
const
trx_t
*
...
...
storage/innobase/trx/trx0trx.cc
View file @
8a4ca339
...
...
@@ -1902,41 +1902,6 @@ trx_print(
n_rec_locks
,
n_trx_locks
,
heap_size
);
}
/*******************************************************************//**
Compares the "weight" (or size) of two transactions. Transactions that
have edited non-transactional tables are considered heavier than ones
that have not.
@return TRUE if weight(a) >= weight(b) */
bool
trx_weight_ge
(
/*==========*/
const
trx_t
*
a
,
/*!< in: transaction to be compared */
const
trx_t
*
b
)
/*!< in: transaction to be compared */
{
ibool
a_notrans_edit
;
ibool
b_notrans_edit
;
/* If mysql_thd is NULL for a transaction we assume that it has
not edited non-transactional tables. */
a_notrans_edit
=
a
->
mysql_thd
!=
NULL
&&
thd_has_edited_nontrans_tables
(
a
->
mysql_thd
);
b_notrans_edit
=
b
->
mysql_thd
!=
NULL
&&
thd_has_edited_nontrans_tables
(
b
->
mysql_thd
);
if
(
a_notrans_edit
!=
b_notrans_edit
)
{
return
(
a_notrans_edit
);
}
/* Either both had edited non-transactional tables or both had
not, we fall back to comparing the number of altered/locked
rows. */
return
(
TRX_WEIGHT
(
a
)
>=
TRX_WEIGHT
(
b
));
}
/** Prepare a transaction.
@return log sequence number that makes the XA PREPARE durable
@retval 0 if no changes needed to be made durable */
...
...
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