summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorJan Lindström <jplindst@mariadb.org>2014-01-09 12:33:29 +0200
committerJan Lindström <jplindst@mariadb.org>2014-01-09 12:33:29 +0200
commit2b5a0a22802a0069f318f7d23a1071a703930c90 (patch)
tree39e627ce380f05602b9bc8a711a043113a2fa352 /storage/innobase
parente80f2468b468540c27e9b7174769262297bffc13 (diff)
downloadmariadb-git-2b5a0a22802a0069f318f7d23a1071a703930c90.tar.gz
Feature: In first write if we trim we set write_size to actual bytes
written and rest of the page is trimmed. In following writes there is no need to trim again if write_size only increases because rest of the page is already trimmed. If actual write size decreases we need to trim again. Need to research if this can happen frequently enough to make any effect.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/buf/buf0dblwr.cc2
-rw-r--r--storage/innobase/buf/buf0flu.cc2
-rw-r--r--storage/innobase/fil/fil0fil.cc6
-rw-r--r--storage/innobase/include/fil0fil.h2
-rw-r--r--storage/innobase/include/os0file.h8
-rw-r--r--storage/innobase/include/os0file.ic8
-rw-r--r--storage/innobase/os/os0file.cc37
7 files changed, 44 insertions, 21 deletions
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 933b56eaf88..2ae67d8a41e 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -728,7 +728,7 @@ buf_dblwr_write_block_to_datafile(
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE, buf_block_get_space(block), 0,
buf_block_get_page_no(block), 0, UNIV_PAGE_SIZE,
- (void*) block->frame, (void*) block, 0);
+ (void*) block->frame, (void*) block, (ulint *)&bpage->write_size);
}
/********************************************************************//**
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 06ae7b5375c..b5f1aeef597 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -942,7 +942,7 @@ buf_flush_write_block_low(
FALSE, buf_page_get_space(bpage), zip_size,
buf_page_get_page_no(bpage), 0,
zip_size ? zip_size : UNIV_PAGE_SIZE,
- frame, bpage, 0);
+ frame, bpage, &bpage->write_size);
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE) {
buf_dblwr_write_single_page(bpage);
} else {
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 8a416d09c94..0bec85c699a 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -441,7 +441,7 @@ fil_read(
in aio this must be appropriately aligned */
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
- ulint write_size) /*!< in/out: Actual write size initialized
+ ulint* write_size) /*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
@@ -475,7 +475,7 @@ fil_write(
this must be appropriately aligned */
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
- ulint write_size) /*!< in/out: Actual write size initialized
+ ulint* write_size) /*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
@@ -5288,7 +5288,7 @@ fil_io(
appropriately aligned */
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
- ulint write_size) /*!< in/out: Actual write size initialized
+ ulint* write_size) /*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index c5edd33f46b..01084d52365 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -753,7 +753,7 @@ fil_io(
appropriately aligned */
void* message, /*!< in: message for aio handler if non-sync
aio used, else ignored */
- ulint write_size) /*!< in/out: Actual write size initialized
+ ulint* write_size) /*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 3c70f9925fe..eb5e1dddaf5 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -724,7 +724,11 @@ pfs_os_aio_func(
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
- ibool atomic_writes, /*!<in TRUE if atomic writes are used */
+ ulint* write_size,/*!< in/out: Actual write size initialized
+ after fist successfull trim
+ operation for this page and if
+ initialized we do not trim again if
+ actual page size does not decrease. */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
/*******************************************************************//**
@@ -1057,7 +1061,7 @@ os_aio_func(
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
- ulint write_size);/*!< in/out: Actual write size initialized
+ ulint* write_size);/*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
index 2be0f6a8d97..ca98428dd49 100644
--- a/storage/innobase/include/os0file.ic
+++ b/storage/innobase/include/os0file.ic
@@ -214,7 +214,11 @@ pfs_os_aio_func(
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
- ibool atomic_writes, /*!<in TRUE if atomic writes are used */
+ ulint* write_size,/*!< in/out: Actual write size initialized
+ after fist successfull trim
+ operation for this page and if
+ initialized we do not trim again if
+ actual page size does not decrease. */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
{
@@ -230,7 +234,7 @@ pfs_os_aio_func(
src_file, src_line);
result = os_aio_func(type, mode, name, file, buf, offset,
- n, message1, message2, atomic_writes);
+ n, message1, message2, write_size);
register_pfs_file_io_end(locker, n);
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 9f12ca86601..6bb9e47b116 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -196,7 +196,7 @@ struct os_aio_slot_t{
freed after the write
has been completed */
- ulint write_size; /*!< Actual write size initialized
+ ulint* write_size; /*!< Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
@@ -4363,7 +4363,7 @@ os_aio_array_reserve_slot(
to write */
os_offset_t offset, /*!< in: file offset */
ulint len, /*!< in: length of the block to read or write */
- ulint write_size) /*!< in: Actual write size initialized
+ ulint* write_size) /*!< in: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
@@ -4783,7 +4783,7 @@ os_aio_func(
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
- ulint write_size)/*!< in/out: Actual write size initialized
+ ulint* write_size)/*!< in/out: Actual write size initialized
after fist successfull trim
operation for this page and if
initialized we do not trim again if
@@ -6163,13 +6163,20 @@ os_file_trim(
// because rest of the page is already trimmed. If actual write
// size decreases we need to trim again.
if (trim_len == 0 ||
- (slot->write_size > 0 && len >= slot->write_size)) {
+ (slot->write_size &&
+ *slot->write_size > 0 &&
+ len >= *slot->write_size)) {
- if (slot->write_size > 0 && len >= slot->write_size) {
+#ifdef UNIV_DEBUG
+ fprintf(stderr, "Note: TRIM: write_size %lu trim_len %lu len %lu\n",
+ *slot->write_size, trim_len, len);
+#endif
+
+ if (*slot->write_size > 0 && len >= *slot->write_size) {
srv_stats.page_compressed_trim_op_saved.inc();
}
- slot->write_size = len;
+ *slot->write_size = len;
return (TRUE);
}
@@ -6191,11 +6198,15 @@ os_file_trim(
" fallocate(FALLOC_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE) ",
FALSE, __FILE__, __LINE__);
- slot->write_size = 0;
+ if (slot->write_size) {
+ *slot->write_size = 0;
+ }
return (FALSE);
} else {
- slot->write_size = len;
+ if (slot->write_size) {
+ *slot->write_size = len;
+ }
}
#else
ut_print_timestamp(stderr);
@@ -6203,7 +6214,7 @@ os_file_trim(
" InnoDB: [Warning] fallocate not supported on this installation."
" InnoDB: Disabling fallocate for now.");
os_fallocate_failed = TRUE;
- slot->write_size = 0;
+ slot->write_size = NULL;
#endif /* HAVE_FALLOCATE ... */
@@ -6229,10 +6240,14 @@ os_file_trim(
" DeviceIOControl(FSCTL_FILE_LEVEL_TRIM) ",
FALSE, __FILE__, __LINE__);
- slot->write_size = 0;
+ if (slot->write_size) {
+ slot->write_size = 0;
+ }
return (FALSE);
} else {
- slot->write_size = len;
+ if (slot->write_size) {
+ slot->write_size = len;
+ }
}
#endif