Commit d520d353 authored by Sergei Golubchik's avatar Sergei Golubchik

Revert "MDEV-8696: Adding indexes on empty table is slow with large innodb_sort_buffer_size."

This reverts commit 13884cf2.

Fixed in 5.6 (merged in the next commit)
parent 271fed41
CREATE TABLE `test_wo_keys` (
`f01` int AUTO_INCREMENT,
`f02` bigint, `f03` bigint, `f04` enum('a','b'),
`f05` date, `f06` int, `f07` int, `f08` double, `f09` int,
`f10` bigint, `f11` double, `f12` enum('a','b','c','d','e'),
`f13` int, `f14` int, `f15` varchar(255), `f16` int, `f17` int, `f18` int,
`f19` double, `f20` double, `f21` double, `f22` double, `f23` double, `f24` tinyint,
`f25` double, `f26` double, `f27` double, `f28` double, `f29` int unsigned,
`f30` int unsigned, `f31` bigint, `f32` int unsigned, `f33` bigint,
`f34` int unsigned, `f35` int unsigned,
PRIMARY KEY `f01` (`f01`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show status like '%merge_buffers%';
Variable_name Value
Innodb_os_merge_buffers_written 0
Innodb_os_merge_buffers_read 0
Innodb_os_merge_buffers_merged 0
ALTER TABLE test_wo_keys
ADD KEY `f06` (`f06`), ADD KEY `f05` (`f05`), ADD KEY `f04` (`f04`), ADD KEY `f23` (`f23`),
ADD KEY `f10` (`f10`), ADD KEY `f11` (`f11`), ADD KEY `f09` (`f09`), ADD KEY `f22` (`f22`),
ADD KEY `f21` (`f21`), ADD KEY `f07` (`f07`), ADD KEY `f08` (`f08`), ADD KEY `f18` (`f18`),
ADD KEY `f19` (`f19`), ADD KEY `f20` (`f20`), ADD KEY `f29` (`f29`,`f31`,`f33`),
ADD KEY `f35` (`f35`), ADD KEY `f25` (`f25`), ADD KEY `f26` (`f26`),
ADD KEY `f27` (`f27`), ADD KEY `f28` (`f28`);
show status like '%merge_buffers%';
Variable_name Value
Innodb_os_merge_buffers_written 0
Innodb_os_merge_buffers_read 0
Innodb_os_merge_buffers_merged 0
DROP TABLE test_wo_keys;
......@@ -123,9 +123,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
......@@ -257,9 +254,6 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
......@@ -298,9 +292,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
......
--source include/have_innodb.inc
#
# MDEV-8696: Adding indexes on empty table is slow with large innodb_sort_buffer_size.
#
CREATE TABLE `test_wo_keys` (
`f01` int AUTO_INCREMENT,
`f02` bigint, `f03` bigint, `f04` enum('a','b'),
`f05` date, `f06` int, `f07` int, `f08` double, `f09` int,
`f10` bigint, `f11` double, `f12` enum('a','b','c','d','e'),
`f13` int, `f14` int, `f15` varchar(255), `f16` int, `f17` int, `f18` int,
`f19` double, `f20` double, `f21` double, `f22` double, `f23` double, `f24` tinyint,
`f25` double, `f26` double, `f27` double, `f28` double, `f29` int unsigned,
`f30` int unsigned, `f31` bigint, `f32` int unsigned, `f33` bigint,
`f34` int unsigned, `f35` int unsigned,
PRIMARY KEY `f01` (`f01`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
show status like '%merge_buffers%';
ALTER TABLE test_wo_keys
ADD KEY `f06` (`f06`), ADD KEY `f05` (`f05`), ADD KEY `f04` (`f04`), ADD KEY `f23` (`f23`),
ADD KEY `f10` (`f10`), ADD KEY `f11` (`f11`), ADD KEY `f09` (`f09`), ADD KEY `f22` (`f22`),
ADD KEY `f21` (`f21`), ADD KEY `f07` (`f07`), ADD KEY `f08` (`f08`), ADD KEY `f18` (`f18`),
ADD KEY `f19` (`f19`), ADD KEY `f20` (`f20`), ADD KEY `f29` (`f29`,`f31`,`f33`),
ADD KEY `f35` (`f35`), ADD KEY `f25` (`f25`), ADD KEY `f26` (`f26`),
ADD KEY `f27` (`f27`), ADD KEY `f28` (`f28`);
show status like '%merge_buffers%';
DROP TABLE test_wo_keys;
......@@ -123,9 +123,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
......@@ -257,9 +254,6 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
......@@ -298,9 +292,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
......
......@@ -123,9 +123,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
......@@ -257,9 +254,6 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
......@@ -298,9 +292,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
......
......@@ -123,9 +123,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
......@@ -257,9 +254,6 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
......@@ -298,9 +292,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
......
......@@ -123,9 +123,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs disabled
os_log_pending_writes disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
trx_rw_commits disabled
trx_ro_commits disabled
trx_nl_ro_commits disabled
......@@ -257,9 +254,6 @@ lock_row_lock_time disabled
lock_row_lock_time_max disabled
lock_row_lock_waits disabled
lock_row_lock_time_avg disabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
innodb_rwlock_s_spin_waits disabled
innodb_rwlock_x_spin_waits disabled
innodb_rwlock_s_spin_rounds disabled
......@@ -298,9 +292,6 @@ os_log_bytes_written disabled
os_log_fsyncs disabled
os_log_pending_fsyncs enabled
os_log_pending_writes enabled
os_merge_blocks_written disabled
os_merge_blocks_read disabled
os_merge_blocks_merged disabled
set global innodb_monitor_enable="";
ERROR 42000: Variable 'innodb_monitor_enable' can't be set to the value of ''
set global innodb_monitor_enable="_";
......
......@@ -4,7 +4,7 @@ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2014 SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -647,12 +647,6 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_os_log_pending_writes, SHOW_LONG},
{"os_log_written",
(char*) &export_vars.innodb_os_log_written, SHOW_LONGLONG},
{"os_merge_buffers_written",
(char*) &export_vars.innodb_merge_buffers_written, SHOW_LONGLONG},
{"os_merge_buffers_read",
(char*) &export_vars.innodb_merge_buffers_read, SHOW_LONGLONG},
{"os_merge_buffers_merged",
(char*) &export_vars.innodb_merge_buffers_merged, SHOW_LONGLONG},
{"page_size",
(char*) &export_vars.innodb_page_size, SHOW_LONG},
{"pages_created",
......
......@@ -2,7 +2,6 @@
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
......@@ -256,9 +255,6 @@ enum monitor_id_t {
MONITOR_OVLD_OS_LOG_FSYNC,
MONITOR_OVLD_OS_LOG_PENDING_FSYNC,
MONITOR_OVLD_OS_LOG_PENDING_WRITES,
MONITOR_MERGE_BLOCKS_WRITTEN,
MONITOR_MERGE_BLOCKS_READ,
MONITOR_MERGE_BLOCKS_MERGED,
/* Transaction related counters */
MONITOR_MODULE_TRX,
......
......@@ -3,7 +3,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -138,15 +138,6 @@ struct srv_stats_t {
/** Number of system rows inserted */
ulint_ctr_64_t n_system_rows_inserted;
/** Number of merge buffers written */
ulint_ctr_64_t merge_buffers_written;
/** Number of merge buffers read */
ulint_ctr_64_t merge_buffers_read;
/** Number of merge buffers merged */
ulint_ctr_64_t merge_buffers_merged;
};
extern const char* srv_main_thread_op_info;
......@@ -886,9 +877,6 @@ struct export_var_t{
ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id
- purged view's min trx_id */
#endif /* UNIV_DEBUG */
ib_int64_t innodb_merge_buffers_written;
ib_int64_t innodb_merge_buffers_read;
ib_int64_t innodb_merge_buffers_merged;
};
/** Thread slot in the thread table. */
......
/*****************************************************************************
Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -872,8 +871,6 @@ row_merge_read(
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
ofs, srv_sort_buf_size);
srv_stats.merge_buffers_read.inc();
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
......@@ -908,7 +905,6 @@ row_merge_write(
DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
srv_stats.merge_buffers_written.inc();
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
......@@ -1740,7 +1736,7 @@ write_buffers:
/* We have enough data tuples to form a block.
Sort them and write to disk. */
if (UNIV_LIKELY(buf->n_tuples)) {
if (buf->n_tuples) {
if (dict_index_is_unique(buf->index)) {
row_merge_dup_t dup = {
buf->index, table, col_map, 0};
......@@ -1781,17 +1777,13 @@ write_buffers:
dict_index_get_lock(buf->index));
}
/* Do not write empty buffers to temporary file */
if (buf->n_tuples) {
row_merge_buf_write(buf, file, block);
row_merge_buf_write(buf, file, block);
if (!row_merge_write(file->fd, file->offset++,
block)) {
err = DB_TEMP_FILE_WRITE_FAILURE;
trx->error_key_num = i;
break;
}
if (!row_merge_write(file->fd, file->offset++,
block)) {
err = DB_TEMP_FILE_WRITE_FAILURE;
trx->error_key_num = i;
break;
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
......@@ -2076,9 +2068,6 @@ done1:
mem_heap_free(heap);
b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size],
b2, of->fd, &of->offset);
srv_stats.merge_buffers_merged.inc();
return(b2 ? DB_SUCCESS : DB_CORRUPTION);
}
......@@ -3763,21 +3752,17 @@ wait_again:
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else {
/* Sorting and inserting is required only if
there really is records */
if (UNIV_LIKELY(merge_files[i].n_rec)) {
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
error = row_merge_sort(
trx, &dup, &merge_files[i],
block, &tmpfd);
if (error == DB_SUCCESS) {
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
merge_files[i].fd, block);
}
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
error = row_merge_sort(
trx, &dup, &merge_files[i],
block, &tmpfd);
if (error == DB_SUCCESS) {
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
merge_files[i].fd, block);
}
}
......
......@@ -2,7 +2,6 @@
Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -675,24 +674,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_PENDING_WRITES},
{"os_merge_blocks_written", "os",
"Number of merge blocks written (innodb_os_merge_blocks_written)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_MERGE_BLOCKS_WRITTEN},
{"os_merge_blocks_read", "os",
"Number of merge blocks read (innodb_os_merge_blocks_read)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_MERGE_BLOCKS_READ},
{"os_merge_blocks_merged", "os",
"Number of merge blocks merged (innodb_os_merge_blocks_merged)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_MERGE_BLOCKS_MERGED},
/* ========== Counters for Transaction Module ========== */
{"module_trx", "transaction", "Transaction Manager",
MONITOR_MODULE,
......@@ -1645,21 +1626,6 @@ srv_mon_process_existing_counter(
update_min = TRUE;
break;
/* innodb_os_merge_blocks_written */
case MONITOR_MERGE_BLOCKS_WRITTEN:
value = srv_stats.merge_buffers_written;
break;
/* innodb_os_merge_blocks_read */
case MONITOR_MERGE_BLOCKS_READ:
value = srv_stats.merge_buffers_read;
break;
/* innodb_os_merge_blocks_merged */
case MONITOR_MERGE_BLOCKS_MERGED:
value = srv_stats.merge_buffers_merged;
break;
/* innodb_log_waits */
case MONITOR_OVLD_LOG_WAITS:
value = srv_stats.log_waits;
......
......@@ -3,7 +3,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -1553,10 +1553,6 @@ srv_export_innodb_status(void)
}
#endif /* UNIV_DEBUG */
export_vars.innodb_merge_buffers_written = srv_stats.merge_buffers_written;
export_vars.innodb_merge_buffers_read = srv_stats.merge_buffers_read;
export_vars.innodb_merge_buffers_merged = srv_stats.merge_buffers_merged;
mutex_exit(&srv_innodb_monitor_mutex);
}
......
......@@ -4,7 +4,7 @@ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2014 SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -827,12 +827,6 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_os_log_pending_writes, SHOW_LONG},
{"os_log_written",
(char*) &export_vars.innodb_os_log_written, SHOW_LONGLONG},
{"os_merge_buffers_written",
(char*) &export_vars.innodb_merge_buffers_written, SHOW_LONGLONG},
{"os_merge_buffers_read",
(char*) &export_vars.innodb_merge_buffers_read, SHOW_LONGLONG},
{"os_merge_buffers_merged",
(char*) &export_vars.innodb_merge_buffers_merged, SHOW_LONGLONG},
{"page_size",
(char*) &export_vars.innodb_page_size, SHOW_LONG},
{"pages_created",
......
......@@ -2,7 +2,6 @@
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
......@@ -256,9 +255,6 @@ enum monitor_id_t {
MONITOR_OVLD_OS_LOG_FSYNC,
MONITOR_OVLD_OS_LOG_PENDING_FSYNC,
MONITOR_OVLD_OS_LOG_PENDING_WRITES,
MONITOR_MERGE_BLOCKS_WRITTEN,
MONITOR_MERGE_BLOCKS_READ,
MONITOR_MERGE_BLOCKS_MERGED,
/* Transaction related counters */
MONITOR_MODULE_TRX,
......
......@@ -3,7 +3,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -145,13 +145,6 @@ struct srv_stats_t {
/** Number of lock waits that have been up to max time (i.e.) lock
wait timeout */
ulint_ctr_1_t n_lock_max_wait_time;
/** Number of merge buffers written */
ulint_ctr_64_t merge_buffers_written;
/** Number of merge buffers read */
ulint_ctr_64_t merge_buffers_read;
/** Number of merge buffers merged */
ulint_ctr_64_t merge_buffers_merged;
};
extern const char* srv_main_thread_op_info;
......@@ -1100,9 +1093,6 @@ struct export_var_t{
ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id
- purged view's min trx_id */
#endif /* UNIV_DEBUG */
ib_int64_t innodb_merge_buffers_written;
ib_int64_t innodb_merge_buffers_read;
ib_int64_t innodb_merge_buffers_merged;
};
/** Thread slot in the thread table. */
......
/*****************************************************************************
Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -874,8 +873,6 @@ row_merge_read(
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
ofs, srv_sort_buf_size);
srv_stats.merge_buffers_read.inc();
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
......@@ -910,7 +907,6 @@ row_merge_write(
DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
srv_stats.merge_buffers_written.inc();
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
......@@ -1748,7 +1744,7 @@ write_buffers:
/* We have enough data tuples to form a block.
Sort them and write to disk. */
if (UNIV_LIKELY(buf->n_tuples)) {
if (buf->n_tuples) {
if (dict_index_is_unique(buf->index)) {
row_merge_dup_t dup = {
buf->index, table, col_map, 0};
......@@ -1789,17 +1785,13 @@ write_buffers:
dict_index_get_lock(buf->index));
}
/* Do not write empty buffers to temporary file */
if (buf->n_tuples) {
row_merge_buf_write(buf, file, block);
row_merge_buf_write(buf, file, block);
if (!row_merge_write(file->fd, file->offset++,
block)) {
err = DB_TEMP_FILE_WRITE_FAILURE;
trx->error_key_num = i;
break;
}
if (!row_merge_write(file->fd, file->offset++,
block)) {
err = DB_TEMP_FILE_WRITE_FAILURE;
trx->error_key_num = i;
break;
}
UNIV_MEM_INVALID(&block[0], srv_sort_buf_size);
......@@ -2084,9 +2076,6 @@ done1:
mem_heap_free(heap);
b2 = row_merge_write_eof(&block[2 * srv_sort_buf_size],
b2, of->fd, &of->offset);
srv_stats.merge_buffers_merged.inc();
return(b2 ? DB_SUCCESS : DB_CORRUPTION);
}
......@@ -3772,21 +3761,17 @@ wait_again:
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else {
/* Sorting and inserting is required only if
there really is records */
if (UNIV_LIKELY(merge_files[i].n_rec)) {
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
error = row_merge_sort(
trx, &dup, &merge_files[i],
block, &tmpfd);
if (error == DB_SUCCESS) {
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
merge_files[i].fd, block);
}
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
error = row_merge_sort(
trx, &dup, &merge_files[i],
block, &tmpfd);
if (error == DB_SUCCESS) {
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
merge_files[i].fd, block);
}
}
......
......@@ -2,7 +2,6 @@
Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2015, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -675,24 +674,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_PENDING_WRITES},
{"os_merge_blocks_written", "os",
"Number of merge blocks written (innodb_os_merge_blocks_written)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_MERGE_BLOCKS_WRITTEN},
{"os_merge_blocks_read", "os",
"Number of merge blocks read (innodb_os_merge_blocks_read)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_MERGE_BLOCKS_READ},
{"os_merge_blocks_merged", "os",
"Number of merge blocks merged (innodb_os_merge_blocks_merged)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_MERGE_BLOCKS_MERGED},
/* ========== Counters for Transaction Module ========== */
{"module_trx", "transaction", "Transaction Manager",
MONITOR_MODULE,
......@@ -1645,21 +1626,6 @@ srv_mon_process_existing_counter(
update_min = TRUE;
break;
/* innodb_os_merge_blocks_written */
case MONITOR_MERGE_BLOCKS_WRITTEN:
value = srv_stats.merge_buffers_written;
break;
/* innodb_os_merge_blocks_read */
case MONITOR_MERGE_BLOCKS_READ:
value = srv_stats.merge_buffers_read;
break;
/* innodb_os_merge_blocks_merged */
case MONITOR_MERGE_BLOCKS_MERGED:
value = srv_stats.merge_buffers_merged;
break;
/* innodb_log_waits */
case MONITOR_OVLD_LOG_WAITS:
value = srv_stats.log_waits;
......
......@@ -3,7 +3,7 @@
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -1931,10 +1931,6 @@ srv_export_innodb_status(void)
}
#endif /* UNIV_DEBUG */
export_vars.innodb_merge_buffers_written = srv_stats.merge_buffers_written;
export_vars.innodb_merge_buffers_read = srv_stats.merge_buffers_read;
export_vars.innodb_merge_buffers_merged = srv_stats.merge_buffers_merged;
mutex_exit(&srv_innodb_monitor_mutex);
}
......
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