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
8513007c
Commit
8513007c
authored
Mar 01, 2021
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Remove some lock accessor functions
parent
8d16da14
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
87 deletions
+20
-87
storage/innobase/include/lock0lock.h
storage/innobase/include/lock0lock.h
+0
-23
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+0
-54
storage/innobase/trx/trx0i_s.cc
storage/innobase/trx/trx0i_s.cc
+20
-10
No files found.
storage/innobase/include/lock0lock.h
View file @
8513007c
...
...
@@ -481,29 +481,6 @@ lock_number_of_tables_locked(
const
trx_lock_t
*
trx_lock
)
/*!< in: transaction locks */
MY_ATTRIBUTE
((
warn_unused_result
));
/*******************************************************************//**
Gets the id of the table on which the lock is.
@return id of the table */
table_id_t
lock_get_table_id
(
/*==============*/
const
lock_t
*
lock
);
/*!< in: lock */
/** Determine which table a lock is associated with.
@param[in] lock the lock
@return name of the table */
const
table_name_t
&
lock_get_table_name
(
const
lock_t
*
lock
);
/*******************************************************************//**
For a record lock, gets the index on which the lock is.
@return index */
const
dict_index_t
*
lock_rec_get_index
(
/*===============*/
const
lock_t
*
lock
);
/*!< in: lock */
/** Check if there are any locks on a table.
@return true if table has either table or record locks. */
bool
lock_table_has_locks
(
dict_table_t
*
table
);
...
...
storage/innobase/lock/lock0lock.cc
View file @
8513007c
...
...
@@ -5359,60 +5359,6 @@ static void lock_release_autoinc_locks(trx_t *trx, bool owns_wait_mutex)
}
}
/*******************************************************************//**
Gets the table on which the lock is.
@return table */
UNIV_INLINE
dict_table_t
*
lock_get_table
(
/*===========*/
const
lock_t
*
lock
)
/*!< in: lock */
{
if
(
lock
->
is_table
())
return
lock
->
un_member
.
tab_lock
.
table
;
ut_ad
(
lock
->
index
->
is_primary
()
||
!
dict_index_is_online_ddl
(
lock
->
index
));
return
lock
->
index
->
table
;
}
/*******************************************************************//**
Gets the id of the table on which the lock is.
@return id of the table */
table_id_t
lock_get_table_id
(
/*==============*/
const
lock_t
*
lock
)
/*!< in: lock */
{
dict_table_t
*
table
=
lock_get_table
(
lock
);
ut_ad
(
!
table
->
is_temporary
());
return
(
table
->
id
);
}
/** Determine which table a lock is associated with.
@param[in] lock the lock
@return name of the table */
const
table_name_t
&
lock_get_table_name
(
const
lock_t
*
lock
)
{
return
(
lock_get_table
(
lock
)
->
name
);
}
/*******************************************************************//**
For a record lock, gets the index on which the lock is.
@return index */
const
dict_index_t
*
lock_rec_get_index
(
/*===============*/
const
lock_t
*
lock
)
/*!< in: lock */
{
ut_ad
(
!
lock
->
is_table
());
ut_ad
(
dict_index_is_clust
(
lock
->
index
)
||
!
dict_index_is_online_ddl
(
lock
->
index
));
return
lock
->
index
;
}
/** Cancel a waiting lock request and release possibly waiting transactions */
static
void
lock_cancel_waiting_and_release
(
lock_t
*
lock
)
{
...
...
storage/innobase/trx/trx0i_s.cc
View file @
8513007c
...
...
@@ -618,7 +618,6 @@ fill_lock_data(
const
buf_block_t
*
block
;
const
page_t
*
page
;
const
rec_t
*
rec
;
const
dict_index_t
*
index
;
ulint
n_fields
;
mem_heap_t
*
heap
;
rec_offs
offsets_onstack
[
REC_OFFS_NORMAL_SIZE
];
...
...
@@ -647,7 +646,8 @@ fill_lock_data(
rec
=
page_find_rec_with_heap_no
(
page
,
heap_no
);
index
=
lock_rec_get_index
(
lock
);
const
dict_index_t
*
index
=
lock
->
index
;
ut_ad
(
index
->
is_primary
()
||
!
dict_index_is_online_ddl
(
index
));
n_fields
=
dict_index_get_n_unique
(
index
);
...
...
@@ -689,6 +689,15 @@ fill_lock_data(
return
(
TRUE
);
}
/** @return the table of a lock */
static
const
dict_table_t
*
lock_get_table
(
const
lock_t
&
lock
)
{
if
(
lock
.
is_table
())
return
lock
.
un_member
.
tab_lock
.
table
;
ut_ad
(
lock
.
index
->
is_primary
()
||
!
dict_index_is_online_ddl
(
lock
.
index
));
return
lock
.
index
->
table
;
}
/*******************************************************************//**
Fills i_s_locks_row_t object. Returns its first argument.
If memory can not be allocated then FALSE is returned.
...
...
@@ -703,9 +712,8 @@ static bool fill_locks_row(
volatile strings */
{
row
->
lock_trx_id
=
lock
->
trx
->
id
;
const
bool
is_table
=
lock
->
is_table
();
const
bool
is_gap_lock
=
lock
->
is_gap
();
ut_ad
(
!
is_gap_lock
||
!
is_table
);
ut_ad
(
!
is_gap_lock
||
!
lock
->
is_table
()
);
switch
(
lock
->
mode
())
{
case
LOCK_S
:
row
->
lock_mode
=
uint8_t
(
1
+
is_gap_lock
);
...
...
@@ -727,8 +735,10 @@ static bool fill_locks_row(
row
->
lock_mode
=
0
;
}
const
dict_table_t
*
table
=
lock_get_table
(
*
lock
);
row
->
lock_table
=
ha_storage_put_str_memlim
(
cache
->
storage
,
lock_get_table_name
(
lock
)
.
m_name
,
cache
->
storage
,
table
->
name
.
m_name
,
MAX_ALLOWED_FOR_STORAGE
(
cache
));
/* memory could not be allocated */
...
...
@@ -737,9 +747,9 @@ static bool fill_locks_row(
return
false
;
}
if
(
!
is_table
)
{
if
(
!
lock
->
is_table
()
)
{
row
->
lock_index
=
ha_storage_put_str_memlim
(
cache
->
storage
,
lock
_rec_get_index
(
lock
)
->
name
,
cache
->
storage
,
lock
->
index
->
name
,
MAX_ALLOWED_FOR_STORAGE
(
cache
));
/* memory could not be allocated */
...
...
@@ -765,7 +775,7 @@ static bool fill_locks_row(
row
->
lock_data
=
NULL
;
}
row
->
lock_table_id
=
lock_get_table_id
(
lock
)
;
row
->
lock_table_id
=
table
->
id
;
row
->
hash_chain
.
value
=
row
;
ut_ad
(
i_s_locks_row_validate
(
row
));
...
...
@@ -832,7 +842,7 @@ fold_lock(
it fails. */
ut_a
(
heap_no
==
0xFFFF
);
ret
=
(
ulint
)
lock_get_table
_id
(
lock
)
;
ret
=
(
ulint
)
lock_get_table
(
*
lock
)
->
id
;
}
return
(
ret
);
...
...
@@ -869,7 +879,7 @@ locks_row_eq_lock(
ut_a
(
heap_no
==
0xFFFF
);
return
(
row
->
lock_trx_id
==
lock
->
trx
->
id
&&
row
->
lock_table_id
==
lock_get_table
_id
(
lock
)
);
&&
row
->
lock_table_id
==
lock_get_table
(
*
lock
)
->
id
);
}
#endif
}
...
...
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