mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user