summaryrefslogtreecommitdiff
path: root/storage/innobase/row
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-10-31 18:07:02 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2015-10-31 18:07:02 -0400
commit4d1511296288782df0e3d9373396724e250b24c1 (patch)
tree9fa47d141b71933859d6c2da585e5bb5e52db212 /storage/innobase/row
parent17b0b45b1de41a1b188c5de6c3e9d8e6ecc48a72 (diff)
parentd775ecdd010daad4dc6147fba58acd006bf2c60c (diff)
downloadmariadb-git-4d1511296288782df0e3d9373396724e250b24c1.tar.gz
Merge tag 'mariadb-10.0.22' into 10.0-galera
Diffstat (limited to 'storage/innobase/row')
-rw-r--r--storage/innobase/row/row0ins.cc2
-rw-r--r--storage/innobase/row/row0log.cc4
-rw-r--r--storage/innobase/row/row0merge.cc51
3 files changed, 37 insertions, 20 deletions
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 6a5dff50952..edfa39a8932 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2738,6 +2738,8 @@ row_ins_sec_index_entry_low(
goto func_exit;
}
+ DEBUG_SYNC_C("row_ins_sec_index_entry_dup_locks_created");
+
/* We did not find a duplicate and we have now
locked with s-locks the necessary records to
prevent any insertion of a duplicate by another
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 74ebe159677..0bc6f33df97 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -2586,7 +2586,7 @@ all_done:
and be ignored when the operation is unsupported. */
fallocate(index->online_log->fd,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
- ofs, srv_buf_size);
+ ofs, srv_sort_buf_size);
#endif /* FALLOC_FL_PUNCH_HOLE */
next_mrec = index->online_log->head.block;
@@ -3417,7 +3417,7 @@ all_done:
and be ignored when the operation is unsupported. */
fallocate(index->online_log->fd,
FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
- ofs, srv_buf_size);
+ ofs, srv_sort_buf_size);
#endif /* FALLOC_FL_PUNCH_HOLE */
next_mrec = index->online_log->head.block;
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 284081d4b0c..75aa423b2ac 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
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
@@ -871,6 +872,8 @@ 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);
@@ -905,6 +908,7 @@ 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) {
@@ -1736,7 +1740,7 @@ write_buffers:
/* We have enough data tuples to form a block.
Sort them and write to disk. */
- if (buf->n_tuples) {
+ if (UNIV_LIKELY(buf->n_tuples)) {
if (dict_index_is_unique(buf->index)) {
row_merge_dup_t dup = {
buf->index, table, col_map, 0};
@@ -1777,13 +1781,17 @@ write_buffers:
dict_index_get_lock(buf->index));
}
- row_merge_buf_write(buf, file, block);
+ /* Do not write empty buffers to temporary file */
+ if (buf->n_tuples) {
+
+ 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);
@@ -2068,6 +2076,9 @@ 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);
}
@@ -3747,17 +3758,21 @@ wait_again:
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else {
- 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);
+ /* 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);
+ }
}
}