Avoid using log_sys mutex when printing out show engine innodb status,
instead peek (maybe) old data.
This commit is contained in:
parent
8db1f728e6
commit
ec46381990
@ -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
|
||||||
|
@ -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. */
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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)
|
|||||||
return log_sys->tracked_lsn;
|
return log_sys->tracked_lsn;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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(
|
|||||||
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(
|
|||||||
"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(
|
|||||||
"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(
|
|||||||
"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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************//**
|
/**********************************************************************//**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user