replace THE_IO_DEVICE with LOCAL_DEVICE_INSTANCE
This commit is contained in:
parent
24ce37aae7
commit
4cf84fe2bb
@ -16,8 +16,6 @@
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
|
||||
ObIODevice *THE_IO_DEVICE = nullptr;
|
||||
|
||||
/**
|
||||
* -------------------------------------ObIOFd--------------------------------------------
|
||||
*/
|
||||
|
2
deps/oblib/src/common/storage/ob_io_device.h
vendored
2
deps/oblib/src/common/storage/ob_io_device.h
vendored
@ -518,8 +518,6 @@ protected:
|
||||
int64_t ref_cnt_;
|
||||
};
|
||||
|
||||
extern ObIODevice *THE_IO_DEVICE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,6 @@ int MockTenantModuleEnv::prepare_io()
|
||||
#endif
|
||||
common::ObString storage_type_prefix(OB_LOCAL_PREFIX);
|
||||
share::ObLocalDevice *local_device = static_cast<share::ObLocalDevice*>(get_device_inner(storage_type_prefix));
|
||||
THE_IO_DEVICE = local_device;
|
||||
// for unifying init/add_device_channel/destroy local_device and local_cache_device code below
|
||||
ObIODeviceWrapper::get_instance().set_local_device(local_device);
|
||||
#ifdef OB_BUILD_SHARED_STORAGE
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "lib/utility/ob_tracepoint.h"
|
||||
#include "lib/file/file_directory_utils.h"
|
||||
#include "share/io/ob_io_manager.h"
|
||||
#include "share/ob_io_device_helper.h"
|
||||
#include "observer/ob_server.h"
|
||||
#include "common/storage/ob_fd_simulator.h"
|
||||
|
||||
@ -3446,7 +3447,7 @@ int ObIOFaultDetector::record_timing_task(const int64_t first_id, const int64_t
|
||||
retry_task->io_info_.flag_.set_time_detect();
|
||||
retry_task->io_info_.fd_.first_id_ = first_id;
|
||||
retry_task->io_info_.fd_.second_id_ = second_id;
|
||||
retry_task->io_info_.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
retry_task->io_info_.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
retry_task->io_info_.offset_ = 0;
|
||||
retry_task->io_info_.callback_ = nullptr;
|
||||
retry_task->timeout_ms_ = io_config_.data_storage_warning_tolerance_time_; // default 5s
|
||||
|
@ -81,7 +81,7 @@ int ObGetFileSizeFunctor::func(const dirent *entry)
|
||||
LOG_WARN("file name too long", K(ret), K_(dir), K(entry->d_name));
|
||||
} else {
|
||||
ObIODFileStat statbuf;
|
||||
if (OB_FAIL(THE_IO_DEVICE->stat(full_path, statbuf))
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.stat(full_path, statbuf))
|
||||
&& OB_NO_SUCH_FILE_OR_DIRECTORY != ret) {
|
||||
LOG_WARN("fail to stat file", K(full_path), K(statbuf));
|
||||
} else if (OB_NO_SUCH_FILE_OR_DIRECTORY == ret) {
|
||||
@ -91,7 +91,7 @@ int ObGetFileSizeFunctor::func(const dirent *entry)
|
||||
total_size_ += statbuf.size_;
|
||||
} else if (S_ISDIR(statbuf.mode_)) {
|
||||
ObGetFileSizeFunctor functor(full_path);
|
||||
if (OB_FAIL(THE_IO_DEVICE->scan_dir(full_path, functor))) {
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.scan_dir(full_path, functor))) {
|
||||
LOG_WARN("fail to scan dir", K(ret), K(full_path), K(entry->d_name));
|
||||
} else {
|
||||
total_size_ += functor.get_total_size();
|
||||
@ -173,7 +173,6 @@ int ObSNIODeviceWrapper::init(
|
||||
ret = OB_IO_ERROR;
|
||||
LOG_ERROR("unknown storage type, not support", K(ret), K(data_dir));
|
||||
} else {
|
||||
THE_IO_DEVICE = local_device_;
|
||||
iod_opt_array[0].set("data_dir", data_dir);
|
||||
iod_opt_array[1].set("sstable_dir", sstable_dir);
|
||||
iod_opt_array[2].set("block_size", block_size);
|
||||
@ -182,8 +181,8 @@ int ObSNIODeviceWrapper::init(
|
||||
iod_opts.opt_cnt_ = MAX_IOD_OPT_CNT;
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret) && OB_NOT_NULL(THE_IO_DEVICE)) {
|
||||
if (OB_FAIL(THE_IO_DEVICE->init(iod_opts))) {
|
||||
if (OB_SUCC(ret) && OB_NOT_NULL(local_device_)) {
|
||||
if (OB_FAIL(local_device_->init(iod_opts))) {
|
||||
LOG_WARN("fail to init io device", K(ret), K(data_dir), K(sstable_dir), K(block_size),
|
||||
K(data_disk_percentage), K(data_disk_size));
|
||||
} else {
|
||||
@ -203,7 +202,6 @@ int ObSNIODeviceWrapper::init(
|
||||
void ObSNIODeviceWrapper::destroy()
|
||||
{
|
||||
if (is_inited_) {
|
||||
THE_IO_DEVICE = nullptr;
|
||||
if (NULL != local_device_) {
|
||||
local_device_->destroy();
|
||||
common::ObDeviceManager::get_instance().release_device((ObIODevice*&)local_device_);
|
||||
|
@ -118,7 +118,7 @@ int ObLogFileGroup::get_file_id_range(int64_t &min_file_id, int64_t &max_file_id
|
||||
|
||||
if (need_scan_dir) {
|
||||
ObGetFileIdRangeFunctor functor(log_dir_);
|
||||
if (OB_FAIL(THE_IO_DEVICE->scan_dir(log_dir_, functor))) {
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.scan_dir(log_dir_, functor))) {
|
||||
LOG_WARN("fail to scan dir", K(ret), K_(log_dir));
|
||||
} else {
|
||||
min_file_id = functor.get_min_file_id();
|
||||
@ -163,7 +163,7 @@ int ObLogFileGroup::get_total_used_size(int64_t &total_size) const
|
||||
LOG_WARN("not inited", K(ret));
|
||||
} else {
|
||||
ObGetFileSizeFunctor functor(log_dir_);
|
||||
if (OB_FAIL(THE_IO_DEVICE->scan_dir(log_dir_, functor))) {
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.scan_dir(log_dir_, functor))) {
|
||||
LOG_WARN("fail to scan dir", K(ret), K_(log_dir));
|
||||
} else {
|
||||
total_size = functor.get_total_size();
|
||||
@ -213,7 +213,7 @@ int ObLogFileGroup::check_file_existence(const char *dir, const int64_t file_id,
|
||||
} else if (OB_FAIL(ObLogFileHandler::format_file_path(
|
||||
full_path, sizeof(full_path), dir, file_id))) {
|
||||
LOG_WARN("failed to format file path", K(ret), K(dir), K(file_id));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->exist(full_path, b_exist))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.exist(full_path, b_exist))) {
|
||||
LOG_WARN("failed to check existence", K(ret), K(full_path));
|
||||
}
|
||||
return ret;
|
||||
|
@ -95,7 +95,7 @@ void ObLogFileHandler::destroy()
|
||||
log_dir_ = nullptr;
|
||||
file_id_ = OB_INVALID_FILE_ID;
|
||||
if (io_fd_.is_normal_file()) {
|
||||
THE_IO_DEVICE->close(io_fd_);
|
||||
LOCAL_DEVICE_INSTANCE.close(io_fd_);
|
||||
}
|
||||
io_fd_.reset();
|
||||
file_group_.destroy();
|
||||
@ -147,7 +147,7 @@ int ObLogFileHandler::exist(const int64_t file_id, bool &is_exist)
|
||||
LOG_WARN("invalid file id", K(ret), K(file_id));
|
||||
} else if (OB_FAIL(format_file_path(file_path, sizeof(file_path), log_dir_, file_id))) {
|
||||
LOG_WARN("fail to format file path", K(ret), K_(log_dir), K(file_id));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->exist(file_path, is_exist))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.exist(file_path, is_exist))) {
|
||||
LOG_WARN("fail to check file exists", K(ret), K(file_path));
|
||||
}
|
||||
return ret;
|
||||
@ -222,7 +222,7 @@ int ObLogFileHandler::inner_close(const ObIOFd &io_fd)
|
||||
} else if (!io_fd.is_normal_file()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("io fd is not normal file", K(ret), K(io_fd));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->close(io_fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.close(io_fd))) {
|
||||
LOG_WARN("fail to close io fd", K(ret), K(io_fd));
|
||||
}
|
||||
return ret;
|
||||
@ -250,7 +250,7 @@ int ObLogFileHandler::inner_read(const ObIOFd &io_fd, void *buf, const int64_t s
|
||||
ObIOInfo io_info;
|
||||
io_info.tenant_id_ = tenant_id_;
|
||||
io_info.fd_ = io_fd;
|
||||
io_info.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
io_info.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
io_info.offset_ = offset + read_sz;
|
||||
io_info.size_ = size - read_sz;
|
||||
io_info.flag_.set_mode(ObIOMode::READ);
|
||||
@ -306,7 +306,7 @@ int ObLogFileHandler::unlink(const char* file_path)
|
||||
LOG_WARN("fail to format file path", K(ret), KP(file_path));
|
||||
}
|
||||
while (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(THE_IO_DEVICE->unlink(file_path)) && OB_NO_SUCH_FILE_OR_DIRECTORY != ret) {
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.unlink(file_path)) && OB_NO_SUCH_FILE_OR_DIRECTORY != ret) {
|
||||
LOG_WARN("unlink failed", K(ret), K(file_path));
|
||||
ob_usleep<ObWaitEventIds::SLOG_NORMAL_RETRY_SLEEP>(UNLINK_RETRY_INTERVAL_US);
|
||||
ret = OB_SUCCESS;
|
||||
@ -339,7 +339,7 @@ int ObLogFileHandler::normal_retry_write(void *buf, int64_t size, int64_t offset
|
||||
io_info.flag_.set_write();
|
||||
io_info.tenant_id_ = tenant_id_;
|
||||
io_info.fd_ = io_fd_;
|
||||
io_info.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
io_info.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
io_info.offset_ = offset;
|
||||
io_info.size_ = size;
|
||||
io_info.flag_.set_resource_group_id(THIS_WORKER.get_group_id());
|
||||
@ -379,7 +379,7 @@ int ObLogFileHandler::open(const char *file_path, const int flags, const mode_t
|
||||
const int64_t MAX_RETRY_TIME = 30 * 1000 * 1000;
|
||||
const int64_t start_time = ObTimeUtility::fast_current_time();
|
||||
while (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(THE_IO_DEVICE->open(file_path, flags, mode, io_fd))) {
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(file_path, flags, mode, io_fd))) {
|
||||
LOG_WARN("failed to open file", K(ret), K(file_path), K(errno), KERRMSG);
|
||||
if (OB_TIMEOUT == ret || OB_EAGAIN == ret || OB_SERVER_OUTOF_DISK_SPACE == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
@ -450,7 +450,7 @@ int ObLogFileHandler::TmpFileCleaner::func(const dirent *entry)
|
||||
if (p_ret < 0 || p_ret >= sizeof(full_path)) {
|
||||
ret = OB_BUF_NOT_ENOUGH;
|
||||
LOG_WARN("file name too long", K(ret), K_(log_dir), "d_name", entry->d_name);
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->unlink(full_path))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.unlink(full_path))) {
|
||||
LOG_WARN("unlink file fail", K(ret), K(full_path));
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ void ObLogReadFdHandle::reset()
|
||||
if (nullptr != fd_item_) {
|
||||
fd_item_->dec_ref();
|
||||
if (is_local_) {
|
||||
THE_IO_DEVICE->close(fd_item_->io_fd_);
|
||||
LOCAL_DEVICE_INSTANCE.close(fd_item_->io_fd_);
|
||||
fd_item_->reset();
|
||||
OB_DELETE(ObLogReadFdCacheItem, MEMORY_LABEL, fd_item_);
|
||||
is_local_ = false;
|
||||
@ -195,7 +195,7 @@ void ObLogFileReader2::destroy()
|
||||
ObLogReadFdCacheItem *cur = tail_;
|
||||
while (nullptr != cur) {
|
||||
ObLogReadFdCacheItem *prev = cur->prev_;
|
||||
THE_IO_DEVICE->close(cur->io_fd_);
|
||||
LOCAL_DEVICE_INSTANCE.close(cur->io_fd_);
|
||||
cur->reset();
|
||||
OB_DELETE(ObLogReadFdCacheItem, MEMORY_LABEL, cur);
|
||||
cur = prev;
|
||||
@ -226,7 +226,7 @@ int ObLogFileReader2::pread(
|
||||
if (!target_io_fd.is_normal_file()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid fd", K(ret), K(target_io_fd));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(target_io_fd, offset, count, buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(target_io_fd, offset, count, buf, read_size))) {
|
||||
LOG_ERROR("fail to pread", K(ret), K(target_io_fd), K(offset), K(count), K(errno), KERRMSG);
|
||||
}
|
||||
}
|
||||
@ -422,7 +422,7 @@ int ObLogFileReader2::do_clear_work()
|
||||
} // lock end
|
||||
|
||||
if (OB_SUCC(ret) && nullptr != recycle_item) {
|
||||
THE_IO_DEVICE->close(recycle_item->io_fd_);
|
||||
LOCAL_DEVICE_INSTANCE.close(recycle_item->io_fd_);
|
||||
recycle_item->reset();
|
||||
OB_DELETE(ObLogReadFdCacheItem, MEMORY_LABEL, recycle_item);
|
||||
}
|
||||
@ -485,7 +485,7 @@ int ObLogFileReader2::put_new_item(
|
||||
LOG_WARN("set new item fail", K(ret), K(fd_key), K(*new_item));
|
||||
} else if (OB_HASH_EXIST == ret) {
|
||||
// some thread already put new, close self and get from cache again
|
||||
THE_IO_DEVICE->close(open_io_fd);
|
||||
LOCAL_DEVICE_INSTANCE.close(open_io_fd);
|
||||
if (nullptr != new_item) {
|
||||
new_item->reset();
|
||||
OB_DELETE(ObLogReadFdCacheItem, MEMORY_LABEL, new_item);
|
||||
@ -512,7 +512,7 @@ int ObLogFileReader2::put_new_item(
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
if (open_io_fd.is_normal_file()) {
|
||||
THE_IO_DEVICE->close(open_io_fd); // ignore ret
|
||||
LOCAL_DEVICE_INSTANCE.close(open_io_fd); // ignore ret
|
||||
}
|
||||
if (nullptr != new_item) {
|
||||
new_item->reset();
|
||||
|
@ -1,13 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan
|
||||
* PubL v2. You may obtain a copy of Mulan PubL v2 at:
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
|
||||
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||
* NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. See the
|
||||
* Mulan PubL v2 for more details.
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#define USING_LOG_PREFIX STORAGE_BLKMGR
|
||||
@ -123,10 +123,7 @@ void ObMacroBlockRewriteSeqGenerator::reset() { rewrite_seq_ = 0; }
|
||||
int ObMacroBlockRewriteSeqGenerator::generate_next_sequence(uint64_t &blk_seq) {
|
||||
int ret = OB_SUCCESS;
|
||||
SpinWLockGuard guard(lock_);
|
||||
if (OB_ISNULL(THE_IO_DEVICE)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("io device is null", K(ret));
|
||||
} else if (OB_UNLIKELY(MacroBlockId::MAX_WRITE_SEQ == rewrite_seq_)) {
|
||||
if (OB_UNLIKELY(MacroBlockId::MAX_WRITE_SEQ == rewrite_seq_)) {
|
||||
ret = OB_ERROR_OUT_OF_RANGE;
|
||||
LOG_ERROR("rewrite sequence number overflow!", K(ret),
|
||||
LITERAL_K(MacroBlockId::MAX_WRITE_SEQ), K(rewrite_seq_));
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "lib/utility/ob_macro_utils.h"
|
||||
#include "share/ob_force_print_log.h"
|
||||
#include "share/io/ob_io_manager.h"
|
||||
#include "share/ob_io_device_helper.h"
|
||||
#include "storage/blocksstable/ob_block_manager.h"
|
||||
#include "share/io/ob_io_manager.h"
|
||||
#include "share/ob_force_print_log.h"
|
||||
@ -141,7 +142,7 @@ int ObMacroBlockHandle::async_read(const ObMacroBlockReadInfo &read_info)
|
||||
io_info.fd_.first_id_ = read_info.macro_block_id_.first_id();
|
||||
io_info.fd_.second_id_ = read_info.macro_block_id_.second_id();
|
||||
io_info.fd_.third_id_ = read_info.macro_block_id_.third_id();
|
||||
io_info.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
io_info.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
const int64_t real_timeout_ms = min(read_info.io_timeout_ms_, GCONF._data_storage_io_timeout / 1000L);
|
||||
io_info.timeout_us_ = real_timeout_ms * 1000L;
|
||||
io_info.user_data_buf_ = read_info.buf_;
|
||||
@ -197,7 +198,7 @@ int ObMacroBlockHandle::async_write(const ObMacroBlockWriteInfo &write_info)
|
||||
io_info.fd_.first_id_ = macro_id_.first_id();
|
||||
io_info.fd_.second_id_ = macro_id_.second_id();
|
||||
io_info.fd_.third_id_ = macro_id_.third_id();
|
||||
io_info.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
io_info.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
if (OB_FAIL(write_info.fill_io_info_for_backup(macro_id_, io_info))) {
|
||||
LOG_WARN("failed to fill io info for backup", K(ret), K_(macro_id));
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "ob_object_manager.h"
|
||||
#include "ob_block_manager.h"
|
||||
#include "share/ob_io_device_helper.h"
|
||||
#include "storage/meta_store/ob_tenant_seq_generator.h"
|
||||
#ifdef OB_BUILD_SHARED_STORAGE
|
||||
#include "storage/shared_storage/ob_file_manager.h"
|
||||
@ -240,7 +241,7 @@ int ObObjectManager::init(const bool is_shared_storage, const int64_t macro_obje
|
||||
if (OB_FAIL(super_block_buf_holder_.init(ObServerSuperBlockHeader::OB_MAX_SUPER_BLOCK_SIZE))) {
|
||||
LOG_WARN("fail to init super block buffer holder, ", K(ret));
|
||||
} else if (!is_shared_storage) {
|
||||
if (OB_FAIL(OB_SERVER_BLOCK_MGR.init(THE_IO_DEVICE, macro_object_size))) {
|
||||
if (OB_FAIL(OB_SERVER_BLOCK_MGR.init(&LOCAL_DEVICE_INSTANCE, macro_object_size))) {
|
||||
LOG_WARN("fail to init block manager", K(ret), K(macro_object_size));
|
||||
}
|
||||
} else {
|
||||
@ -501,7 +502,7 @@ int ObObjectManager::update_super_block(const common::ObLogCursor &replay_start_
|
||||
tmp_super_block.construct_header();
|
||||
if (OB_FAIL(OB_SERVER_BLOCK_MGR.write_super_block(tmp_super_block, super_block_buf_holder_))) {
|
||||
LOG_WARN("fail to write server super block", K(ret));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->fsync_block())) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.fsync_block())) {
|
||||
LOG_WARN("failed to fsync_block", K(ret));
|
||||
} else {
|
||||
super_block_ = tmp_super_block;
|
||||
|
@ -554,7 +554,7 @@ int ObTenantStorageMetaPersister::write_update_tablet_slog_(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const ObTabletMapKey tablet_key(ls_id, tablet_id);
|
||||
if (OB_FAIL(THE_IO_DEVICE->fsync_block())) { // make sure that all data or meta written on the macro block is flushed
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.fsync_block())) { // make sure that all data or meta written on the macro block is flushed
|
||||
LOG_WARN("fail to fsync_block", K(ret));
|
||||
} else {
|
||||
ObUpdateTabletLog slog_entry(ls_id, tablet_id, disk_addr);
|
||||
|
@ -94,7 +94,7 @@ int ObTenantStorageCheckpointWriter::record_meta(MacroBlockId &ls_meta_entry)
|
||||
LOG_WARN("ObTenantStorageCheckpointWriter not inited", K(ret));
|
||||
} else if (OB_FAIL(record_ls_meta(ls_meta_entry))) {
|
||||
LOG_WARN("fail to construct ls ckpt linked list", K(ret));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->fsync_block())) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.fsync_block())) {
|
||||
LOG_WARN("fail to fsync_block", K(ret));
|
||||
}
|
||||
return ret;
|
||||
|
@ -340,13 +340,13 @@ void ObAdminDumpsstExecutor::dump_macro_block(const ObDumpMacroBlockContext &mac
|
||||
const int64_t offset = 0;
|
||||
const int64_t size = OB_DEFAULT_MACRO_BLOCK_SIZE;
|
||||
macro_buf = read_info.buf_;
|
||||
if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "open file failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, buf_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, buf_size))) {
|
||||
STORAGE_LOG(ERROR, "read block failed", K(macro_block_context));
|
||||
}
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
} else {
|
||||
if (OB_FAIL(ObBlockManager::read_block(read_info, macro_handle))) {
|
||||
@ -407,9 +407,9 @@ void ObAdminDumpsstExecutor::dump_tablet_meta(const ObDumpMacroBlockContext &mac
|
||||
if (OB_ISNULL(macro_buf = reinterpret_cast<char*>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(WARN, "failed to alloc macro read info buffer", K(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "open file failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "read block failed", K(macro_block_context));
|
||||
} else if (FALSE_IT(disk_addr.set_block_addr(tablet_meta_obj_id, 0/*offset*/, size, ObMetaDiskAddr::DiskType::RAW_BLOCK))) {
|
||||
} else if (FALSE_IT(tablet.set_tablet_addr(disk_addr))) {
|
||||
@ -420,7 +420,7 @@ void ObAdminDumpsstExecutor::dump_tablet_meta(const ObDumpMacroBlockContext &mac
|
||||
}
|
||||
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -451,9 +451,9 @@ void ObAdminDumpsstExecutor::dump_table_store(const ObDumpMacroBlockContext &mac
|
||||
if (OB_ISNULL(macro_buf = reinterpret_cast<char*>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(WARN, "failed to alloc macro read info buffer", K(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "open file failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "read block failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(header.deserialize(macro_buf, OB_DEFAULT_MACRO_BLOCK_SIZE, pos))) {
|
||||
STORAGE_LOG(ERROR, "fail to deserialize header", K(ret));
|
||||
@ -464,7 +464,7 @@ void ObAdminDumpsstExecutor::dump_table_store(const ObDumpMacroBlockContext &mac
|
||||
}
|
||||
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -494,9 +494,9 @@ void ObAdminDumpsstExecutor::dump_storage_schema(const ObDumpMacroBlockContext &
|
||||
if (OB_ISNULL(macro_buf = reinterpret_cast<char*>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(WARN, "failed to alloc macro read info buffer", K(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "open file failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "read block failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(header.deserialize(macro_buf, OB_DEFAULT_MACRO_BLOCK_SIZE, pos))) {
|
||||
STORAGE_LOG(ERROR, "fail to deserialize header", K(ret), K(read_size), K(pos), K(macro_block_context));
|
||||
@ -507,7 +507,7 @@ void ObAdminDumpsstExecutor::dump_storage_schema(const ObDumpMacroBlockContext &
|
||||
}
|
||||
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -535,16 +535,16 @@ int ObAdminDumpsstExecutor::do_dump_prewarm_index(
|
||||
if (OB_ISNULL(macro_buf = reinterpret_cast<char*>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(ERROR, "failed to alloc macro read info buffer", KR(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(path, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(path, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "fail to open file", KR(ret), K(path));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "fail to read file", KR(ret), K(fd), K(offset), K(size), KP(macro_buf));
|
||||
} else if (OB_FAIL(index.deserialize(macro_buf, read_size, pos))) {
|
||||
STORAGE_LOG(ERROR, "fail to deserialize prewarm index", KR(ret), K(read_size), K(pos), KP(macro_buf));
|
||||
}
|
||||
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -578,7 +578,7 @@ void ObAdminDumpsstExecutor::dump_prewarm_data(const ObDumpMacroBlockContext &ma
|
||||
STORAGE_LOG(ERROR, "file path is null", KR(ret), K_(macro_block_context.object_file_path), K_(macro_block_context.prewarm_index));
|
||||
} else if (OB_FAIL(do_dump_prewarm_index(macro_block_context.prewarm_index_, index))) {
|
||||
STORAGE_LOG(ERROR, "fail to parse prewarm_index", KR(ret), K_(macro_block_context.object_file_path));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "fail to open file", KR(ret), K_(macro_block_context.object_file_path));
|
||||
} else {
|
||||
fprintf(stdout, "ObHotTabletInfoIndex: %s\n\n", to_cstring(index));
|
||||
@ -594,7 +594,7 @@ void ObAdminDumpsstExecutor::dump_prewarm_data(const ObDumpMacroBlockContext &ma
|
||||
if (OB_ISNULL(buf = static_cast<char *>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(ERROR, "fail to alloc memory", KR(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, cur_offset, size, buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, cur_offset, size, buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "fail to read data", KR(ret), K(fd), K(cur_offset), K(size), KP(buf));
|
||||
} else if (OB_UNLIKELY(size != read_size)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -608,7 +608,7 @@ void ObAdminDumpsstExecutor::dump_prewarm_data(const ObDumpMacroBlockContext &ma
|
||||
}
|
||||
}
|
||||
if (fd.is_valid()) {
|
||||
(void)THE_IO_DEVICE->close(fd);
|
||||
(void)LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
fprintf(stderr, "fail to dump_prewarm_data, ret=%s\n", ob_error_name(ret));
|
||||
@ -634,9 +634,9 @@ void ObAdminDumpsstExecutor::dump_is_deleted_obj(const ObDumpMacroBlockContext &
|
||||
if (OB_ISNULL(macro_buf = reinterpret_cast<char*>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(WARN, "failed to alloc macro read info buffer", K(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "open file failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "read block failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(is_deleted_obj.deserialize(macro_buf, read_size, pos))) {
|
||||
STORAGE_LOG(ERROR, "fail to deserialize is_deleted_obj", K(ret), K(read_size), K(pos), K(macro_block_context));
|
||||
@ -645,7 +645,7 @@ void ObAdminDumpsstExecutor::dump_is_deleted_obj(const ObDumpMacroBlockContext &
|
||||
}
|
||||
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -672,9 +672,9 @@ void ObAdminDumpsstExecutor::dump_meta_list(const ObDumpMacroBlockContext ¯o
|
||||
if (OB_ISNULL(macro_buf = reinterpret_cast<char*>(io_allocator_.alloc(size)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
STORAGE_LOG(WARN, "failed to alloc macro read info buffer", K(ret), K(size));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.open(macro_block_context.object_file_path_, O_RDONLY, 0, fd))) {
|
||||
STORAGE_LOG(ERROR, "open file failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->pread(fd, offset, size, macro_buf, read_size))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.pread(fd, offset, size, macro_buf, read_size))) {
|
||||
STORAGE_LOG(ERROR, "read block failed", K(macro_block_context));
|
||||
} else if (OB_FAIL(meta_info.deserialize(macro_buf, read_size, pos))) {
|
||||
STORAGE_LOG(ERROR, "fail to deserialize GCTabletMetaInfoList", K(ret), K(read_size), K(pos), K(macro_block_context));
|
||||
@ -683,7 +683,7 @@ void ObAdminDumpsstExecutor::dump_meta_list(const ObDumpMacroBlockContext ¯o
|
||||
}
|
||||
|
||||
if (fd.is_valid()) {
|
||||
(void) THE_IO_DEVICE->close(fd);
|
||||
(void) LOCAL_DEVICE_INSTANCE.close(fd);
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
|
@ -78,7 +78,7 @@ void TestLogFileHandler::SetUp()
|
||||
void TestLogFileHandler::TearDown()
|
||||
{
|
||||
//system("rm -rf ./log_file_test");
|
||||
THE_IO_DEVICE->destroy();
|
||||
LOCAL_DEVICE_INSTANCE.destroy();
|
||||
OB_LOG_FILE_READER.destroy();
|
||||
TestDataFilePrepare::TearDown();
|
||||
#ifdef ERRSIM
|
||||
@ -429,10 +429,10 @@ TEST_F(TestLogFileHandler, clean_tmp_files)
|
||||
common::ObIOFd io_fd;
|
||||
char full_path[MAX_PATH_SIZE] = { 0 };
|
||||
snprintf(full_path, sizeof(full_path), "%s/%d", log_dir, i);
|
||||
ret = THE_IO_DEVICE->open(full_path, ObLogDefinition::LOG_APPEND_FLAG, ObLogDefinition::FILE_OPEN_MODE, io_fd);
|
||||
ret = LOCAL_DEVICE_INSTANCE.open(full_path, ObLogDefinition::LOG_APPEND_FLAG, ObLogDefinition::FILE_OPEN_MODE, io_fd);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(io_fd.is_normal_file());
|
||||
ret = THE_IO_DEVICE->close(io_fd);
|
||||
ret = LOCAL_DEVICE_INSTANCE.close(io_fd);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
}
|
||||
|
||||
@ -441,10 +441,10 @@ TEST_F(TestLogFileHandler, clean_tmp_files)
|
||||
common::ObIOFd io_fd;
|
||||
char full_path[MAX_PATH_SIZE] = { 0 };
|
||||
snprintf(full_path, sizeof(full_path), "%s/%d.tmp", log_dir, i);
|
||||
ret = THE_IO_DEVICE->open(full_path, ObLogDefinition::LOG_APPEND_FLAG, ObLogDefinition::FILE_OPEN_MODE, io_fd);
|
||||
ret = LOCAL_DEVICE_INSTANCE.open(full_path, ObLogDefinition::LOG_APPEND_FLAG, ObLogDefinition::FILE_OPEN_MODE, io_fd);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(io_fd.is_normal_file());
|
||||
ret = THE_IO_DEVICE->close(io_fd);
|
||||
ret = LOCAL_DEVICE_INSTANCE.close(io_fd);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ TEST_F(TestLogFileHandler, clean_tmp_files)
|
||||
bool b_exist = false;
|
||||
char full_path[MAX_PATH_SIZE] = { 0 };
|
||||
snprintf(full_path, sizeof(full_path), "%s/%d", log_dir, i);
|
||||
ret = THE_IO_DEVICE->exist(full_path, b_exist);
|
||||
ret = LOCAL_DEVICE_INSTANCE.exist(full_path, b_exist);
|
||||
ASSERT_TRUE(b_exist);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void TestOpEngine::destory()
|
||||
ObKVGlobalCache::get_instance().destroy();
|
||||
ObClusterVersion::get_instance().destroy();
|
||||
|
||||
// THE_IO_DEVICE->destroy();
|
||||
// LOCAL_DEVICE_INSTANCE.destroy();
|
||||
}
|
||||
|
||||
common::ObIODevice *TestOpEngine::get_device_inner()
|
||||
@ -149,7 +149,7 @@ int TestOpEngine::prepare_io(const string & test_data_name_suffix)
|
||||
storage_env_.data_disk_percentage_ = 0;
|
||||
storage_env_.log_disk_size_ = 20 * 1024 * 1024 * 1024ll;
|
||||
share::ObLocalDevice *local_device = static_cast<share::ObLocalDevice *>(get_device_inner());
|
||||
THE_IO_DEVICE = local_device;
|
||||
ObIODeviceWrapper::get_instance().set_local_device(local_device);
|
||||
iod_opt_array[0].set("data_dir", storage_env_.data_dir_);
|
||||
iod_opt_array[1].set("sstable_dir", storage_env_.sstable_dir_);
|
||||
iod_opt_array[2].set("block_size", storage_env_.default_block_size_);
|
||||
@ -171,21 +171,16 @@ int TestOpEngine::prepare_io(const string & test_data_name_suffix)
|
||||
} else if (0 != system(cmd)) {
|
||||
ret = OB_ERR_SYS;
|
||||
LOG_WARN("failed to exec cmd", K(ret), K(cmd), K(errno), KERRMSG);
|
||||
//<<<<<<< HEAD
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(slog_dir))) {
|
||||
LOG_WARN("failed to create slog dir", K(ret), K(slog_dir));
|
||||
} else if (OB_FAIL(FileDirectoryUtils::create_full_path(file_dir))) {
|
||||
LOG_WARN("failed to create file dir", K(ret), K(file_dir));
|
||||
//=======
|
||||
} else if (OB_ISNULL(THE_IO_DEVICE)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("io device is null", K(ret));
|
||||
//>>>>>>> origin/palf_tiered_storage
|
||||
} else if (OB_FAIL(THE_IO_DEVICE->init(iod_opts))) {
|
||||
} else if (OB_FAIL(LOCAL_DEVICE_INSTANCE.init(iod_opts))) {
|
||||
LOG_WARN("fail to init io device", K(ret), K_(storage_env));
|
||||
} else if (OB_FAIL(ObIOManager::get_instance().init())) {
|
||||
LOG_WARN("fail to init io manager", K(ret));
|
||||
} else if (OB_FAIL(ObIOManager::get_instance().add_device_channel(THE_IO_DEVICE, async_io_thread_count,
|
||||
} else if (OB_FAIL(ObIOManager::get_instance().add_device_channel(&LOCAL_DEVICE_INSTANCE,
|
||||
async_io_thread_count,
|
||||
sync_io_thread_count, max_io_depth))) {
|
||||
LOG_WARN("add device channel failed", K(ret));
|
||||
} else if (OB_FAIL(SERVER_STORAGE_META_SERVICE.init(false/*is_shared_storage*/))) {
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
OK(ObIOManager::get_instance().start());
|
||||
|
||||
// add io device
|
||||
OK(OB_IO_MANAGER.add_device_channel(THE_IO_DEVICE, 16, 2, 1024));
|
||||
OK(OB_IO_MANAGER.add_device_channel(&LOCAL_DEVICE_INSTANCE, 16, 2, 1024));
|
||||
|
||||
static ObTenantBase tenant_ctx(OB_SYS_TENANT_ID);
|
||||
ObTenantEnv::set_tenant(&tenant_ctx);
|
||||
|
@ -111,7 +111,7 @@ static void get_random_io_info(ObIOInfo &io_info)
|
||||
io_info.tenant_id_ = OB_SERVER_TENANT_ID;
|
||||
io_info.fd_.first_id_ = ObRandom::rand(0, 10000);
|
||||
io_info.fd_.second_id_ = ObRandom::rand(0, 10000);
|
||||
io_info.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
io_info.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
io_info.flag_.set_mode(static_cast<ObIOMode>(ObRandom::rand(0, (int)ObIOMode::MAX_MODE - 1)));
|
||||
io_info.flag_.set_resource_group_id(USER_RESOURCE_OTHER_GROUP_ID); // 0 means default
|
||||
io_info.flag_.set_wait_event(ObRandom::rand(1, 9999));
|
||||
@ -208,7 +208,7 @@ TEST_F(TestIOStruct, IOInfo)
|
||||
ObIOFd fd;
|
||||
fd.first_id_ = 0;
|
||||
fd.second_id_ = 0;
|
||||
fd.device_handle_ = THE_IO_DEVICE;
|
||||
fd.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
info.tenant_id_ = OB_SERVER_TENANT_ID;
|
||||
info.fd_ = fd;
|
||||
info.flag_.set_mode(ObIOMode::READ);
|
||||
@ -305,7 +305,7 @@ TEST_F(TestIOStruct, IORequest)
|
||||
ObIOFd fd;
|
||||
fd.first_id_ = 0;
|
||||
fd.second_id_ = 1;
|
||||
fd.device_handle_ = THE_IO_DEVICE;
|
||||
fd.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
// default invalid
|
||||
ObIOResult result;
|
||||
ASSERT_FALSE(result.is_inited_);
|
||||
@ -694,7 +694,7 @@ TEST_F(TestIOStruct, IOResult)
|
||||
ObIOFd fd;
|
||||
fd.first_id_ = 0;
|
||||
fd.second_id_ = 1;
|
||||
fd.device_handle_ = THE_IO_DEVICE;
|
||||
fd.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
|
||||
void *result_buf = holder.get_ptr()->io_allocator_.alloc(sizeof(ObIOResult));
|
||||
ObIOResult *result = new (result_buf) ObIOResult;
|
||||
@ -878,7 +878,7 @@ public:
|
||||
ASSERT_SUCC(OB_IO_MANAGER.start());
|
||||
|
||||
// add io device
|
||||
ASSERT_SUCC(OB_IO_MANAGER.add_device_channel(THE_IO_DEVICE, 16, 2, 1024));
|
||||
ASSERT_SUCC(OB_IO_MANAGER.add_device_channel(&LOCAL_DEVICE_INSTANCE, 16, 2, 1024));
|
||||
|
||||
// add tenant io manager
|
||||
const uint64_t tenant_id = OB_SERVER_TENANT_ID;
|
||||
@ -941,16 +941,16 @@ TEST_F(TestIOManager, memory_pool)
|
||||
TEST_F(TestIOManager, simple)
|
||||
{
|
||||
ObIOFd fd;
|
||||
ASSERT_SUCC(THE_IO_DEVICE->open(TEST_ROOT_DIR "/test_io_file", O_CREAT | O_DIRECT | O_TRUNC | O_RDWR, 0644, fd));
|
||||
ASSERT_SUCC(LOCAL_DEVICE_INSTANCE.open(TEST_ROOT_DIR "/test_io_file", O_CREAT | O_DIRECT | O_TRUNC | O_RDWR, 0644, fd));
|
||||
ASSERT_TRUE(fd.is_valid());
|
||||
ObIOManager &io_mgr = ObIOManager::get_instance();
|
||||
|
||||
// fallocate
|
||||
const int64_t FILE_SIZE = 4 * 1024 * 1024;
|
||||
ASSERT_SUCC(THE_IO_DEVICE->fallocate(fd, 0, 0, FILE_SIZE)); // 4M
|
||||
ASSERT_SUCC(LOCAL_DEVICE_INSTANCE.fallocate(fd, 0, 0, FILE_SIZE)); // 4M
|
||||
{
|
||||
oceanbase::common::ObIODFileStat stat_buf;
|
||||
ASSERT_SUCC(THE_IO_DEVICE->stat(TEST_ROOT_DIR "/test_io_file", stat_buf));
|
||||
ASSERT_SUCC(LOCAL_DEVICE_INSTANCE.stat(TEST_ROOT_DIR "/test_io_file", stat_buf));
|
||||
ASSERT_EQ(FILE_SIZE, stat_buf.size_);
|
||||
}
|
||||
|
||||
@ -960,7 +960,7 @@ TEST_F(TestIOManager, simple)
|
||||
ObIOInfo io_info;
|
||||
io_info.tenant_id_ = OB_SERVER_TENANT_ID;
|
||||
io_info.fd_ = fd;
|
||||
io_info.fd_.device_handle_ = THE_IO_DEVICE;
|
||||
io_info.fd_.device_handle_ = &LOCAL_DEVICE_INSTANCE;
|
||||
io_info.flag_.set_write();
|
||||
io_info.flag_.set_resource_group_id(USER_RESOURCE_OTHER_GROUP_ID);
|
||||
io_info.flag_.set_wait_event(100);
|
||||
@ -978,7 +978,7 @@ TEST_F(TestIOManager, simple)
|
||||
// check size
|
||||
{
|
||||
oceanbase::common::ObIODFileStat stat_buf;
|
||||
ASSERT_SUCC(THE_IO_DEVICE->stat(TEST_ROOT_DIR "/test_io_file", stat_buf));
|
||||
ASSERT_SUCC(LOCAL_DEVICE_INSTANCE.stat(TEST_ROOT_DIR "/test_io_file", stat_buf));
|
||||
ASSERT_EQ(FILE_SIZE, stat_buf.size_);
|
||||
}
|
||||
|
||||
@ -1029,7 +1029,7 @@ TEST_F(TestIOManager, simple)
|
||||
io_handle.reset();
|
||||
// ASSERT_EQ(10, tmp_number); // callback destructor called
|
||||
|
||||
ASSERT_SUCC(THE_IO_DEVICE->close(fd));
|
||||
ASSERT_SUCC(LOCAL_DEVICE_INSTANCE.close(fd));
|
||||
}
|
||||
|
||||
|
||||
@ -1307,7 +1307,7 @@ TEST_F(TestIOManager, tenant)
|
||||
device.device_id_ = 1;
|
||||
strcpy(device.file_path_, "./perf_test");
|
||||
device.file_size_ = 1024L * 1024L * 1024L;
|
||||
device.device_handle_ = static_cast<ObLocalDevice *>(THE_IO_DEVICE);
|
||||
device.device_handle_ = static_cast<ObLocalDevice *>(&LOCAL_DEVICE_INSTANCE);
|
||||
prepare_file(device.file_path_, device.file_size_, device.fd_);
|
||||
load.device_ = &device;
|
||||
load.device_id_ = 1; // unused
|
||||
|
Loading…
x
Reference in New Issue
Block a user