add tenant id check for tmp file handle
This commit is contained in:
parent
096b6be038
commit
4b882c2692
@ -249,14 +249,14 @@ void TestTmpFileStress::write_data_(const int64_t write_size)
|
||||
io_info.buf_ = buf_ + already_write;
|
||||
if (this_turn_write_size % ObTmpFileGlobal::PAGE_SIZE == 0 && i == 0) {
|
||||
io_info.size_ = this_turn_write_size - 2 * 1024;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(io_info));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info));
|
||||
|
||||
io_info.size_ = 2 * 1024;
|
||||
io_info.buf_ = buf_ + already_write + this_turn_write_size - 2 * 1024;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(io_info));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info));
|
||||
} else {
|
||||
io_info.size_ = this_turn_write_size;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(io_info));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info));
|
||||
}
|
||||
already_write += this_turn_write_size;
|
||||
}
|
||||
@ -278,7 +278,7 @@ void TestTmpFileStress::read_data_(const int64_t read_offset, const int64_t read
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.disable_block_cache_ = disable_block_cache_;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
int cmp = memcmp(handle.get_buffer(), buf_ + read_offset, io_info.size_);
|
||||
if (cmp != 0 || OB_FAIL(ret)) {
|
||||
STORAGE_LOG(WARN, "TestTmpFileStress read thread failed", KR(ret), K(fd_), K(cmp), K(thread_idx_), KP(buf_), K(read_offset), K(read_size));
|
||||
@ -312,7 +312,7 @@ void TestTmpFileStress::truncate_data_()
|
||||
io_info.size_ = size_;
|
||||
io_info.buf_ = read_buf;
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, offset_, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, offset_, handle);
|
||||
int cmp = memcmp(handle.get_buffer()+invalid_size, buf_ + truncate_offset, valid_size);
|
||||
if (cmp != 0 || OB_FAIL(ret)) {
|
||||
STORAGE_LOG(INFO, "TestTmpFileStress truncate thread failed. "
|
||||
@ -341,7 +341,7 @@ void TestTmpFileStress::truncate_data_()
|
||||
MEMSET(zero_buf, 0, size_);
|
||||
read_buf = new char[size_];
|
||||
io_info.buf_ = read_buf;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, offset_, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, offset_, handle);
|
||||
cmp = memcmp(handle.get_buffer(), zero_buf, size_);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
@ -174,14 +174,14 @@ TEST_F(TestTmpFile, test_unaligned_data_read_write)
|
||||
io_info.buf_ = write_buffer + already_write;
|
||||
if (this_turn_write_size % ObTmpFileGlobal::PAGE_SIZE == 0 && i == 0) {
|
||||
io_info.size_ = this_turn_write_size - 2 * 1024;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(io_info));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info));
|
||||
|
||||
io_info.size_ = 2 * 1024;
|
||||
io_info.buf_ = write_buffer + already_write + this_turn_write_size - 2 * 1024;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(io_info));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info));
|
||||
} else {
|
||||
io_info.size_ = this_turn_write_size;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(io_info));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info));
|
||||
}
|
||||
}
|
||||
// read data
|
||||
@ -194,7 +194,7 @@ TEST_F(TestTmpFile, test_unaligned_data_read_write)
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
io_info.buf_ = read_check_buffer;
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->read(io_info, handle));
|
||||
ASSERT_EQ(OB_SUCCESS, MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle));
|
||||
}
|
||||
// check data
|
||||
{
|
||||
@ -276,7 +276,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
// Write data
|
||||
int64_t write_time = ObTimeUtility::current_time();
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
write_time = ObTimeUtility::current_time() - write_time;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
@ -291,7 +291,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
ObTmpFileIOHandle handle;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = write_size - wbp_begin_offset;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, wbp_begin_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, wbp_begin_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf + wbp_begin_offset, io_info.size_);
|
||||
@ -304,7 +304,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = wbp_begin_offset;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, 0, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, 0, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf, io_info.size_);
|
||||
@ -316,7 +316,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = wbp_begin_offset;
|
||||
io_info.disable_block_cache_ = false;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, 0, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, 0, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf, io_info.size_);
|
||||
@ -331,7 +331,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -345,7 +345,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
io_info.disable_block_cache_ = false;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -358,7 +358,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = 200;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, write_size - 100, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, write_size - 100, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
ASSERT_EQ(100, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + write_size - 100, 100);
|
||||
@ -371,7 +371,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
read_buf = new char [3 * ObTmpFileGlobal::PAGE_SIZE];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = 3 * ObTmpFileGlobal::PAGE_SIZE;
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf, io_info.size_);
|
||||
@ -382,7 +382,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
read_buf = new char [ObTmpFileGlobal::PAGE_SIZE];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = 100;
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + 3 * ObTmpFileGlobal::PAGE_SIZE, io_info.size_);
|
||||
@ -391,7 +391,7 @@ TEST_F(TestTmpFile, test_read)
|
||||
|
||||
io_info.buf_ = read_buf + 100;
|
||||
io_info.size_ = ObTmpFileGlobal::PAGE_SIZE - 100;
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + 3 * ObTmpFileGlobal::PAGE_SIZE + 100, io_info.size_);
|
||||
@ -448,7 +448,7 @@ TEST_F(TestTmpFile, test_cached_read)
|
||||
|
||||
// 1. Write data and wait flushing over
|
||||
int64_t write_time = ObTimeUtility::current_time();
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
write_time = ObTimeUtility::current_time() - write_time;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
sleep(2);
|
||||
@ -479,7 +479,7 @@ TEST_F(TestTmpFile, test_cached_read)
|
||||
io_info.size_ = read_size;
|
||||
io_info.disable_page_cache_ = true;
|
||||
io_info.disable_block_cache_ = false;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -496,7 +496,7 @@ TEST_F(TestTmpFile, test_cached_read)
|
||||
io_info.size_ = read_size;
|
||||
io_info.disable_page_cache_ = false;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -512,7 +512,7 @@ TEST_F(TestTmpFile, test_cached_read)
|
||||
io_info.size_ = read_size;
|
||||
io_info.disable_page_cache_ = false;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -592,7 +592,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
io_info.size_ = 2 * 1024; // 2KB
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
already_write_size += io_info.size_;
|
||||
|
||||
@ -602,7 +602,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
ObTmpFileIOHandle handle;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -613,7 +613,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
// 2. append write 2KB data in memory and check rightness of writing
|
||||
io_info.buf_ = write_buf + 2 * 1024; // 2KB
|
||||
io_info.size_ = 2 * 1024; // 2KB
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
already_write_size += io_info.size_;
|
||||
|
||||
@ -622,7 +622,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -648,7 +648,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -659,7 +659,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
// 5. append write 6KB data in memory and check rightness of writing
|
||||
io_info.buf_ = write_buf + already_write_size;
|
||||
io_info.size_ = write_size - already_write_size; // 6KB
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
already_write_size += io_info.size_;
|
||||
|
||||
@ -668,7 +668,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -690,7 +690,7 @@ TEST_F(TestTmpFile, test_write_tail_page)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, io_info.size_);
|
||||
@ -750,7 +750,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = 2 * ObTmpFileGlobal::PAGE_SIZE;
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
already_write_size += io_info.size_;
|
||||
|
||||
@ -760,7 +760,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
ObTmpFileIOHandle handle;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.disable_block_cache_ = true;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf + read_offset, read_size);
|
||||
@ -780,7 +780,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
// read_size = already_write_size;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -800,7 +800,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
// read_size = already_write_size;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -820,7 +820,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
// read_size = already_write_size;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -834,14 +834,14 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_offset = already_write_size;
|
||||
io_info.buf_ = write_buf + already_write_size;
|
||||
io_info.size_ = 3 * ObTmpFileGlobal::PAGE_SIZE;
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
already_write_size += io_info.size_;
|
||||
|
||||
read_size = io_info.size_;
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, read_size);
|
||||
@ -875,7 +875,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -888,7 +888,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_offset = already_write_size;
|
||||
io_info.buf_ = write_buf + already_write_size;
|
||||
io_info.size_ = data_size - already_write_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
int64_t wbp_begin_offset = file_handle.get()->cal_wbp_begin_offset();
|
||||
ASSERT_GT(wbp_begin_offset, 0);
|
||||
@ -900,7 +900,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -919,7 +919,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -936,7 +936,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -955,7 +955,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -972,7 +972,7 @@ TEST_F(TestTmpFile, test_tmp_file_truncate)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
MEMSET(write_buf, 0, truncate_offset);
|
||||
@ -1038,7 +1038,7 @@ TEST_F(TestTmpFile, test_truncate_to_flushed_page_id)
|
||||
io_info.size_ = write_size;
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
// Write data
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
sleep(2); // waits for flushing 4MB data pages, 12KB(2 pages) left
|
||||
@ -1077,7 +1077,7 @@ TEST_F(TestTmpFile, test_truncate_to_flushed_page_id)
|
||||
|
||||
// append 8KB, 12KB left in wbp
|
||||
io_info.size_ = PAGE_SIZE;
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(4 * 1024 * 1024 + 20 * 1024, file_handle.get()->file_size_);
|
||||
|
||||
@ -1152,7 +1152,7 @@ TEST_F(TestTmpFile, test_write_last_page_during_flush)
|
||||
io_info.size_ = write_size;
|
||||
io_info.io_timeout_ms_ = DEFAULT_IO_WAIT_TIME_MS;
|
||||
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
printf("generate_data_flush_info\n");
|
||||
@ -1178,7 +1178,7 @@ TEST_F(TestTmpFile, test_write_last_page_during_flush)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
// write before IO complete
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
// assume io complete, update file meta
|
||||
@ -1237,7 +1237,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = write_size;
|
||||
int64_t write_time = ObTimeUtility::current_time();
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
write_time = ObTimeUtility::current_time() - write_time;
|
||||
|
||||
@ -1247,7 +1247,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
char *read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
cmp = memcmp(handle.get_buffer(), write_buf, handle.get_done_size());
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
handle.reset();
|
||||
@ -1257,7 +1257,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
// 3. attempt to read data when reach the end of file
|
||||
int64_t read_time = ObTimeUtility::current_time();
|
||||
io_info.size_ = 10;
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
handle.reset();
|
||||
|
||||
@ -1265,7 +1265,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
int64_t read_offset = 100;
|
||||
read_size = macro_block_size;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, handle.get_done_size());
|
||||
@ -1275,7 +1275,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
|
||||
// 5. attempt to read data when reach the end of file (after pread)
|
||||
io_info.size_ = 10;
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
handle.reset();
|
||||
|
||||
@ -1285,7 +1285,7 @@ void test_big_file(const int64_t write_size, const int64_t wbp_mem_limit, ObTmpF
|
||||
read_offset = macro_block_size * (40 + i);
|
||||
read_size = macro_block_size * 2;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(read_size, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + read_offset, handle.get_done_size());
|
||||
@ -1375,7 +1375,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
for (int i = 0; OB_SUCC(ret) && i < file_num - 1; i++) {
|
||||
io_info.fd_ = fds[i];
|
||||
io_info.buf_ = write_bufs[i] + already_write_sizes[i];
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
}
|
||||
|
||||
@ -1384,7 +1384,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
io_info.size_ = write_size;
|
||||
for (int i = 0; OB_SUCC(ret) && i < file_num - 1; i++) {
|
||||
io_info.fd_ = fds[i];
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_bufs[i] + already_write_sizes[i], io_info.size_);
|
||||
@ -1402,14 +1402,14 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
io_info.size_ = write_size;
|
||||
io_info.fd_ = fds[file_num - 1];
|
||||
io_info.buf_ = write_bufs[file_num - 1] + already_write_sizes[file_num - 1];
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
read_buf = new char [write_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = write_size;
|
||||
io_info.fd_ = fds[file_num - 1];
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_bufs[file_num - 1] + already_write_sizes[file_num - 1], io_info.size_);
|
||||
@ -1427,7 +1427,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
for (int i = 0; OB_SUCC(ret) && i < file_num - 1; i++) {
|
||||
io_info.fd_ = fds[i];
|
||||
io_info.buf_ = write_bufs[i] + already_write_sizes[i];
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
}
|
||||
|
||||
@ -1435,7 +1435,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
io_info.size_ = write_size;
|
||||
for (int i = 0; OB_SUCC(ret) && i < file_num - 1; i++) {
|
||||
io_info.fd_ = fds[i];
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_bufs[i] + already_write_sizes[i], io_info.size_);
|
||||
@ -1455,7 +1455,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
for (int i = 0; OB_SUCC(ret) && i < file_num; i++) {
|
||||
io_info.fd_ = fds[i];
|
||||
io_info.buf_ = write_bufs[i] + already_write_sizes[i];
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
}
|
||||
|
||||
@ -1463,7 +1463,7 @@ void test_multi_file_single_thread_read_write(bool disable_block_cache)
|
||||
io_info.size_ = write_size;
|
||||
for (int i = 0; OB_SUCC(ret) && i < file_num; i++) {
|
||||
io_info.fd_ = fds[i];
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(io_info, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->read(MTL_ID(), io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(io_info.size_, handle.get_done_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_bufs[i] + already_write_sizes[i], io_info.size_);
|
||||
@ -1681,7 +1681,7 @@ TEST_F(TestTmpFile, test_aio_pread)
|
||||
|
||||
// 1. Write data
|
||||
int64_t write_time = ObTimeUtility::current_time();
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(io_info);
|
||||
ret = MTL(ObTenantTmpFileManager *)->write(MTL_ID(), io_info);
|
||||
write_time = ObTimeUtility::current_time() - write_time;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
@ -1692,7 +1692,7 @@ TEST_F(TestTmpFile, test_aio_pread)
|
||||
ObTmpFileIOHandle handle;
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->aio_pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->aio_pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(0, handle.get_done_size());
|
||||
ret = handle.wait();
|
||||
@ -1709,12 +1709,12 @@ TEST_F(TestTmpFile, test_aio_pread)
|
||||
read_buf = new char [read_size];
|
||||
io_info.buf_ = read_buf;
|
||||
io_info.size_ = read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->aio_pread(io_info, read_offset, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->aio_pread(MTL_ID(), io_info, read_offset, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(0, handle.get_done_size());
|
||||
|
||||
int read_offset2 = read_offset + read_size;
|
||||
ret = MTL(ObTenantTmpFileManager *)->aio_pread(io_info, read_offset2, handle);
|
||||
ret = MTL(ObTenantTmpFileManager *)->aio_pread(MTL_ID(), io_info, read_offset2, handle);
|
||||
ASSERT_NE(OB_SUCCESS, ret);
|
||||
|
||||
ret = handle.wait();
|
||||
|
@ -370,7 +370,7 @@ int ObBackupTableListMgr::read_from_tmp_file_(const int64_t read_size, const int
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to alloc memory", K(ret), K(read_size));
|
||||
} else if (FALSE_IT(io_info.buf_ = buf)) {
|
||||
} else if (OB_FAIL(MTL(tmp_file::ObTenantTmpFileManager*)->pread(io_info, offset, handle))) {
|
||||
} else if (OB_FAIL(FILE_MANAGER_INSTANCE_WITH_MTL_SWITCH.pread(MTL_ID(), io_info, offset, handle))) {
|
||||
LOG_WARN("failed to pread from tmp file", K(ret), K(io_info), K(offset), K(read_size));
|
||||
} else {
|
||||
blocksstable::ObBufferReader buffer_reader(buf, read_size);
|
||||
|
@ -41,9 +41,9 @@ int ObBackupTmpFile::open(const uint64_t tenant_id)
|
||||
if (is_opened_) {
|
||||
ret = OB_INIT_TWICE;
|
||||
LOG_WARN("backup tmp file init twice", K(ret));
|
||||
} else if (OB_FAIL(MTL(tmp_file::ObTenantTmpFileManager*)->alloc_dir(file_dir_))) {
|
||||
} else if (OB_FAIL(FILE_MANAGER_INSTANCE_WITH_MTL_SWITCH.alloc_dir(MTL_ID(), file_dir_))) {
|
||||
LOG_WARN("failed to alloc dir", K(ret));
|
||||
} else if (OB_FAIL(MTL(tmp_file::ObTenantTmpFileManager*)->open(file_fd_, file_dir_))) {
|
||||
} else if (OB_FAIL(FILE_MANAGER_INSTANCE_WITH_MTL_SWITCH.open(MTL_ID(), file_fd_, file_dir_))) {
|
||||
LOG_WARN("failed to open tmp file", K(ret), K(file_dir_));
|
||||
} else {
|
||||
tenant_id_ = tenant_id;
|
||||
@ -64,7 +64,7 @@ int ObBackupTmpFile::write(const char *buf, const int64_t size)
|
||||
LOG_WARN("backup tmp file init twice", K(ret));
|
||||
} else if (OB_FAIL(get_io_info_(buf, size, timeout_ms, io_info))) {
|
||||
LOG_WARN("failed to get io info", K(ret), K(buf), K(size));
|
||||
} else if (OB_FAIL(MTL(tmp_file::ObTenantTmpFileManager*)->write(io_info))) {
|
||||
} else if (OB_FAIL(FILE_MANAGER_INSTANCE_WITH_MTL_SWITCH.write(MTL_ID(), io_info))) {
|
||||
LOG_WARN("failed to write tmp file", K(ret), K(io_info), K(timeout_ms));
|
||||
} else {
|
||||
file_size_ += size;
|
||||
@ -79,7 +79,7 @@ int ObBackupTmpFile::close()
|
||||
if (!is_opened_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("backup tmp file do not init", K(ret));
|
||||
} else if (OB_FAIL(MTL(tmp_file::ObTenantTmpFileManager*)->remove(file_fd_))) {
|
||||
} else if (OB_FAIL(FILE_MANAGER_INSTANCE_WITH_MTL_SWITCH.remove(MTL_ID(), file_fd_))) {
|
||||
LOG_WARN("failed to remove tmp file fd", K(ret), K(file_fd_));
|
||||
} else {
|
||||
is_opened_ = false;
|
||||
|
@ -157,7 +157,7 @@ int ObBackupIndexBufferNode::get_backup_index(T &backup_index)
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
OB_LOG(WARN, "failed to alloc memory", K(ret), K(need_read_size));
|
||||
} else if (FALSE_IT(io_info.buf_ = buf)) {
|
||||
} else if (OB_FAIL(MTL(tmp_file::ObTenantTmpFileManager*)->pread(io_info, read_offset_, handle))) {
|
||||
} else if (OB_FAIL(FILE_MANAGER_INSTANCE_WITH_MTL_SWITCH.pread(MTL_ID(), io_info, read_offset_, handle))) {
|
||||
OB_LOG(WARN, "failed to pread from tmp file", K(ret), K(io_info), K_(read_offset), K(need_read_size));
|
||||
} else {
|
||||
blocksstable::ObBufferReader buffer_reader(buf, need_read_size);
|
||||
|
@ -385,6 +385,8 @@ int ObSSTmpFileIOHandle::do_shared_storage_read_wait()
|
||||
}
|
||||
#endif
|
||||
|
||||
// TODO: wanyue.wy
|
||||
// keep all interfaces of handle run under the ctx of corresponding tenant
|
||||
int ObSSTmpFileIOHandle::wait()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -411,6 +411,8 @@ int ObSSTenantTmpFileManager::stop()
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: wanyue.wy
|
||||
// print all tmp file in files_. these files will cause resource leaked.
|
||||
void ObSSTenantTmpFileManager::destroy()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -739,6 +741,8 @@ int ObSSTenantTmpFileManager::exec_wait_task_once()
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO: wanyue.wy
|
||||
// if memory is not enough, enqueue operation might be failed, leading to resource leak
|
||||
int ObSSTenantTmpFileManager::remove_task_enqueue(const MacroBlockId &tmp_file_id, const int64_t length)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -751,7 +755,7 @@ int ObSSTenantTmpFileManager::remove_task_enqueue(const MacroBlockId &tmp_file_i
|
||||
LOG_WARN("fail to allocate ObTmpFileAsyncRemoveTask", K(ret));
|
||||
} else if (FALSE_IT(remove_task = new (buf) ObTmpFileAsyncRemoveTask(tmp_file_id, length))) {
|
||||
} else if (OB_FAIL(remove_task_queue_.push(remove_task))) {
|
||||
LOG_WARN("fail to push async remove task", K(ret), K(tmp_file_id), K(length));
|
||||
LOG_ERROR("fail to push async remove task", K(ret), K(tmp_file_id), K(length));
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret) && remove_task != nullptr) {
|
||||
|
@ -25,6 +25,7 @@ namespace tmp_file
|
||||
{
|
||||
ObSNTmpFileIOHandle::ObSNTmpFileIOHandle()
|
||||
: is_inited_(false),
|
||||
tenant_id_(OB_INVALID_TENANT_ID),
|
||||
fd_(ObTmpFileGlobal::INVALID_TMP_FILE_FD),
|
||||
ctx_(),
|
||||
buf_(nullptr),
|
||||
@ -43,6 +44,7 @@ ObSNTmpFileIOHandle::~ObSNTmpFileIOHandle()
|
||||
void ObSNTmpFileIOHandle::reset()
|
||||
{
|
||||
is_inited_ = false;
|
||||
tenant_id_ = OB_INVALID_TENANT_ID;
|
||||
ctx_.reset();
|
||||
fd_ = ObTmpFileGlobal::INVALID_TMP_FILE_FD;
|
||||
buf_ = nullptr;
|
||||
@ -52,7 +54,7 @@ void ObSNTmpFileIOHandle::reset()
|
||||
read_offset_in_file_ = -1;
|
||||
}
|
||||
|
||||
int ObSNTmpFileIOHandle::init_write(const ObTmpFileIOInfo &io_info)
|
||||
int ObSNTmpFileIOHandle::init_write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_INIT) {
|
||||
@ -61,6 +63,9 @@ int ObSNTmpFileIOHandle::init_write(const ObTmpFileIOInfo &io_info)
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info), KPC(this));
|
||||
} else if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || is_virtual_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info), K(tenant_id));
|
||||
} else if (OB_FAIL(ctx_.init(io_info.fd_, io_info.dir_id_, false /*is_read*/, io_info.io_desc_,
|
||||
io_info.io_timeout_ms_, io_info.disable_page_cache_, io_info.disable_block_cache_))) {
|
||||
LOG_WARN("failed to init io handle context", KR(ret), K(io_info));
|
||||
@ -68,6 +73,7 @@ int ObSNTmpFileIOHandle::init_write(const ObTmpFileIOInfo &io_info)
|
||||
LOG_WARN("fail to prepare write context", KR(ret), KPC(this));
|
||||
} else {
|
||||
is_inited_ = true;
|
||||
tenant_id_ = tenant_id;
|
||||
fd_ = io_info.fd_;
|
||||
buf_ = io_info.buf_;
|
||||
buf_size_ = io_info.size_;
|
||||
@ -77,7 +83,7 @@ int ObSNTmpFileIOHandle::init_write(const ObTmpFileIOInfo &io_info)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSNTmpFileIOHandle::init_pread(const ObTmpFileIOInfo &io_info, const int64_t read_offset)
|
||||
int ObSNTmpFileIOHandle::init_pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, const int64_t read_offset)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_INIT) {
|
||||
@ -86,6 +92,9 @@ int ObSNTmpFileIOHandle::init_pread(const ObTmpFileIOInfo &io_info, const int64_
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || is_virtual_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info), K(tenant_id));
|
||||
} else if (OB_UNLIKELY(read_offset < 0)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(read_offset));
|
||||
@ -96,6 +105,7 @@ int ObSNTmpFileIOHandle::init_pread(const ObTmpFileIOInfo &io_info, const int64_
|
||||
LOG_WARN("fail to prepare read context", KR(ret), KPC(this), K(read_offset));
|
||||
} else {
|
||||
is_inited_ = true;
|
||||
tenant_id_ = tenant_id;
|
||||
fd_ = io_info.fd_;
|
||||
buf_ = io_info.buf_;
|
||||
buf_size_ = io_info.size_;
|
||||
@ -106,7 +116,7 @@ int ObSNTmpFileIOHandle::init_pread(const ObTmpFileIOInfo &io_info, const int64_
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSNTmpFileIOHandle::init_read(const ObTmpFileIOInfo &io_info)
|
||||
int ObSNTmpFileIOHandle::init_read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_INIT) {
|
||||
@ -115,6 +125,9 @@ int ObSNTmpFileIOHandle::init_read(const ObTmpFileIOInfo &io_info)
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(!is_valid_tenant_id(tenant_id) || is_virtual_tenant_id(tenant_id))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info), K(tenant_id));
|
||||
} else if (OB_FAIL(ctx_.init(io_info.fd_, io_info.dir_id_, true /*is_read*/, io_info.io_desc_,
|
||||
io_info.io_timeout_ms_, io_info.disable_page_cache_, io_info.disable_block_cache_))) {
|
||||
LOG_WARN("failed to init io handle context", KR(ret), K(io_info));
|
||||
@ -122,6 +135,7 @@ int ObSNTmpFileIOHandle::init_read(const ObTmpFileIOInfo &io_info)
|
||||
LOG_WARN("fail to prepare read context", KR(ret), KPC(this));
|
||||
} else {
|
||||
is_inited_ = true;
|
||||
tenant_id_ = tenant_id;
|
||||
fd_ = io_info.fd_;
|
||||
buf_ = io_info.buf_;
|
||||
buf_size_ = io_info.size_;
|
||||
@ -136,6 +150,7 @@ int ObSNTmpFileIOHandle::init_read(const ObTmpFileIOInfo &io_info)
|
||||
bool ObSNTmpFileIOHandle::is_valid() const
|
||||
{
|
||||
return is_inited_ &&
|
||||
is_valid_tenant_id(tenant_id_) && !is_virtual_tenant_id(tenant_id_) &&
|
||||
nullptr != buf_ &&
|
||||
done_size_ >= 0 && buf_size_ > 0 &&
|
||||
buf_size_ >= done_size_;
|
||||
@ -154,33 +169,41 @@ int ObSNTmpFileIOHandle::wait()
|
||||
LOG_WARN("invalid handle", KR(ret), KPC(this));
|
||||
} else if (is_finished() || !ctx_.is_read()) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(ctx_.wait())) {
|
||||
LOG_WARN("fail to wait tmp file io", KR(ret), K(ctx_), KPC(this));
|
||||
} else if (OB_FAIL(handle_finished_ctx_(ctx_))) {
|
||||
LOG_WARN("fail to handle finished ctx", KR(ret), KPC(this));
|
||||
} else if (OB_UNLIKELY(done_size_ > buf_size_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("done size is larger than total todo size", KR(ret), KPC(this));
|
||||
} else if (OB_FAIL(MTL(ObTenantTmpFileManager*)->get_sn_file_manager().get_tmp_file(fd_, file_handle))) {
|
||||
LOG_WARN("fail to get tmp file handle", KR(ret), K(fd_));
|
||||
} else {
|
||||
while (OB_SUCC(ret) && !is_finished()) {
|
||||
if (OB_FAIL(ctx_.prepare_read(buf_ + done_size_,
|
||||
MIN(buf_size_ - done_size_,
|
||||
ObTmpFileGlobal::TMP_FILE_READ_BATCH_SIZE),
|
||||
read_offset_in_file_))) {
|
||||
LOG_WARN("fail to generate read ctx", KR(ret), KPC(this));
|
||||
} else if (OB_FAIL(file_handle.get()->aio_pread(ctx_))) {
|
||||
LOG_WARN("fail to continue read once batch", KR(ret), K(ctx_));
|
||||
} else if (OB_FAIL(ctx_.wait())) {
|
||||
LOG_WARN("fail to wait tmp file io", KR(ret), K(ctx_));
|
||||
} else if (OB_FAIL(handle_finished_ctx_(ctx_))) {
|
||||
LOG_WARN("fail to handle finished ctx", KR(ret), KPC(this));
|
||||
MAKE_TENANT_SWITCH_SCOPE_GUARD(guard);
|
||||
if (tenant_id_ != MTL_ID()) {
|
||||
if (OB_FAIL(guard.switch_to(tenant_id_))) {
|
||||
LOG_WARN("fail to switch tenant", KR(ret), K(tenant_id_));
|
||||
}
|
||||
} // end while
|
||||
}
|
||||
if (FAILEDx(ctx_.wait())) {
|
||||
LOG_WARN("fail to wait tmp file io", KR(ret), K(ctx_), KPC(this));
|
||||
} else if (OB_FAIL(handle_finished_ctx_(ctx_))) {
|
||||
LOG_WARN("fail to handle finished ctx", KR(ret), KPC(this));
|
||||
} else if (OB_UNLIKELY(done_size_ > buf_size_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("done size is larger than total todo size", KR(ret), KPC(this));
|
||||
} else if (OB_FAIL(MTL(ObTenantTmpFileManager*)->get_sn_file_manager().get_tmp_file(fd_, file_handle))) {
|
||||
LOG_WARN("fail to get tmp file handle", KR(ret), K(fd_));
|
||||
} else {
|
||||
while (OB_SUCC(ret) && !is_finished()) {
|
||||
if (OB_FAIL(ctx_.prepare_read(buf_ + done_size_,
|
||||
MIN(buf_size_ - done_size_,
|
||||
ObTmpFileGlobal::TMP_FILE_READ_BATCH_SIZE),
|
||||
read_offset_in_file_))) {
|
||||
LOG_WARN("fail to generate read ctx", KR(ret), KPC(this));
|
||||
} else if (OB_FAIL(file_handle.get()->aio_pread(ctx_))) {
|
||||
LOG_WARN("fail to continue read once batch", KR(ret), K(ctx_));
|
||||
} else if (OB_FAIL(ctx_.wait())) {
|
||||
LOG_WARN("fail to wait tmp file io", KR(ret), K(ctx_));
|
||||
} else if (OB_FAIL(handle_finished_ctx_(ctx_))) {
|
||||
LOG_WARN("fail to handle finished ctx", KR(ret), KPC(this));
|
||||
}
|
||||
} // end while
|
||||
|
||||
if (update_offset_in_file_ && (OB_SUCC(ret) || OB_ITER_END == ret)) {
|
||||
file_handle.get()->update_read_offset(read_offset_in_file_);
|
||||
if (update_offset_in_file_ && (OB_SUCC(ret) || OB_ITER_END == ret)) {
|
||||
file_handle.get()->update_read_offset(read_offset_in_file_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,14 +27,14 @@ class ObSNTmpFileIOHandle final
|
||||
public:
|
||||
ObSNTmpFileIOHandle();
|
||||
~ObSNTmpFileIOHandle();
|
||||
int init_write(const ObTmpFileIOInfo &io_info);
|
||||
int init_read(const ObTmpFileIOInfo &io_info);
|
||||
int init_pread(const ObTmpFileIOInfo &io_info, const int64_t read_offset);
|
||||
int init_write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info);
|
||||
int init_read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info);
|
||||
int init_pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, const int64_t read_offset);
|
||||
int wait();
|
||||
void reset();
|
||||
bool is_valid() const;
|
||||
|
||||
TO_STRING_KV(K(is_inited_), K(fd_), K(ctx_),
|
||||
TO_STRING_KV(K(is_inited_), K(tenant_id_), K(fd_), K(ctx_),
|
||||
KP(buf_), K(update_offset_in_file_),
|
||||
K(buf_size_), K(done_size_),
|
||||
K(read_offset_in_file_));
|
||||
@ -49,6 +49,7 @@ private:
|
||||
|
||||
private:
|
||||
bool is_inited_;
|
||||
uint64_t tenant_id_;
|
||||
int64_t fd_;
|
||||
ObTmpFileIOCtx ctx_;
|
||||
char *buf_;
|
||||
|
@ -290,7 +290,9 @@ void ObSNTenantTmpFileManager::refresh_meta_memory_limit()
|
||||
}
|
||||
}
|
||||
|
||||
int ObSNTenantTmpFileManager::aio_read(const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle)
|
||||
int ObSNTenantTmpFileManager::aio_read(const uint64_t tenant_id,
|
||||
const ObTmpFileIOInfo &io_info,
|
||||
ObSNTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTmpFileHandle tmp_file_handle;
|
||||
@ -298,17 +300,20 @@ int ObSNTenantTmpFileManager::aio_read(const ObTmpFileIOInfo &io_info, ObSNTmpFi
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSNTenantTmpFileManager has not been inited", KR(ret), K(tenant_id_));
|
||||
} else if (!io_info.is_valid()) {
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("fail to aio read, invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(MTL_ID() != tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant id not match", KR(ret), K(tenant_id), K(MTL_ID()));
|
||||
} else if (OB_UNLIKELY(io_handle.is_valid() && !io_handle.is_finished())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tmp file io handle has remain data need to be waited", KR(ret), K(io_info), K(io_handle));
|
||||
} else if (FALSE_IT(io_handle.reset())) {
|
||||
} else if (OB_FAIL(get_tmp_file(io_info.fd_, tmp_file_handle))) {
|
||||
LOG_WARN("fail to get tmp file io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_read(io_info))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_read(tenant_id, io_info))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(tenant_id), K(io_info));
|
||||
} else if (OB_FAIL(tmp_file_handle.get()->aio_pread(io_handle.get_io_ctx()))) {
|
||||
LOG_WARN("fail to aio pread", KR(ret), K(io_info));
|
||||
} else {
|
||||
@ -320,9 +325,10 @@ int ObSNTenantTmpFileManager::aio_read(const ObTmpFileIOInfo &io_info, ObSNTmpFi
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSNTenantTmpFileManager::aio_pread(const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset,
|
||||
ObSNTmpFileIOHandle &io_handle)
|
||||
int ObSNTenantTmpFileManager::aio_pread(const uint64_t tenant_id,
|
||||
const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset,
|
||||
ObSNTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTmpFileHandle tmp_file_handle;
|
||||
@ -330,17 +336,20 @@ int ObSNTenantTmpFileManager::aio_pread(const ObTmpFileIOInfo &io_info,
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSNTenantTmpFileManager has not been inited", KR(ret), K(tenant_id_));
|
||||
} else if (!io_info.is_valid()) {
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("fail to aio read, invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(MTL_ID() != tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant id not match", KR(ret), K(tenant_id), K(MTL_ID()));
|
||||
} else if (OB_UNLIKELY(io_handle.is_valid() && !io_handle.is_finished())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tmp file io handle has remain data need to be waited", KR(ret), K(io_info), K(io_handle));
|
||||
} else if (FALSE_IT(io_handle.reset())) {
|
||||
} else if (OB_FAIL(get_tmp_file(io_info.fd_, tmp_file_handle))) {
|
||||
LOG_WARN("fail to get tmp file io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_pread(io_info, offset))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_pread(tenant_id, io_info, offset))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(tenant_id), K(io_info));
|
||||
} else if (OB_FAIL(tmp_file_handle.get()->aio_pread(io_handle.get_io_ctx()))) {
|
||||
LOG_WARN("fail to aio pread", KR(ret), K(io_info));
|
||||
} else {
|
||||
@ -352,7 +361,9 @@ int ObSNTenantTmpFileManager::aio_pread(const ObTmpFileIOInfo &io_info,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSNTenantTmpFileManager::read(const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle)
|
||||
int ObSNTenantTmpFileManager::read(const uint64_t tenant_id,
|
||||
const ObTmpFileIOInfo &io_info,
|
||||
ObSNTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTmpFileHandle tmp_file_handle;
|
||||
@ -360,17 +371,20 @@ int ObSNTenantTmpFileManager::read(const ObTmpFileIOInfo &io_info, ObSNTmpFileIO
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSNTenantTmpFileManager has not been inited", KR(ret), K(tenant_id_));
|
||||
} else if (!io_info.is_valid()) {
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("fail to aio read, invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(MTL_ID() != tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant id not match", KR(ret), K(tenant_id), K(MTL_ID()));
|
||||
} else if (OB_UNLIKELY(io_handle.is_valid() && !io_handle.is_finished())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tmp file io handle has remain data need to be waited", KR(ret), K(io_info), K(io_handle));
|
||||
} else if (FALSE_IT(io_handle.reset())) {
|
||||
} else if (OB_FAIL(get_tmp_file(io_info.fd_, tmp_file_handle))) {
|
||||
LOG_WARN("fail to get tmp file io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_read(io_info))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_read(tenant_id, io_info))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(tenant_id), K(io_info));
|
||||
} else if (OB_FAIL(tmp_file_handle.get()->aio_pread(io_handle.get_io_ctx()))) {
|
||||
LOG_WARN("fail to aio pread", KR(ret), K(io_info));
|
||||
} else {
|
||||
@ -390,7 +404,10 @@ int ObSNTenantTmpFileManager::read(const ObTmpFileIOInfo &io_info, ObSNTmpFileIO
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSNTenantTmpFileManager::pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObSNTmpFileIOHandle &io_handle)
|
||||
int ObSNTenantTmpFileManager::pread(const uint64_t tenant_id,
|
||||
const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset,
|
||||
ObSNTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTmpFileHandle tmp_file_handle;
|
||||
@ -398,17 +415,20 @@ int ObSNTenantTmpFileManager::pread(const ObTmpFileIOInfo &io_info, const int64_
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSNTenantTmpFileManager has not been inited", KR(ret), K(tenant_id_));
|
||||
} else if (!io_info.is_valid()) {
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("fail to aio read, invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(MTL_ID() != tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant id not match", KR(ret), K(tenant_id), K(MTL_ID()));
|
||||
} else if (OB_UNLIKELY(io_handle.is_valid() && !io_handle.is_finished())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tmp file io handle has remain data need to be waited", KR(ret), K(io_info), K(io_handle));
|
||||
} else if (FALSE_IT(io_handle.reset())) {
|
||||
} else if (OB_FAIL(get_tmp_file(io_info.fd_, tmp_file_handle))) {
|
||||
LOG_WARN("fail to get tmp file io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_pread(io_info, offset))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_pread(tenant_id, io_info, offset))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(tenant_id), K(io_info));
|
||||
} else if (OB_FAIL(tmp_file_handle.get()->aio_pread(io_handle.get_io_ctx()))) {
|
||||
LOG_WARN("fail to aio pread", KR(ret), K(io_info));
|
||||
} else {
|
||||
@ -428,7 +448,9 @@ int ObSNTenantTmpFileManager::pread(const ObTmpFileIOInfo &io_info, const int64_
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSNTenantTmpFileManager::aio_write(const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle)
|
||||
int ObSNTenantTmpFileManager::aio_write(const uint64_t tenant_id,
|
||||
const ObTmpFileIOInfo &io_info,
|
||||
ObSNTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTmpFileHandle tmp_file_handle;
|
||||
@ -437,13 +459,16 @@ int ObSNTenantTmpFileManager::aio_write(const ObTmpFileIOInfo &io_info, ObSNTmpF
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObSNTenantTmpFileManager has not been inited", KR(ret), K(tenant_id_));
|
||||
} else if (!io_info.is_valid()) {
|
||||
} else if (OB_UNLIKELY(!io_info.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", KR(ret), K(io_info));
|
||||
LOG_WARN("fail to aio read, invalid argument", KR(ret), K(io_info));
|
||||
} else if (OB_UNLIKELY(MTL_ID() != tenant_id)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tenant id not match", KR(ret), K(tenant_id), K(MTL_ID()));
|
||||
} else if (OB_FAIL(get_tmp_file(io_info.fd_, tmp_file_handle))) {
|
||||
LOG_WARN("fail to get tmp file io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_write(io_info))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(io_info));
|
||||
} else if (OB_FAIL(io_handle.init_write(tenant_id, io_info))) {
|
||||
LOG_WARN("fail to init io handle", KR(ret), K(tenant_id), K(io_info));
|
||||
} else if (OB_FAIL(tmp_file_handle.get()->aio_write(io_handle.get_io_ctx()))) {
|
||||
LOG_WARN("fail to aio write", KR(ret), K(io_info));
|
||||
}
|
||||
@ -453,12 +478,12 @@ int ObSNTenantTmpFileManager::aio_write(const ObTmpFileIOInfo &io_info, ObSNTmpF
|
||||
}
|
||||
|
||||
// tmp file is always buffer writing, there are no io tasks need to be waited
|
||||
int ObSNTenantTmpFileManager::write(const ObTmpFileIOInfo &io_info)
|
||||
int ObSNTenantTmpFileManager::write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSNTmpFileIOHandle io_handle;
|
||||
|
||||
if (OB_FAIL(aio_write(io_info, io_handle))) {
|
||||
if (OB_FAIL(aio_write(tenant_id, io_info, io_handle))) {
|
||||
LOG_WARN("fail to aio write", KR(ret), K(io_info));
|
||||
}
|
||||
|
||||
|
@ -62,16 +62,16 @@ public:
|
||||
void refresh_meta_memory_limit();
|
||||
|
||||
public:
|
||||
int aio_read(const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle);
|
||||
int aio_pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObSNTmpFileIOHandle &io_handle);
|
||||
int read(const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle);
|
||||
int pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObSNTmpFileIOHandle &io_handle);
|
||||
int aio_read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle);
|
||||
int aio_pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, const int64_t offset, ObSNTmpFileIOHandle &io_handle);
|
||||
int read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle);
|
||||
int pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, const int64_t offset, ObSNTmpFileIOHandle &io_handle);
|
||||
// NOTE:
|
||||
// only support append write.
|
||||
int aio_write(const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle);
|
||||
int aio_write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, ObSNTmpFileIOHandle &io_handle);
|
||||
// NOTE:
|
||||
// only support append write.
|
||||
int write(const ObTmpFileIOInfo &io_info);
|
||||
int write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info);
|
||||
int truncate(const int64_t fd, const int64_t offset);
|
||||
|
||||
public:
|
||||
|
@ -177,7 +177,8 @@ int ObTenantTmpFileManager::remove(const int64_t fd)
|
||||
}
|
||||
|
||||
|
||||
int ObTenantTmpFileManager::aio_read(const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle)
|
||||
int ObTenantTmpFileManager::aio_read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
ObTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
@ -190,14 +191,15 @@ int ObTenantTmpFileManager::aio_read(const ObTmpFileIOInfo &io_info, ObTmpFileIO
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (OB_FAIL(sn_file_manager_.aio_read(io_info, io_handle.get_sn_handle()))) {
|
||||
if (OB_FAIL(sn_file_manager_.aio_read(tenant_id, io_info, io_handle.get_sn_handle()))) {
|
||||
LOG_WARN("fail to read file in sn tmp file manager", KR(ret), K(io_info));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTmpFileManager::aio_pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObTmpFileIOHandle &io_handle)
|
||||
int ObTenantTmpFileManager::aio_pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset, ObTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
@ -210,14 +212,15 @@ int ObTenantTmpFileManager::aio_pread(const ObTmpFileIOInfo &io_info, const int6
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (OB_FAIL(sn_file_manager_.aio_pread(io_info, offset, io_handle.get_sn_handle()))) {
|
||||
if (OB_FAIL(sn_file_manager_.aio_pread(tenant_id, io_info, offset, io_handle.get_sn_handle()))) {
|
||||
LOG_WARN("fail to read file in sn tmp file manager", KR(ret), K(io_info), K(offset));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTmpFileManager::read(const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle)
|
||||
int ObTenantTmpFileManager::read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
ObTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
@ -230,14 +233,15 @@ int ObTenantTmpFileManager::read(const ObTmpFileIOInfo &io_info, ObTmpFileIOHand
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (OB_FAIL(sn_file_manager_.read(io_info, io_handle.get_sn_handle()))) {
|
||||
if (OB_FAIL(sn_file_manager_.read(tenant_id, io_info, io_handle.get_sn_handle()))) {
|
||||
LOG_WARN("fail to read file in sn tmp file manager", KR(ret), K(io_info));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTmpFileManager::pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObTmpFileIOHandle &io_handle)
|
||||
int ObTenantTmpFileManager::pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset, ObTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
@ -250,14 +254,15 @@ int ObTenantTmpFileManager::pread(const ObTmpFileIOInfo &io_info, const int64_t
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (OB_FAIL(sn_file_manager_.pread(io_info, offset, io_handle.get_sn_handle()))) {
|
||||
if (OB_FAIL(sn_file_manager_.pread(tenant_id, io_info, offset, io_handle.get_sn_handle()))) {
|
||||
LOG_WARN("fail to read file in sn tmp file manager", KR(ret), K(io_info), K(offset));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTmpFileManager::aio_write(const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle)
|
||||
int ObTenantTmpFileManager::aio_write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
ObTmpFileIOHandle &io_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
@ -270,14 +275,14 @@ int ObTenantTmpFileManager::aio_write(const ObTmpFileIOInfo &io_info, ObTmpFileI
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (OB_FAIL(sn_file_manager_.aio_write(io_info, io_handle.get_sn_handle()))) {
|
||||
if (OB_FAIL(sn_file_manager_.aio_write(tenant_id, io_info, io_handle.get_sn_handle()))) {
|
||||
LOG_WARN("fail to write file in sn tmp file manager", KR(ret), K(io_info));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTenantTmpFileManager::write(const ObTmpFileIOInfo &io_info)
|
||||
int ObTenantTmpFileManager::write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
@ -290,7 +295,7 @@ int ObTenantTmpFileManager::write(const ObTmpFileIOInfo &io_info)
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (OB_FAIL(sn_file_manager_.write(io_info))) {
|
||||
if (OB_FAIL(sn_file_manager_.write(tenant_id, io_info))) {
|
||||
LOG_WARN("fail to write file in sn tmp file manager", KR(ret), K(io_info));
|
||||
}
|
||||
}
|
||||
@ -477,7 +482,7 @@ int ObTenantTmpFileManagerWithMTLSwitch::aio_read(const uint64_t tenant_id, cons
|
||||
} 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->aio_read(io_info, io_handle))) {
|
||||
} else if (OB_FAIL(tmp_file_mgr->aio_read(tenant_id, io_info, io_handle))) {
|
||||
LOG_WARN("fail to aio read", KR(ret), K(tenant_id), K(io_info));
|
||||
}
|
||||
}
|
||||
@ -503,7 +508,7 @@ int ObTenantTmpFileManagerWithMTLSwitch::aio_pread(const uint64_t tenant_id, con
|
||||
} 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->aio_pread(io_info, offset, io_handle))) {
|
||||
} else if (OB_FAIL(tmp_file_mgr->aio_pread(tenant_id, io_info, offset, io_handle))) {
|
||||
LOG_WARN("fail to aio pread", KR(ret), K(tenant_id), K(io_info), K(offset));
|
||||
}
|
||||
}
|
||||
@ -528,7 +533,7 @@ int ObTenantTmpFileManagerWithMTLSwitch::read(const uint64_t tenant_id, const Ob
|
||||
} 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->read(io_info, io_handle))) {
|
||||
} else if (OB_FAIL(tmp_file_mgr->read(tenant_id, io_info, io_handle))) {
|
||||
LOG_WARN("fail to read", KR(ret), K(tenant_id), K(io_info));
|
||||
}
|
||||
}
|
||||
@ -553,7 +558,7 @@ int ObTenantTmpFileManagerWithMTLSwitch::pread(const uint64_t tenant_id, const O
|
||||
} 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->pread(io_info, offset, io_handle))) {
|
||||
} else if (OB_FAIL(tmp_file_mgr->pread(tenant_id, io_info, offset, io_handle))) {
|
||||
LOG_WARN("fail to pread", KR(ret), K(tenant_id), K(io_info), K(offset));
|
||||
}
|
||||
}
|
||||
@ -578,7 +583,7 @@ int ObTenantTmpFileManagerWithMTLSwitch::aio_write(const uint64_t tenant_id, con
|
||||
} 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->aio_write(io_info, io_handle))) {
|
||||
} else if (OB_FAIL(tmp_file_mgr->aio_write(tenant_id, io_info, io_handle))) {
|
||||
LOG_WARN("fail to aio write", KR(ret), K(tenant_id), K(io_info));
|
||||
}
|
||||
}
|
||||
@ -603,7 +608,7 @@ int ObTenantTmpFileManagerWithMTLSwitch::write(const uint64_t tenant_id, const O
|
||||
} 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->write(io_info))) {
|
||||
} else if (OB_FAIL(tmp_file_mgr->write(tenant_id, io_info))) {
|
||||
LOG_WARN("fail to write", KR(ret), K(tenant_id), K(io_info));
|
||||
}
|
||||
}
|
||||
|
@ -42,16 +42,18 @@ public:
|
||||
int remove(const int64_t fd);
|
||||
|
||||
public:
|
||||
int aio_read(const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle);
|
||||
int aio_pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObTmpFileIOHandle &io_handle);
|
||||
int read(const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle);
|
||||
int pread(const ObTmpFileIOInfo &io_info, const int64_t offset, ObTmpFileIOHandle &io_handle);
|
||||
int aio_read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle);
|
||||
int aio_pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset, ObTmpFileIOHandle &io_handle);
|
||||
int read(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle);
|
||||
int pread(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info,
|
||||
const int64_t offset, ObTmpFileIOHandle &io_handle);
|
||||
// NOTE:
|
||||
// only support append write.
|
||||
int aio_write(const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle);
|
||||
int aio_write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info, ObTmpFileIOHandle &io_handle);
|
||||
// NOTE:
|
||||
// only support append write.
|
||||
int write(const ObTmpFileIOInfo &io_info);
|
||||
int write(const uint64_t tenant_id, const ObTmpFileIOInfo &io_info);
|
||||
int truncate(const int64_t fd, const int64_t offset);
|
||||
int get_tmp_file_size(const int64_t fd, int64_t &file_size);
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user