diff options
author | Eugene Kosov <claprix@yandex.ru> | 2018-12-27 21:14:07 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-14 13:53:04 +0200 |
commit | cbdc2d9489b2e37c4e5e7e64b77e27e1dd44146b (patch) | |
tree | b8f2d418873c03064beadafd74676c2249e5d31c /storage | |
parent | 46046f2e59d053c75433c9e5fdf4fbf487965593 (diff) | |
download | mariadb-git-cbdc2d9489b2e37c4e5e7e64b77e27e1dd44146b.tar.gz |
Replace log_group_t::file_header_bufs with local array
log_group_file_header_flush(): Use a stack-local variable
instead of the heap-allocated buffers.
Closes #1060
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/include/log0log.h | 4 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 33 |
2 files changed, 3 insertions, 34 deletions
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 336e33fccad..745714e791b 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -571,10 +571,6 @@ struct log_group_t{ lsn_t lsn; /** the byte offset of the above lsn */ lsn_t lsn_offset; - /** unaligned buffers */ - byte** file_header_bufs_ptr; - /** buffers for each file header in the group */ - byte** file_header_bufs; /** used only in recovery: recovery scan succeeded up to this lsn in this log group */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 4a789382004..13b98cda34a 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -786,7 +786,6 @@ log_sys_init() void log_init(ulint n_files) { - ulint i; log_group_t* group = &log_sys->log; group->n_files = n_files; @@ -805,22 +804,6 @@ log_init(ulint n_files) group->lsn = LOG_START_LSN; group->lsn_offset = LOG_FILE_HDR_SIZE; - group->file_header_bufs_ptr = static_cast<byte**>( - ut_zalloc_nokey(sizeof(byte*) * n_files)); - - group->file_header_bufs = static_cast<byte**>( - ut_zalloc_nokey(sizeof(byte**) * n_files)); - - for (i = 0; i < n_files; i++) { - group->file_header_bufs_ptr[i] = static_cast<byte*>( - ut_zalloc_nokey(LOG_FILE_HDR_SIZE - + OS_FILE_LOG_BLOCK_SIZE)); - - group->file_header_bufs[i] = static_cast<byte*>( - ut_align(group->file_header_bufs_ptr[i], - OS_FILE_LOG_BLOCK_SIZE)); - } - group->checkpoint_buf_ptr = static_cast<byte*>( ut_zalloc_nokey(2 * OS_FILE_LOG_BLOCK_SIZE)); @@ -874,7 +857,6 @@ log_group_file_header_flush( lsn_t start_lsn) /*!< in: log file data starts at this lsn */ { - byte* buf; lsn_t dest_offset; ut_ad(log_write_mutex_own()); @@ -885,9 +867,10 @@ log_group_file_header_flush( ? LOG_HEADER_FORMAT_10_3 : LOG_HEADER_FORMAT_10_2)); - buf = *(group->file_header_bufs + nth_file); + // man 2 open suggests this buffer to be aligned by 512 for O_DIRECT + MY_ALIGNED(OS_FILE_LOG_BLOCK_SIZE) + byte buf[OS_FILE_LOG_BLOCK_SIZE] = {0}; - memset(buf, 0, OS_FILE_LOG_BLOCK_SIZE); mach_write_to_4(buf + LOG_HEADER_FORMAT, group->format); mach_write_to_4(buf + LOG_HEADER_SUBFORMAT, srv_safe_truncate); mach_write_to_8(buf + LOG_HEADER_START_LSN, start_lsn); @@ -2247,18 +2230,8 @@ static void log_group_close(log_group_t* group) { - ulint i; - - for (i = 0; i < group->n_files; i++) { - ut_free(group->file_header_bufs_ptr[i]); - } - - ut_free(group->file_header_bufs_ptr); - ut_free(group->file_header_bufs); ut_free(group->checkpoint_buf_ptr); group->n_files = 0; - group->file_header_bufs_ptr = NULL; - group->file_header_bufs = NULL; group->checkpoint_buf_ptr = NULL; } |