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
462cb666
Commit
462cb666
authored
Jan 15, 2021
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Replace lock_mode_string() with a table lookup
parent
e71e6133
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
29 deletions
+15
-29
storage/innobase/include/lock0priv.h
storage/innobase/include/lock0priv.h
+13
-1
storage/innobase/include/lock0types.h
storage/innobase/include/lock0types.h
+2
-28
No files found.
storage/innobase/include/lock0priv.h
View file @
462cb666
...
@@ -72,7 +72,19 @@ ib_lock_t::type_mode_string() const
...
@@ -72,7 +72,19 @@ ib_lock_t::type_mode_string() const
{
{
std
::
ostringstream
sout
;
std
::
ostringstream
sout
;
sout
<<
type_string
();
sout
<<
type_string
();
sout
<<
" | "
<<
lock_mode_string
(
mode
());
static_assert
(
LOCK_MODE_MASK
==
7
,
"compatibility"
);
static_assert
(
LOCK_IS
==
0
,
"compatibility"
);
static_assert
(
LOCK_IX
==
1
,
"compatibility"
);
static_assert
(
LOCK_S
==
2
,
"compatibility"
);
static_assert
(
LOCK_X
==
3
,
"compatibility"
);
static_assert
(
LOCK_AUTO_INC
==
4
,
"compatibility"
);
static_assert
(
LOCK_NONE
==
5
,
"compatibility"
);
static_assert
(
LOCK_NONE_UNSET
==
7
,
"compatibility"
);
const
char
*
const
modes
[
8
]
=
{
"IS"
,
"IX"
,
"S"
,
"X"
,
"AUTO_INC"
,
"NONE"
,
"?"
,
"NONE_UNSET"
};
sout
<<
" | LOCK_"
<<
modes
[
mode
()];
if
(
is_record_not_gap
())
{
if
(
is_record_not_gap
())
{
sout
<<
" | LOCK_REC_NOT_GAP"
;
sout
<<
" | LOCK_REC_NOT_GAP"
;
...
...
storage/innobase/include/lock0types.h
View file @
462cb666
...
@@ -46,35 +46,9 @@ enum lock_mode {
...
@@ -46,35 +46,9 @@ enum lock_mode {
in an exclusive mode */
in an exclusive mode */
LOCK_NONE
,
/* this is used elsewhere to note consistent read */
LOCK_NONE
,
/* this is used elsewhere to note consistent read */
LOCK_NUM
=
LOCK_NONE
,
/* number of lock modes */
LOCK_NUM
=
LOCK_NONE
,
/* number of lock modes */
LOCK_NONE_UNSET
=
255
LOCK_NONE_UNSET
=
7
};
};
/** Convert the given enum value into string.
@param[in] mode the lock mode
@return human readable string of the given enum value */
inline
const
char
*
lock_mode_string
(
enum
lock_mode
mode
)
{
switch
(
mode
)
{
case
LOCK_IS
:
return
(
"LOCK_IS"
);
case
LOCK_IX
:
return
(
"LOCK_IX"
);
case
LOCK_S
:
return
(
"LOCK_S"
);
case
LOCK_X
:
return
(
"LOCK_X"
);
case
LOCK_AUTO_INC
:
return
(
"LOCK_AUTO_INC"
);
case
LOCK_NONE
:
return
(
"LOCK_NONE"
);
case
LOCK_NONE_UNSET
:
return
(
"LOCK_NONE_UNSET"
);
default:
ut_error
;
}
}
/** A table lock */
/** A table lock */
struct
lock_table_t
{
struct
lock_table_t
{
dict_table_t
*
table
;
/*!< database table in dictionary
dict_table_t
*
table
;
/*!< database table in dictionary
...
@@ -121,7 +95,7 @@ operator<<(std::ostream& out, const lock_rec_t& lock)
...
@@ -121,7 +95,7 @@ operator<<(std::ostream& out, const lock_rec_t& lock)
return
(
lock
.
print
(
out
));
return
(
lock
.
print
(
out
));
}
}
#define LOCK_MODE_MASK 0x
FUL
/*!< mask used to extract mode from the
#define LOCK_MODE_MASK 0x
7
/*!< mask used to extract mode from the
type_mode field in a lock */
type_mode field in a lock */
/** Lock types */
/** Lock types */
/* @{ */
/* @{ */
...
...
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