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
d8c908bb
Commit
d8c908bb
authored
Mar 13, 2023
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APC: fix LOCK_global_system_variables contention
parent
295689cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
sql/sys_vars.cc
sql/sys_vars.cc
+5
-3
sql/sys_vars.inl
sql/sys_vars.inl
+11
-7
storage/perfschema/pfs_variable.cc
storage/perfschema/pfs_variable.cc
+5
-2
No files found.
sql/sys_vars.cc
View file @
d8c908bb
...
...
@@ -5535,18 +5535,20 @@ Sys_slave_net_timeout(
*/
ulonglong
Sys_var_multi_source_ulonglong
::
get_master_info_ulonglong_value
(
THD
*
thd
,
ptrdiff_t
offset
)
const
get_master_info_ulonglong_value
(
THD
*
thd
,
ptrdiff_t
offset
,
bool
lock
)
const
{
Master_info
*
mi
;
ulonglong
res
=
0
;
// Default value
mysql_mutex_unlock
(
&
LOCK_global_system_variables
);
if
(
lock
)
mysql_mutex_unlock
(
&
LOCK_global_system_variables
);
if
((
mi
=
get_master_info
(
&
thd
->
variables
.
default_master_connection
,
Sql_condition
::
WARN_LEVEL_WARN
)))
{
res
=
*
((
ulonglong
*
)
(((
uchar
*
)
mi
)
+
master_info_offset
));
mi
->
release
();
}
mysql_mutex_lock
(
&
LOCK_global_system_variables
);
if
(
lock
)
mysql_mutex_lock
(
&
LOCK_global_system_variables
);
return
res
;
}
...
...
sql/sys_vars.inl
View file @
d8c908bb
...
...
@@ -2378,6 +2378,14 @@ class Sys_var_multi_source_ulonglong :public Sys_var_ulonglong
{
ptrdiff_t master_info_offset;
on_multi_source_update_function update_multi_source_variable_func;
const uchar *get_value_ptr(THD *thd, bool lock) const
{
ulonglong *tmp, res;
tmp= (ulonglong*) (((uchar*)&(thd->variables)) + offset);
res= get_master_info_ulonglong_value(thd, master_info_offset, lock);
*tmp= res;
return (uchar*) tmp;
}
public:
Sys_var_multi_source_ulonglong(const char *name_arg,
const char *comment, int flag_args,
...
...
@@ -2407,17 +2415,13 @@ class Sys_var_multi_source_ulonglong :public Sys_var_ulonglong
}
const uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base) const
{
ulonglong *tmp, res;
tmp= (ulonglong*) (((uchar*)&(thd->variables)) + offset);
res= get_master_info_ulonglong_value(thd, master_info_offset);
*tmp= res;
return (uchar*) tmp;
return get_value_ptr(thd, false);
}
const uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base) const
{
return
session_value_ptr(thd, bas
e);
return
get_value_ptr(thd, tru
e);
}
ulonglong get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset) const;
ulonglong get_master_info_ulonglong_value(THD *thd, ptrdiff_t offset
, bool lock
) const;
bool update_variable(THD *thd, Master_info *mi)
{
return update_multi_source_variable_func(this, thd, mi);
...
...
storage/perfschema/pfs_variable.cc
View file @
d8c908bb
...
...
@@ -562,13 +562,16 @@ void System_variable::init(THD *target_thd, const SHOW_VAR *show_var,
/* Get the value of the system variable. */
String
buf
(
m_value_str
,
sizeof
(
m_value_str
)
-
1
,
system_charset_info
);
mysql_mutex_lock
(
&
LOCK_global_system_variables
);
if
(
query_scope
==
OPT_GLOBAL
||
system_var
->
scope
()
==
sys_var
::
GLOBAL
)
mysql_mutex_lock
(
&
LOCK_global_system_variables
);
if
(
!
system_var
->
val_str_nolock
(
&
buf
,
target_thd
,
system_var
->
value_ptr
(
target_thd
,
query_scope
,
&
null_clex_str
)))
buf
.
length
(
0
);
mysql_mutex_unlock
(
&
LOCK_global_system_variables
);
if
(
query_scope
==
OPT_GLOBAL
||
system_var
->
scope
()
==
sys_var
::
GLOBAL
)
mysql_mutex_unlock
(
&
LOCK_global_system_variables
);
m_value_length
=
MY_MIN
(
buf
.
length
(),
SHOW_VAR_FUNC_BUFF_SIZE
);
...
...
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