Optimize small macroblock write bandwidth
This commit is contained in:
@ -345,8 +345,7 @@ int ObBloomFilterMacroBlockWriter::flush_macro_block()
|
||||
ObMacroBlockHandle macro_handle;
|
||||
ObMacroBlockWriteInfo macro_write_info;
|
||||
macro_write_info.buffer_ = data_buffer_.data();
|
||||
macro_write_info.size_ = data_buffer_.capacity();
|
||||
macro_write_info.size_ = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
macro_write_info.size_ = data_buffer_.upper_align_length();
|
||||
macro_write_info.io_desc_.set_wait_event(ObWaitEventIds::DB_FILE_COMPACT_WRITE);
|
||||
macro_write_info.io_desc_.set_group_id(ObIOModule::BLOOM_FILTER_IO);
|
||||
if (OB_FAIL(ObBlockManager::write_block(macro_write_info, macro_handle))) {
|
||||
|
||||
@ -59,6 +59,11 @@ public:
|
||||
return pos_;
|
||||
}
|
||||
|
||||
inline int64_t upper_align_length() const
|
||||
{
|
||||
return upper_align(pos_, DIO_ALIGN_SIZE);
|
||||
}
|
||||
|
||||
inline int64_t remain() const
|
||||
{
|
||||
return capacity_ - pos_;
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
virtual int write(const ObMacroBlockHandle ¯o_handle,
|
||||
const ObLogicMacroBlockId &logic_id,
|
||||
char *buf,
|
||||
const int64_t buf_len,
|
||||
const int64_t data_seq) = 0;
|
||||
virtual int wait() = 0;
|
||||
};
|
||||
|
||||
@ -843,7 +843,7 @@ int ObMacroBlock::flush(ObMacroBlockHandle ¯o_handle,
|
||||
} else {
|
||||
ObMacroBlockWriteInfo write_info;
|
||||
write_info.buffer_ = data_.data();
|
||||
write_info.size_ = data_.capacity();
|
||||
write_info.size_ = data_.upper_align_length();
|
||||
write_info.io_desc_.set_wait_event(ObWaitEventIds::DB_FILE_COMPACT_WRITE);
|
||||
if (OB_FAIL(macro_handle.async_write(write_info))) {
|
||||
STORAGE_LOG(WARN, "Fail to async write block", K(ret), K(macro_handle));
|
||||
|
||||
@ -1246,6 +1246,7 @@ int ObMacroBlockWriter::flush_macro_block(ObMacroBlock ¯o_block)
|
||||
} else if (OB_NOT_NULL(callback_) && OB_FAIL(callback_->write(macro_handle,
|
||||
cur_logic_id,
|
||||
macro_block.get_data_buf(),
|
||||
upper_align(macro_block.get_data_size(), DIO_ALIGN_SIZE),
|
||||
current_macro_seq_))) {
|
||||
STORAGE_LOG(WARN, "fail to do callback flush", K(ret));
|
||||
}
|
||||
|
||||
@ -1574,6 +1574,7 @@ int ObDDLRedoLogWriterCallback::init(const ObDDLMacroBlockType block_type,
|
||||
int ObDDLRedoLogWriterCallback::write(const ObMacroBlockHandle ¯o_handle,
|
||||
const ObLogicMacroBlockId &logic_id,
|
||||
char *buf,
|
||||
const int64_t buf_len,
|
||||
const int64_t data_seq)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -1585,7 +1586,7 @@ int ObDDLRedoLogWriterCallback::write(const ObMacroBlockHandle ¯o_handle,
|
||||
} else {
|
||||
macro_block_id_ = macro_handle.get_macro_id();
|
||||
redo_info_.table_key_ = table_key_;
|
||||
redo_info_.data_buffer_.assign(buf, OB_SERVER_BLOCK_MGR.get_macro_block_size());
|
||||
redo_info_.data_buffer_.assign(buf, buf_len);
|
||||
redo_info_.block_type_ = block_type_;
|
||||
redo_info_.logic_id_ = logic_id;
|
||||
redo_info_.start_scn_ = ddl_writer_->get_start_scn();
|
||||
|
||||
@ -343,6 +343,7 @@ public:
|
||||
const ObMacroBlockHandle ¯o_handle,
|
||||
const blocksstable::ObLogicMacroBlockId &logic_id,
|
||||
char *buf,
|
||||
const int64_t buf_len,
|
||||
const int64_t data_seq);
|
||||
int wait();
|
||||
int prepare_block_buffer_if_need();
|
||||
|
||||
@ -153,7 +153,7 @@ int ObStorageHAMacroBlockWriter::process(blocksstable::ObMacroBlocksWriteCtx &co
|
||||
LOG_WARN("header is reuse macro block", K(ret));
|
||||
} else {
|
||||
write_info.buffer_ = data.data();
|
||||
write_info.size_ = data.capacity();
|
||||
write_info.size_ = data.upper_align_length();
|
||||
write_handle.reset();
|
||||
if (OB_FAIL(ObBlockManager::async_write_block(write_info, write_handle))) {
|
||||
STORAGE_LOG(WARN, "fail to async write block", K(ret), K(write_info), K(write_handle));
|
||||
|
||||
@ -51,17 +51,12 @@ int ObLinkedMacroBlockWriter::write_block(const char *buf, const int64_t buf_len
|
||||
if (OB_UNLIKELY(!is_inited_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObLinkedMacroBlockWriter has not been inited", K(ret));
|
||||
} else if (OB_UNLIKELY(nullptr == buf)) {
|
||||
} else if (OB_UNLIKELY(nullptr == buf || buf_len < 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret), KP(buf));
|
||||
} else {
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
if (buf_len != macro_block_size) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret), K(macro_block_size), K(buf_len));
|
||||
LOG_WARN("invalid argument", K(ret), KP(buf), K(buf_len));
|
||||
} else {
|
||||
ObMacroBlockWriteInfo write_info;
|
||||
write_info.size_ = macro_block_size;
|
||||
write_info.size_ = buf_len;
|
||||
write_info.io_desc_ = io_desc_;
|
||||
write_info.buffer_ = buf;
|
||||
write_info.io_desc_.set_group_id(ObIOModule::LINKED_MACRO_BLOCK_IO);
|
||||
@ -92,7 +87,6 @@ int ObLinkedMacroBlockWriter::write_block(const char *buf, const int64_t buf_len
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -371,8 +365,9 @@ int ObLinkedMacroBlockItemWriter::write_block()
|
||||
common_header_->set_payload_size(
|
||||
static_cast<int32_t>(io_buf_pos_ - common_header_->get_serialize_size()));
|
||||
MacroBlockId pre_block_id;
|
||||
const int64_t upper_align_size = upper_align(io_buf_pos_, DIO_ALIGN_SIZE);
|
||||
if (OB_FAIL(block_writer_.write_block(
|
||||
io_buf_, io_buf_size_, *common_header_, *linked_header_, pre_block_id))) {
|
||||
io_buf_, upper_align_size, *common_header_, *linked_header_, pre_block_id))) {
|
||||
LOG_WARN("fail to write block", K(ret));
|
||||
} else if (OB_FAIL(set_pre_block_inflight_items_addr(pre_block_id))) {
|
||||
LOG_WARN("fail to set pre block inflight items addr", K(ret));
|
||||
|
||||
Reference in New Issue
Block a user