some bugfixes for tmp_file
This commit is contained in:
parent
c242ecd8f1
commit
42a423f1cb
@ -445,7 +445,7 @@ void TestMultiTmpFileStress::run1()
|
||||
int64_t fd = 0;
|
||||
ObTenantEnv::set_tenant(tenant_ctx_);
|
||||
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir_id_);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir_id_, "");
|
||||
std::cout << "normal case, fd: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
STORAGE_LOG(INFO, "open file success", K(fd));
|
||||
|
@ -145,7 +145,7 @@ TEST_F(TestTmpFile, test_unaligned_data_read_write)
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -260,7 +260,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -431,7 +431,7 @@ TEST_F(TestTmpFile, test_cached_read)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -575,7 +575,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -733,7 +733,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -1023,7 +1023,7 @@ TEST_F(TestTmpFile, test_truncate_to_flushed_page_id)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -1137,7 +1137,7 @@ TEST_F(TestTmpFile, test_write_last_page_during_flush)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -1221,7 +1221,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << " tenant_id:"<< MTL_ID() << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
@ -1351,7 +1351,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
for (int i = 0; i < file_num; ++i) {
|
||||
int64_t dir = i % 2 == 0 ? dir1 : dir2;
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
fds[i] = fd;
|
||||
@ -1664,7 +1664,7 @@ TEST_F(TestTmpFile, test_aio_pread)
|
||||
int64_t fd = -1;
|
||||
ret = MTL(ObTenantTmpFileManager *)->alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
std::cout << "open temporary file: " << fd << std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
tmp_file::ObTmpFileHandle file_handle;
|
||||
|
@ -262,7 +262,7 @@ TEST_F(TestFlushListIterator, test_iter_order)
|
||||
for (auto &mock_record: array) {
|
||||
int64_t fd = -1;
|
||||
int64_t dir = mock_record.dir;
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir);
|
||||
ret = MTL(ObTenantTmpFileManager *)->open(fd, dir, "");
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
mock_dirty_record_[fd] = mock_record;
|
||||
|
@ -693,6 +693,8 @@ int ObTmpFileFlushManager::drive_flush_task_retry_(
|
||||
FlushState &next_state)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
|
||||
next_state = state;
|
||||
switch (state) {
|
||||
case FlushState::TFFT_INSERT_META_TREE:
|
||||
@ -705,6 +707,10 @@ int ObTmpFileFlushManager::drive_flush_task_retry_(
|
||||
if (0 == flush_task.get_flush_infos().count()) {
|
||||
STORAGE_LOG(INFO, "all flush info is aborted", KR(ret), K(flush_task));
|
||||
next_state = FlushState::TFFT_ABORT;
|
||||
if (OB_TMP_FAIL(tmp_file_block_mgr_.write_back_failed(flush_task.get_block_index()))) {
|
||||
STORAGE_LOG(ERROR, "fail to notify tmp file block write back failed",
|
||||
KR(ret), KR(tmp_ret), K(flush_task));
|
||||
}
|
||||
} else if (OB_FAIL(handle_async_write_(flush_task, next_state))) {
|
||||
STORAGE_LOG(WARN, "fail to handle flush task async write", KR(ret), K(flush_task));
|
||||
}
|
||||
|
@ -414,7 +414,10 @@ int ObTenantTmpFileManagerWithMTLSwitch::alloc_dir(const uint64_t tenant_id, int
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTmpFileManagerWithMTLSwitch::open(const uint64_t tenant_id, int64_t &fd, const int64_t &dir_id)
|
||||
int ObTenantTmpFileManagerWithMTLSwitch::open(const uint64_t tenant_id,
|
||||
int64_t &fd,
|
||||
const int64_t &dir_id,
|
||||
const char* const label)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || is_virtual_tenant_id(tenant_id))) {
|
||||
@ -432,8 +435,8 @@ int ObTenantTmpFileManagerWithMTLSwitch::open(const uint64_t tenant_id, int64_t
|
||||
} else if (OB_ISNULL(tmp_file_mgr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("tmp file manager is null", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(tmp_file_mgr->open(fd, dir_id))) {
|
||||
LOG_WARN("fail to open", KR(ret), K(tenant_id));
|
||||
} else if (OB_FAIL(tmp_file_mgr->open(fd, dir_id, label))) {
|
||||
LOG_WARN("fail to open", KR(ret), K(tenant_id), K(fd), K(dir_id), KP(label));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
void destroy();
|
||||
|
||||
int alloc_dir(int64_t &dir_id);
|
||||
int open(int64_t &fd, const int64_t &dir_id, const char* const label = nullptr);
|
||||
int open(int64_t &fd, const int64_t &dir_id, const char* const label);
|
||||
int remove(const int64_t fd);
|
||||
|
||||
public:
|
||||
@ -71,7 +71,10 @@ class ObTenantTmpFileManagerWithMTLSwitch final
|
||||
public:
|
||||
static ObTenantTmpFileManagerWithMTLSwitch &get_instance();
|
||||
int alloc_dir(const uint64_t tenant_id, int64_t &dir_id);
|
||||
int open(const uint64_t tenant_id, int64_t &fd, const int64_t &dir_id);
|
||||
int open(const uint64_t tenant_id,
|
||||
int64_t &fd,
|
||||
const int64_t &dir_id,
|
||||
const char* const label = nullptr);
|
||||
int remove(const uint64_t tenant_id, const int64_t fd);
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user