Commit 50f3b7d1 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-31124 Innodb_data_written miscounts doublewrites

When commit a5a2ef07
implemented asynchronous doublewrite, the writes via
the doublewrite buffer started to be counted incorrectly,
without multiplying them by innodb_page_size.

srv_export_innodb_status(): Correctly count the
Innodb_data_written.

buf_dblwr_t: Remove submitted(), because it is close to written()
and only Innodb_data_written was interested in it. According to
its name, it should count completed and not submitted writes.

Tested by: Axel Schwenke
parent 31f09e36
...@@ -582,7 +582,6 @@ bool buf_dblwr_t::flush_buffered_writes(const ulint size) ...@@ -582,7 +582,6 @@ bool buf_dblwr_t::flush_buffered_writes(const ulint size)
const bool multi_batch= block1 + static_cast<uint32_t>(size) != block2 && const bool multi_batch= block1 + static_cast<uint32_t>(size) != block2 &&
old_first_free > size; old_first_free > size;
flushing_buffered_writes= 1 + multi_batch; flushing_buffered_writes= 1 + multi_batch;
pages_submitted+= old_first_free;
/* Now safe to release the mutex. */ /* Now safe to release the mutex. */
mysql_mutex_unlock(&mutex); mysql_mutex_unlock(&mutex);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
......
...@@ -66,8 +66,6 @@ class buf_dblwr_t ...@@ -66,8 +66,6 @@ class buf_dblwr_t
bool batch_running; bool batch_running;
/** number of expected flush_buffered_writes_completed() calls */ /** number of expected flush_buffered_writes_completed() calls */
unsigned flushing_buffered_writes; unsigned flushing_buffered_writes;
/** pages submitted to flush_buffered_writes() */
ulint pages_submitted;
/** number of flush_buffered_writes_completed() calls */ /** number of flush_buffered_writes_completed() calls */
ulint writes_completed; ulint writes_completed;
/** number of pages written by flush_buffered_writes_completed() */ /** number of pages written by flush_buffered_writes_completed() */
...@@ -92,9 +90,6 @@ class buf_dblwr_t ...@@ -92,9 +90,6 @@ class buf_dblwr_t
/** Acquire the mutex */ /** Acquire the mutex */
void lock() { mysql_mutex_lock(&mutex); } void lock() { mysql_mutex_lock(&mutex); }
/** @return the number of submitted page writes */
ulint submitted() const
{ mysql_mutex_assert_owner(&mutex); return pages_submitted; }
/** @return the number of completed batches */ /** @return the number of completed batches */
ulint batches() const ulint batches() const
{ mysql_mutex_assert_owner(&mutex); return writes_completed; } { mysql_mutex_assert_owner(&mutex); return writes_completed; }
......
...@@ -1013,13 +1013,14 @@ srv_export_innodb_status(void) ...@@ -1013,13 +1013,14 @@ srv_export_innodb_status(void)
if (buf_dblwr.is_initialised()) { if (buf_dblwr.is_initialised()) {
buf_dblwr.lock(); buf_dblwr.lock();
dblwr = buf_dblwr.submitted(); dblwr = buf_dblwr.written();
export_vars.innodb_dblwr_pages_written = buf_dblwr.written(); export_vars.innodb_dblwr_pages_written = dblwr;
export_vars.innodb_dblwr_writes = buf_dblwr.batches(); export_vars.innodb_dblwr_writes = buf_dblwr.batches();
buf_dblwr.unlock(); buf_dblwr.unlock();
} }
export_vars.innodb_data_written = srv_stats.data_written + dblwr; export_vars.innodb_data_written = srv_stats.data_written
+ (dblwr << srv_page_size_shift);
export_vars.innodb_buffer_pool_read_requests export_vars.innodb_buffer_pool_read_requests
= buf_pool.stat.n_page_gets; = buf_pool.stat.n_page_gets;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment