summaryrefslogtreecommitdiff
path: root/innobase/fil/fil0fil.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/fil/fil0fil.c')
-rw-r--r--innobase/fil/fil0fil.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index 16ae8e6e228..3ff70aece5e 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -88,6 +88,9 @@ but in the MySQL Embedded Server Library and ibbackup it is not the default
directory, and we must set the base file path explicitly */
const char* fil_path_to_mysql_datadir = ".";
+/* The number of fsyncs done to the log */
+ulint fil_n_log_flushes = 0;
+
ulint fil_n_pending_log_flushes = 0;
ulint fil_n_pending_tablespace_flushes = 0;
@@ -516,7 +519,7 @@ fil_node_open_file(
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Error: the size of single-table tablespace file %s\n"
-"InnoDB: is only %lu %lu, should be at least %lu!", node->name,
+"InnoDB: is only %lu %lu, should be at least %lu!\n", node->name,
(ulong) size_high,
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
@@ -686,8 +689,8 @@ fil_try_to_close_file_in_LRU(
ut_print_filename(stderr, node->name);
fprintf(stderr,
", because mod_count %ld != fl_count %ld\n",
- (ulong) node->modification_counter,
- (ulong) node->flush_counter);
+ (long) node->modification_counter,
+ (long) node->flush_counter);
}
node = UT_LIST_GET_PREV(LRU, node);
@@ -1650,30 +1653,38 @@ fil_op_write_log(
mtr_t* mtr) /* in: mini-transaction handle */
{
byte* log_ptr;
+ ulint len;
+
+ log_ptr = mlog_open(mtr, 11 + 2);
+
+ if (!log_ptr) {
+ /* Logging in mtr is switched off during crash recovery:
+ in that case mlog_open returns NULL */
+ return;
+ }
- log_ptr = mlog_open(mtr, 30);
-
log_ptr = mlog_write_initial_log_record_for_file_op(type, space_id, 0,
log_ptr, mtr);
/* Let us store the strings as null-terminated for easier readability
and handling */
- mach_write_to_2(log_ptr, ut_strlen(name) + 1);
+ len = strlen(name) + 1;
+
+ mach_write_to_2(log_ptr, len);
log_ptr += 2;
-
mlog_close(mtr, log_ptr);
- mlog_catenate_string(mtr, (byte*) name, ut_strlen(name) + 1);
+ mlog_catenate_string(mtr, (byte*) name, len);
if (type == MLOG_FILE_RENAME) {
- log_ptr = mlog_open(mtr, 30);
- mach_write_to_2(log_ptr, ut_strlen(new_name) + 1);
+ ulint len = strlen(new_name) + 1;
+ log_ptr = mlog_open(mtr, 2 + len);
+ ut_a(log_ptr);
+ mach_write_to_2(log_ptr, len);
log_ptr += 2;
-
mlog_close(mtr, log_ptr);
- mlog_catenate_string(mtr, (byte*) new_name,
- ut_strlen(new_name) + 1);
+ mlog_catenate_string(mtr, (byte*) new_name, len);
}
}
#endif
@@ -3775,6 +3786,12 @@ fil_io(
mode = OS_AIO_NORMAL;
}
+ if (type == OS_FILE_READ) {
+ srv_data_read+= len;
+ } else if (type == OS_FILE_WRITE) {
+ srv_data_written+= len;
+ }
+
/* Reserve the fil_system mutex and make sure that we can open at
least one file while holding it, if the file is not already open */
@@ -4060,6 +4077,7 @@ fil_flush(
fil_n_pending_tablespace_flushes++;
} else {
fil_n_pending_log_flushes++;
+ fil_n_log_flushes++;
}
#ifdef __WIN__
if (node->is_raw_disk) {