From baa96708eb778eb244d6fa1d02456d3733a3b1b7 Mon Sep 17 00:00:00 2001 From: hiddenbomb Date: Tue, 4 Jan 2022 11:39:41 +0800 Subject: [PATCH] set DIO_ALIGN_SIZE from 512 to 4096 --- deps/oblib/src/lib/ob_define.h | 2 +- src/share/redolog/ob_log_disk_manager.cpp | 4 +--- src/share/redolog/ob_log_file_store.cpp | 5 ++--- unittest/storage/blocksstable/test_data_buffer.cpp | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/deps/oblib/src/lib/ob_define.h b/deps/oblib/src/lib/ob_define.h index 8cfcf72507..3e9cdf3684 100644 --- a/deps/oblib/src/lib/ob_define.h +++ b/deps/oblib/src/lib/ob_define.h @@ -1874,7 +1874,7 @@ enum ObJITEnableMode { #define DATABUFFER_SERIALIZE_INFO data_buffer_.get_data(), data_buffer_.get_capacity(), data_buffer_.get_position() -#define DIO_ALIGN_SIZE 512 +#define DIO_ALIGN_SIZE 4096 #define DIO_READ_ALIGN_SIZE 4096 #define DIO_ALLOCATOR_CACHE_BLOCK_SIZE (OB_DEFAULT_MACRO_BLOCK_SIZE + DIO_READ_ALIGN_SIZE) #define CORO_INIT_PRIORITY 120 diff --git a/src/share/redolog/ob_log_disk_manager.cpp b/src/share/redolog/ob_log_disk_manager.cpp index 262129fbc5..f6668c7f26 100644 --- a/src/share/redolog/ob_log_disk_manager.cpp +++ b/src/share/redolog/ob_log_disk_manager.cpp @@ -910,9 +910,7 @@ int ObLogDiskManager::copy_file_content( int64_t read_len = 0; int64_t write_len = 0; int64_t offset = 0; - // CLOG and ILOG DIO aligned size are all CLOG_DIO_ALIGN_SIZE - // SLOG DIO aligned size is DIO_ALIGN_SIZE - int64_t align_size = SLOG_WRITE_POOL == pool_type_ ? DIO_ALIGN_SIZE : CLOG_DIO_ALIGN_SIZE; + const int64_t align_size = DIO_ALIGN_SIZE; if (!src_fd.is_valid() || file_offset < 0) { ret = OB_INVALID_ARGUMENT; diff --git a/src/share/redolog/ob_log_file_store.cpp b/src/share/redolog/ob_log_file_store.cpp index aae9304670..e54ad60cb7 100644 --- a/src/share/redolog/ob_log_file_store.cpp +++ b/src/share/redolog/ob_log_file_store.cpp @@ -483,7 +483,7 @@ int ObLogFileStore::read(void* buf, int64_t count, int64_t offset, int64_t& read event_sz += rd_size; } else if (event_res == 0) { // read nothing from file ret = OB_READ_NOTHING; - } else if (event_res > 0 && event_res < rd_size && (0 == event_res % DIO_ALIGN_SIZE)) { // partial complete + } else if (event_res > 0 && event_res < rd_size) { // partial complete event_sz += event_res; COMMON_LOG(INFO, "re-submit read", K(i), K(event_res), K(rd_size), K(event_sz), K(count)); } else { @@ -1021,8 +1021,7 @@ int ObLogFileStore::process_io_getevents(int64_t& submitted, io_context_t ctx, s } else if (event_res == wr_info->size_) { // full complete wr_info->complete_ = true; wr_info->ret_ = OB_SUCCESS; - } else if (event_res > 0 && event_res < wr_info->size_ && - (0 == event_res % DIO_ALIGN_SIZE)) { // partial complete + } else if (event_res > 0 && event_res < wr_info->size_) { // partial complete wr_info->buf_ = wr_info->buf_ + event_res; wr_info->size_ -= event_res; wr_info->offset_ += event_res; diff --git a/unittest/storage/blocksstable/test_data_buffer.cpp b/unittest/storage/blocksstable/test_data_buffer.cpp index 89d4a7d385..975122caca 100644 --- a/unittest/storage/blocksstable/test_data_buffer.cpp +++ b/unittest/storage/blocksstable/test_data_buffer.cpp @@ -56,9 +56,9 @@ TEST_F(TestDataBuffer, test_ObSelfBufferWriter) { int ret = OB_SUCCESS; int64_t big_size = 256L * 1024L * 1024L * 1024L * 1024L * 1024L; // 256TB - ObSelfBufferWriter buf_align(1024, ObModIds::TEST, true); + ObSelfBufferWriter buf_align(4096, ObModIds::TEST, true); ObSelfBufferWriter buf_not_align(0, ObModIds::TEST, false); - ret = buf_align.ensure_space(1024); + ret = buf_align.ensure_space(4096); ASSERT_EQ(ret, OB_SUCCESS); ret = buf_align.ensure_space(4097); -- GitLab