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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ec463819
Commit
ec463819
authored
Sep 16, 2014
by
Jan Lindström
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using log_sys mutex when printing out show engine innodb status,
instead peek (maybe) old data.
parent
8db1f728
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
7 deletions
+103
-7
storage/xtradb/buf/buf0buf.cc
storage/xtradb/buf/buf0buf.cc
+42
-0
storage/xtradb/include/buf0buf.h
storage/xtradb/include/buf0buf.h
+9
-0
storage/xtradb/include/log0log.h
storage/xtradb/include/log0log.h
+9
-0
storage/xtradb/include/log0log.ic
storage/xtradb/include/log0log.ic
+17
-2
storage/xtradb/log/log0log.cc
storage/xtradb/log/log0log.cc
+26
-5
No files found.
storage/xtradb/buf/buf0buf.cc
View file @
ec463819
...
@@ -378,6 +378,48 @@ buf_pool_get_oldest_modification(void)
...
@@ -378,6 +378,48 @@ buf_pool_get_oldest_modification(void)
return
(
oldest_lsn
);
return
(
oldest_lsn
);
}
}
/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
@return oldest modification in pool, zero if none */
UNIV_INTERN
lsn_t
buf_pool_get_oldest_modification_peek
(
void
)
/*=======================================*/
{
ulint
i
;
buf_page_t
*
bpage
;
lsn_t
lsn
=
0
;
lsn_t
oldest_lsn
=
0
;
/* Dirsty read to buffer pool array */
for
(
i
=
0
;
i
<
srv_buf_pool_instances
;
i
++
)
{
buf_pool_t
*
buf_pool
;
buf_pool
=
buf_pool_from_array
(
i
);
buf_flush_list_mutex_enter
(
buf_pool
);
bpage
=
UT_LIST_GET_LAST
(
buf_pool
->
flush_list
);
if
(
bpage
!=
NULL
)
{
ut_ad
(
bpage
->
in_flush_list
);
lsn
=
bpage
->
oldest_modification
;
}
buf_flush_list_mutex_exit
(
buf_pool
);
if
(
!
oldest_lsn
||
oldest_lsn
>
lsn
)
{
oldest_lsn
=
lsn
;
}
}
/* The returned answer may be out of date: the flush_list can
change after the mutex has been released. */
return
(
oldest_lsn
);
}
/********************************************************************//**
/********************************************************************//**
Get total buffer pool statistics. */
Get total buffer pool statistics. */
UNIV_INTERN
UNIV_INTERN
...
...
storage/xtradb/include/buf0buf.h
View file @
ec463819
...
@@ -271,6 +271,15 @@ lsn_t
...
@@ -271,6 +271,15 @@ lsn_t
buf_pool_get_oldest_modification
(
void
);
buf_pool_get_oldest_modification
(
void
);
/*==================================*/
/*==================================*/
/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
@return oldest modification in pool, zero if none */
UNIV_INTERN
lsn_t
buf_pool_get_oldest_modification_peek
(
void
);
/*=======================================*/
/********************************************************************//**
/********************************************************************//**
Allocates a buf_page_t descriptor. This function must succeed. In case
Allocates a buf_page_t descriptor. This function must succeed. In case
of failure we assert in this function. */
of failure we assert in this function. */
...
...
storage/xtradb/include/log0log.h
View file @
ec463819
...
@@ -633,6 +633,15 @@ UNIV_INLINE
...
@@ -633,6 +633,15 @@ UNIV_INLINE
lsn_t
lsn_t
log_get_tracked_lsn
(
void
);
log_get_tracked_lsn
(
void
);
/*=====================*/
/*=====================*/
/****************************************************************//**
Unsafely reads the log_sys->tracked_lsn value. Uses atomic operations
if available, or use dirty read. Use for printing only.
@return log_sys->tracked_lsn value. */
UNIV_INLINE
lsn_t
log_get_tracked_lsn_peek
(
void
);
/*==========================*/
extern
log_t
*
log_sys
;
extern
log_t
*
log_sys
;
...
...
storage/xtradb/include/log0log.ic
View file @
ec463819
...
@@ -552,12 +552,28 @@ log_free_check(void)
...
@@ -552,12 +552,28 @@ log_free_check(void)
}
}
#endif /* !UNIV_HOTBACKUP */
#endif /* !UNIV_HOTBACKUP */
/****************************************************************//**
Unsafely reads the log_sys->tracked_lsn value. Uses atomic operations
if available, or use dirty read. Use for printing only.
@return log_sys->tracked_lsn value. */
UNIV_INLINE
lsn_t
log_get_tracked_lsn_peek(void)
/*==========================*/
{
#ifdef HAVE_ATOMIC_BUILTINS_64
return os_atomic_increment_uint64(&log_sys->tracked_lsn, 0);
#else
return log_sys->tracked_lsn;
#endif
}
/****************************************************************//**
/****************************************************************//**
Safely reads the log_sys->tracked_lsn value. Uses atomic operations
Safely reads the log_sys->tracked_lsn value. Uses atomic operations
if available, otherwise this field is protected with the log system
if available, otherwise this field is protected with the log system
mutex. The writer counterpart function is log_set_tracked_lsn() in
mutex. The writer counterpart function is log_set_tracked_lsn() in
log0online.c.
log0online.c.
@return log_sys->tracked_lsn value. */
@return log_sys->tracked_lsn value. */
UNIV_INLINE
UNIV_INLINE
lsn_t
lsn_t
...
@@ -571,4 +587,3 @@ log_get_tracked_lsn(void)
...
@@ -571,4 +587,3 @@ log_get_tracked_lsn(void)
return log_sys->tracked_lsn;
return log_sys->tracked_lsn;
#endif
#endif
}
}
storage/xtradb/log/log0log.cc
View file @
ec463819
...
@@ -196,6 +196,27 @@ log_buf_pool_get_oldest_modification(void)
...
@@ -196,6 +196,27 @@ log_buf_pool_get_oldest_modification(void)
return
(
lsn
);
return
(
lsn
);
}
}
/****************************************************************//**
Returns the oldest modified block lsn in the pool, or log_sys->lsn if none
exists.
@return LSN of oldest modification */
static
lsn_t
log_buf_pool_get_oldest_modification_peek
(
void
)
/*===========================================*/
{
lsn_t
lsn
;
lsn
=
buf_pool_get_oldest_modification_peek
();
if
(
!
lsn
)
{
lsn
=
log_sys
->
lsn
;
}
return
(
lsn
);
}
/****************************************************************//**
/****************************************************************//**
Checks if the log groups have a big enough margin of free space in
Checks if the log groups have a big enough margin of free space in
so that a new log entry can be written without overwriting log data
so that a new log entry can be written without overwriting log data
...
@@ -3875,7 +3896,7 @@ log_print(
...
@@ -3875,7 +3896,7 @@ log_print(
double
time_elapsed
;
double
time_elapsed
;
time_t
current_time
;
time_t
current_time
;
mutex_enter
(
&
(
log_sys
->
mutex
));
//
mutex_enter(&(log_sys->mutex));
fprintf
(
file
,
fprintf
(
file
,
"Log sequence number "
LSN_PF
"
\n
"
"Log sequence number "
LSN_PF
"
\n
"
...
@@ -3884,7 +3905,7 @@ log_print(
...
@@ -3884,7 +3905,7 @@ log_print(
"Last checkpoint at "
LSN_PF
"
\n
"
,
"Last checkpoint at "
LSN_PF
"
\n
"
,
log_sys
->
lsn
,
log_sys
->
lsn
,
log_sys
->
flushed_to_disk_lsn
,
log_sys
->
flushed_to_disk_lsn
,
log_buf_pool_get_oldest_modification
(),
log_buf_pool_get_oldest_modification
_peek
(),
log_sys
->
last_checkpoint_lsn
);
log_sys
->
last_checkpoint_lsn
);
fprintf
(
file
,
fprintf
(
file
,
...
@@ -3894,7 +3915,7 @@ log_print(
...
@@ -3894,7 +3915,7 @@ log_print(
"Checkpoint age "
LSN_PF
"
\n
"
,
"Checkpoint age "
LSN_PF
"
\n
"
,
log_sys
->
max_checkpoint_age
,
log_sys
->
max_checkpoint_age
,
log_sys
->
max_checkpoint_age_async
,
log_sys
->
max_checkpoint_age_async
,
log_sys
->
lsn
-
log_buf_pool_get_oldest_modification
(),
log_sys
->
lsn
-
log_buf_pool_get_oldest_modification
_peek
(),
log_sys
->
lsn
-
log_sys
->
last_checkpoint_lsn
);
log_sys
->
lsn
-
log_sys
->
last_checkpoint_lsn
);
current_time
=
time
(
NULL
);
current_time
=
time
(
NULL
);
...
@@ -3923,14 +3944,14 @@ log_print(
...
@@ -3923,14 +3944,14 @@ log_print(
"Log tracking enabled
\n
"
"Log tracking enabled
\n
"
"Log tracked up to "
LSN_PF
"
\n
"
"Log tracked up to "
LSN_PF
"
\n
"
"Max tracked LSN age "
LSN_PF
"
\n
"
,
"Max tracked LSN age "
LSN_PF
"
\n
"
,
log_get_tracked_lsn
(),
log_get_tracked_lsn
_peek
(),
log_sys
->
max_checkpoint_age
);
log_sys
->
max_checkpoint_age
);
}
}
log_sys
->
n_log_ios_old
=
log_sys
->
n_log_ios
;
log_sys
->
n_log_ios_old
=
log_sys
->
n_log_ios
;
log_sys
->
last_printout_time
=
current_time
;
log_sys
->
last_printout_time
=
current_time
;
mutex_exit
(
&
(
log_sys
->
mutex
));
//
mutex_exit(&(log_sys->mutex));
}
}
/**********************************************************************//**
/**********************************************************************//**
...
...
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