patch 4.0
This commit is contained in:
@ -16,32 +16,37 @@
|
||||
#include "storage/blocksstable/ob_tmp_file.h"
|
||||
#include "ob_row_generate.h"
|
||||
#include "ob_data_file_prepare.h"
|
||||
#include "share/ob_simple_mem_limit_getter.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
using namespace blocksstable;
|
||||
using namespace storage;
|
||||
using namespace share::schema;
|
||||
static ObSimpleMemLimitGetter getter;
|
||||
|
||||
namespace unittest {
|
||||
namespace unittest
|
||||
{
|
||||
|
||||
static const int64_t TEST_COLUMN_CNT = ObExtendType - 1;
|
||||
static const int64_t TEST_ROWKEY_COLUMN_CNT = 2;
|
||||
|
||||
struct BufHeader {
|
||||
struct BufHeader
|
||||
{
|
||||
public:
|
||||
BufHeader() : data_size_(0), start_row_(0)
|
||||
BufHeader()
|
||||
: data_size_(0), start_row_(0)
|
||||
{}
|
||||
virtual ~BufHeader()
|
||||
{}
|
||||
int serialize(char* buf, const int64_t buf_len, int64_t& pos);
|
||||
int deserialize(const char* buf, const int64_t data_len, int64_t& pos);
|
||||
virtual ~BufHeader() {}
|
||||
int serialize(char *buf, const int64_t buf_len, int64_t &pos);
|
||||
int deserialize(const char *buf, const int64_t data_len, int64_t &pos);
|
||||
int64_t get_serialize_size() const;
|
||||
int64_t data_size_;
|
||||
int64_t start_row_;
|
||||
};
|
||||
|
||||
int BufHeader::serialize(char* buf, const int64_t buf_len, int64_t& pos)
|
||||
int BufHeader::serialize(char *buf, const int64_t buf_len, int64_t &pos)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(serialization::encode_i64(buf, buf_len, pos, data_size_))) {
|
||||
@ -52,7 +57,7 @@ int BufHeader::serialize(char* buf, const int64_t buf_len, int64_t& pos)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int BufHeader::deserialize(const char* buf, const int64_t data_len, int64_t& pos)
|
||||
int BufHeader::deserialize(const char *buf, const int64_t data_len, int64_t &pos)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(serialization::decode_i64(buf, data_len, pos, &data_size_))) {
|
||||
@ -71,25 +76,24 @@ int64_t BufHeader::get_serialize_size() const
|
||||
return size;
|
||||
}
|
||||
|
||||
class TestTmpFileStress : public share::ObThreadPool {
|
||||
class TestTmpFileStress : public share::ObThreadPool
|
||||
{
|
||||
public:
|
||||
TestTmpFileStress();
|
||||
virtual ~TestTmpFileStress();
|
||||
int init(const int fd, const bool is_write, const int64_t thread_cnt, ObTableSchema* table_schema,
|
||||
int init(const int fd, const bool is_write, const int64_t thread_cnt, ObTableSchema *table_schema,
|
||||
const bool is_plain_data, const bool is_big_file);
|
||||
virtual void run1();
|
||||
|
||||
private:
|
||||
void prepare_data(char* buf, const int64_t macro_block_size);
|
||||
void prepare_plain_data(const int64_t buf_size, char* buf, ObIArray<int64_t>& size_array);
|
||||
void prepare_one_buffer(const int64_t macro_block_size, const int64_t start_index, char* buf, int64_t& end_index);
|
||||
void check_data(const char* buf, const int64_t buf_len);
|
||||
void check_plain_data(const char* read_buf, const char* right_buf, const int64_t buf_len);
|
||||
void prepare_data(char *buf, const int64_t macro_block_size);
|
||||
void prepare_plain_data(const int64_t buf_size, char *buf, ObIArray<int64_t> &size_array);
|
||||
void prepare_one_buffer(const int64_t macro_block_size, const int64_t start_index, char *buf, int64_t &end_index);
|
||||
void check_data(const char *buf, const int64_t buf_len);
|
||||
void check_plain_data(const char *read_buf, const char *right_buf, const int64_t buf_len);
|
||||
void write_data(const int64_t macro_block_size);
|
||||
void write_plain_data(char*& buf, const int64_t macro_block_size);
|
||||
void write_plain_data(char *&buf, const int64_t macro_block_size);
|
||||
void read_data(const int64_t macro_block_size);
|
||||
void read_plain_data(const char* buf, const int64_t macro_block_size);
|
||||
|
||||
void read_plain_data(const char *buf, const int64_t macro_block_size);
|
||||
private:
|
||||
static const int64_t BUF_COUNT = 16;
|
||||
int64_t thread_cnt_;
|
||||
@ -97,24 +101,22 @@ private:
|
||||
int fd_;
|
||||
bool is_write_;
|
||||
bool is_big_file_;
|
||||
ObTableSchema* table_schema_;
|
||||
ObTableSchema *table_schema_;
|
||||
bool is_plain_;
|
||||
};
|
||||
|
||||
TestTmpFileStress::TestTmpFileStress()
|
||||
: thread_cnt_(0),
|
||||
size_(OB_FILE_SYSTEM.get_macro_block_size()),
|
||||
fd_(0),
|
||||
is_write_(false),
|
||||
is_big_file_(false),
|
||||
table_schema_(NULL),
|
||||
is_plain_(false)
|
||||
{}
|
||||
: thread_cnt_(0), size_(OB_SERVER_BLOCK_MGR.get_macro_block_size()), fd_(0),
|
||||
is_write_(false), is_big_file_(false), table_schema_(NULL), is_plain_(false)
|
||||
{
|
||||
}
|
||||
|
||||
TestTmpFileStress::~TestTmpFileStress()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int TestTmpFileStress::init(const int fd, const bool is_write, const int64_t thread_cnt, ObTableSchema* table_schema,
|
||||
int TestTmpFileStress::init(const int fd, const bool is_write,
|
||||
const int64_t thread_cnt, ObTableSchema *table_schema,
|
||||
const bool is_plain, const bool is_big_file)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -136,8 +138,7 @@ int TestTmpFileStress::init(const int fd, const bool is_write, const int64_t thr
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TestTmpFileStress::prepare_one_buffer(
|
||||
const int64_t macro_block_size, const int64_t start_index, char* buf, int64_t& end_index)
|
||||
void TestTmpFileStress::prepare_one_buffer(const int64_t macro_block_size, const int64_t start_index, char *buf, int64_t &end_index)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObStoreRow row;
|
||||
@ -166,7 +167,7 @@ void TestTmpFileStress::prepare_one_buffer(
|
||||
ASSERT_EQ(OB_SUCCESS, header.serialize(buf, buf_capacity, header_pos));
|
||||
}
|
||||
|
||||
void TestTmpFileStress::prepare_data(char* buf, const int64_t macro_block_size)
|
||||
void TestTmpFileStress::prepare_data(char *buf, const int64_t macro_block_size)
|
||||
{
|
||||
const int64_t macro_block_buffer_count = BUF_COUNT;
|
||||
int64_t buf_pos = 0;
|
||||
@ -179,12 +180,13 @@ void TestTmpFileStress::prepare_data(char* buf, const int64_t macro_block_size)
|
||||
}
|
||||
}
|
||||
|
||||
void TestTmpFileStress::prepare_plain_data(const int64_t buf_capacity, char* buf, ObIArray<int64_t>& size_array)
|
||||
void TestTmpFileStress::prepare_plain_data(const int64_t buf_capacity, char *buf,
|
||||
ObIArray<int64_t> &size_array)
|
||||
{
|
||||
ObRandom random;
|
||||
int64_t left_size = buf_capacity;
|
||||
int8_t data = 0;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
while (left_size > 0) {
|
||||
if (left_size < macro_block_size) {
|
||||
memset(buf, data, left_size);
|
||||
@ -201,18 +203,18 @@ void TestTmpFileStress::prepare_plain_data(const int64_t buf_capacity, char* buf
|
||||
}
|
||||
}
|
||||
|
||||
void TestTmpFileStress::check_plain_data(const char* read_buf, const char* right_buf, const int64_t buf_len)
|
||||
void TestTmpFileStress::check_plain_data(const char *read_buf, const char *right_buf, const int64_t buf_len)
|
||||
{
|
||||
int cmp = memcmp(read_buf, right_buf, buf_len);
|
||||
ASSERT_EQ(0, cmp);
|
||||
}
|
||||
|
||||
void TestTmpFileStress::check_data(const char* buf, const int64_t buf_len)
|
||||
void TestTmpFileStress::check_data(const char *buf, const int64_t buf_len)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t header_pos = 0;
|
||||
int64_t data_pos = 0;
|
||||
const char* data = NULL;
|
||||
const char *data = NULL;
|
||||
BufHeader header;
|
||||
ObArenaAllocator allocator;
|
||||
ObRowGenerate row_generate;
|
||||
@ -253,9 +255,9 @@ void TestTmpFileStress::write_data(const int64_t macro_block_size)
|
||||
io_info.fd_ = fd_;
|
||||
io_info.size_ = macro_block_size;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
char* buf = new char[BUF_COUNT * macro_block_size];
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
char *buf = new char[BUF_COUNT * macro_block_size];
|
||||
const int64_t timeout_ms = 5000;
|
||||
prepare_data(buf, macro_block_size);
|
||||
for (int64_t i = 0; i < BUF_COUNT; ++i) {
|
||||
@ -266,7 +268,7 @@ void TestTmpFileStress::write_data(const int64_t macro_block_size)
|
||||
}
|
||||
}
|
||||
|
||||
void TestTmpFileStress::write_plain_data(char*& buf, const int64_t macro_block_size)
|
||||
void TestTmpFileStress::write_plain_data(char *&buf, const int64_t macro_block_size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArray<int64_t> size_array;
|
||||
@ -274,8 +276,8 @@ void TestTmpFileStress::write_plain_data(char*& buf, const int64_t macro_block_s
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
io_info.fd_ = fd_;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
buf = new char[BUF_COUNT * macro_block_size];
|
||||
const int64_t timeout_ms = 5000;
|
||||
int64_t sum_size = 0;
|
||||
@ -300,9 +302,9 @@ void TestTmpFileStress::read_data(const int64_t macro_block_size)
|
||||
io_info.fd_ = fd_;
|
||||
io_info.size_ = macro_block_size;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
char* buf = new char[macro_block_size];
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
char *buf = new char[macro_block_size];
|
||||
for (int64_t i = 0; i < BUF_COUNT; ++i) {
|
||||
io_info.buf_ = buf;
|
||||
ret = ObTmpFileManager::get_instance().read(io_info, timeout_ms, handle);
|
||||
@ -314,7 +316,7 @@ void TestTmpFileStress::read_data(const int64_t macro_block_size)
|
||||
handle.reset();
|
||||
}
|
||||
|
||||
void TestTmpFileStress::read_plain_data(const char* read_buf, const int64_t macro_block_size)
|
||||
void TestTmpFileStress::read_plain_data(const char *read_buf, const int64_t macro_block_size)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t timeout_ms = 100000;
|
||||
@ -323,9 +325,9 @@ void TestTmpFileStress::read_plain_data(const char* read_buf, const int64_t macr
|
||||
io_info.fd_ = fd_;
|
||||
io_info.size_ = macro_block_size;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
char* buf = new char[BUF_COUNT * macro_block_size];
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
char *buf = new char[BUF_COUNT * macro_block_size];
|
||||
int64_t offset = 0;
|
||||
for (int64_t i = 0; i < BUF_COUNT; ++i) {
|
||||
io_info.buf_ = buf + i * macro_block_size;
|
||||
@ -342,8 +344,10 @@ void TestTmpFileStress::read_plain_data(const char* read_buf, const int64_t macr
|
||||
|
||||
void TestTmpFileStress::run1()
|
||||
{
|
||||
ObTenantBase tenant_ctx(1);
|
||||
ObTenantEnv::set_tenant(&tenant_ctx);
|
||||
if (is_plain_) {
|
||||
char* buf = NULL;
|
||||
char *buf = NULL;
|
||||
write_plain_data(buf, size_);
|
||||
read_plain_data(buf, size_);
|
||||
} else {
|
||||
@ -355,46 +359,52 @@ void TestTmpFileStress::run1()
|
||||
}
|
||||
}
|
||||
|
||||
class TestMultiTmpFileStress : public share::ObThreadPool {
|
||||
class TestMultiTmpFileStress : public share::ObThreadPool
|
||||
{
|
||||
public:
|
||||
TestMultiTmpFileStress();
|
||||
virtual ~TestMultiTmpFileStress();
|
||||
int init(const int64_t file_cnt, const int64_t dir_id, const int64_t thread_cnt, ObTableSchema* table_schema,
|
||||
const bool is_plain_data, const bool is_big_file);
|
||||
int init(const int64_t file_cnt, const int64_t dir_id, const int64_t thread_cnt,
|
||||
ObTableSchema *table_schema, const bool is_plain_data, const bool is_big_file);
|
||||
virtual void run1();
|
||||
|
||||
private:
|
||||
void run_plain_case();
|
||||
void run_normal_case();
|
||||
|
||||
private:
|
||||
int64_t file_cnt_;
|
||||
int64_t dir_id_;
|
||||
int64_t thread_cnt_perf_file_;
|
||||
ObTableSchema* table_schema_;
|
||||
ObTableSchema *table_schema_;
|
||||
bool is_big_file_;
|
||||
bool is_plain_data_;
|
||||
};
|
||||
|
||||
TestMultiTmpFileStress::TestMultiTmpFileStress()
|
||||
: file_cnt_(0),
|
||||
dir_id_(-1),
|
||||
thread_cnt_perf_file_(0),
|
||||
table_schema_(NULL),
|
||||
is_big_file_(false),
|
||||
is_plain_data_(false)
|
||||
{}
|
||||
: file_cnt_(0),
|
||||
dir_id_(-1),
|
||||
thread_cnt_perf_file_(0),
|
||||
table_schema_(NULL),
|
||||
is_big_file_(false),
|
||||
is_plain_data_(false)
|
||||
{
|
||||
}
|
||||
|
||||
TestMultiTmpFileStress::~TestMultiTmpFileStress()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int TestMultiTmpFileStress::init(const int64_t file_cnt, const int64_t dir_id, const int64_t thread_cnt,
|
||||
ObTableSchema* table_schema, const bool is_plain_data, const bool is_big_file)
|
||||
int TestMultiTmpFileStress::init(const int64_t file_cnt,
|
||||
const int64_t dir_id,
|
||||
const int64_t thread_cnt,
|
||||
ObTableSchema *table_schema,
|
||||
const bool is_plain_data,
|
||||
const bool is_big_file)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (file_cnt < 0 || thread_cnt < 0 || NULL == table_schema) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
STORAGE_LOG(WARN, "invalid argument", K(ret), K(file_cnt), K(thread_cnt), KP(table_schema));
|
||||
STORAGE_LOG(WARN, "invalid argument", K(ret), K(file_cnt), K(thread_cnt),
|
||||
KP(table_schema));
|
||||
} else {
|
||||
file_cnt_ = file_cnt;
|
||||
dir_id_ = dir_id;
|
||||
@ -455,32 +465,34 @@ void TestMultiTmpFileStress::run1()
|
||||
}
|
||||
}
|
||||
|
||||
class TestTmpFile : public TestDataFilePrepare {
|
||||
class TestTmpFile : public TestDataFilePrepare
|
||||
{
|
||||
public:
|
||||
TestTmpFile();
|
||||
virtual ~TestTmpFile();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
protected:
|
||||
ObTableSchema table_schema_;
|
||||
|
||||
private:
|
||||
void prepare_schema();
|
||||
};
|
||||
|
||||
TestTmpFile::TestTmpFile() : TestDataFilePrepare("TestTmpFile", 2 * 1024 * 1024, 2048)
|
||||
{}
|
||||
TestTmpFile::TestTmpFile()
|
||||
: TestDataFilePrepare(&getter, "TestTmpFile", 2 * 1024 * 1024, 2048)
|
||||
{
|
||||
}
|
||||
|
||||
TestTmpFile::~TestTmpFile()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void TestTmpFile::prepare_schema()
|
||||
{
|
||||
ObColumnSchemaV2 column;
|
||||
int64_t table_id = 3001;
|
||||
int64_t micro_block_size = 16 * 1024;
|
||||
// init table schema
|
||||
//init table schema
|
||||
table_schema_.reset();
|
||||
ASSERT_EQ(OB_SUCCESS, table_schema_.set_table_name("test_macro_file"));
|
||||
table_schema_.set_tenant_id(1);
|
||||
@ -491,10 +503,10 @@ void TestTmpFile::prepare_schema()
|
||||
table_schema_.set_max_used_column_id(TEST_COLUMN_CNT);
|
||||
table_schema_.set_block_size(micro_block_size);
|
||||
table_schema_.set_compress_func_name("none");
|
||||
// init column
|
||||
//init column
|
||||
char name[OB_MAX_FILE_NAME_LENGTH];
|
||||
memset(name, 0, sizeof(name));
|
||||
for (int64_t i = 0; i < TEST_COLUMN_CNT; ++i) {
|
||||
for(int64_t i = 0; i < TEST_COLUMN_CNT; ++i) {
|
||||
ObObjType obj_type = static_cast<ObObjType>(i + 1);
|
||||
column.reset();
|
||||
column.set_table_id(table_id);
|
||||
@ -504,9 +516,9 @@ void TestTmpFile::prepare_schema()
|
||||
column.set_data_type(obj_type);
|
||||
column.set_collation_type(CS_TYPE_UTF8MB4_GENERAL_CI);
|
||||
column.set_data_length(1);
|
||||
if (obj_type == common::ObIntType) {
|
||||
if(obj_type == common::ObIntType){
|
||||
column.set_rowkey_position(1);
|
||||
} else if (obj_type == common::ObVarcharType) {
|
||||
} else if(obj_type == common::ObVarcharType) {
|
||||
column.set_rowkey_position(2);
|
||||
} else {
|
||||
column.set_rowkey_position(0);
|
||||
@ -525,13 +537,10 @@ void TestTmpFile::SetUp()
|
||||
TestDataFilePrepare::SetUp();
|
||||
prepare_schema();
|
||||
|
||||
ret = ObTenantManager::get_instance().init(100000);
|
||||
ret = getter.add_tenant(1,
|
||||
8L * 1024L * 1024L, 2L * 1024L * 1024L * 1024L);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTenantManager::get_instance().add_tenant(1);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTenantManager::get_instance().set_tenant_mem_limit(1, 8L * 1024L * 1024L, 2L * 1024L * 1024L * 1024L);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObKVGlobalCache::get_instance().init(bucket_num, max_cache_size, block_size);
|
||||
ret = ObKVGlobalCache::get_instance().init(&getter, bucket_num, max_cache_size, block_size);
|
||||
if (OB_INIT_TWICE == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
@ -541,8 +550,10 @@ void TestTmpFile::SetUp()
|
||||
CHUNK_MGR.set_limit(8L * 1024L * 1024L * 1024L);
|
||||
ret = ObTmpFileManager::get_instance().init();
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTmpFileManager::get_instance().start();
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
static ObTenantBase tenant_ctx(1);
|
||||
ObTenantEnv::set_tenant(&tenant_ctx);
|
||||
ObTenantIOManager *io_service = nullptr;
|
||||
EXPECT_EQ(OB_SUCCESS, ObTenantIOManager::mtl_init(io_service));
|
||||
}
|
||||
|
||||
void TestTmpFile::TearDown()
|
||||
@ -550,7 +561,6 @@ void TestTmpFile::TearDown()
|
||||
table_schema_.reset();
|
||||
ObTmpFileManager::get_instance().destroy();
|
||||
ObKVGlobalCache::get_instance().destroy();
|
||||
ObTenantManager::get_instance().destroy();
|
||||
TestDataFilePrepare::TearDown();
|
||||
}
|
||||
|
||||
@ -559,7 +569,7 @@ TEST_F(TestTmpFile, test_big_file)
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t dir = -1;
|
||||
int64_t fd = -1;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
ObTmpFileIOInfo io_info;
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = ObTmpFileManager::get_instance().alloc_dir(dir);
|
||||
@ -567,15 +577,15 @@ TEST_F(TestTmpFile, test_big_file)
|
||||
ret = ObTmpFileManager::get_instance().open(fd, dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
int64_t write_size = macro_block_size * 512;
|
||||
char* write_buf = (char*)malloc(write_size);
|
||||
char *write_buf = (char *)malloc(write_size);
|
||||
for (int64_t i = 0; i < write_size; ++i) {
|
||||
write_buf[i] = static_cast<char>(i % 256);
|
||||
}
|
||||
char* read_buf = (char*)malloc(write_size);
|
||||
char *read_buf = (char *)malloc(write_size);
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = write_size;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -662,7 +672,7 @@ TEST_F(TestTmpFile, test_multi_small_file_single_thread_read_write)
|
||||
ObMallocAllocator::get_instance()->print_tenant_ctx_memory_usage(500);
|
||||
}
|
||||
|
||||
TEST_F(TestTmpFile, test_multi_small_file_multi_thread_read_write)
|
||||
TEST_F(TestTmpFile, test_multi_small_file_multi_thread_read_write )
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const int64_t thread_cnt = 4;
|
||||
@ -696,22 +706,22 @@ TEST_F(TestTmpFile, test_inner_read_offset_and_seek)
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t dir = -1;
|
||||
int64_t fd = -1;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
ObTmpFileIOInfo io_info;
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = ObTmpFileManager::get_instance().alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTmpFileManager::get_instance().open(fd, dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
char* write_buf = new char[macro_block_size + 256];
|
||||
char *write_buf = new char [macro_block_size + 256];
|
||||
for (int i = 0; i < macro_block_size + 256; ++i) {
|
||||
write_buf[i] = static_cast<char>(i % 256);
|
||||
}
|
||||
char* read_buf = new char[macro_block_size + 256];
|
||||
char *read_buf = new char [macro_block_size + 256];
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = macro_block_size + 256;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -721,6 +731,7 @@ TEST_F(TestTmpFile, test_inner_read_offset_and_seek)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
io_info.buf_ = read_buf;
|
||||
|
||||
|
||||
int64_t read_time = ObTimeUtility::current_time();
|
||||
ret = ObTmpFileManager::get_instance().read(io_info, timeout_ms, handle);
|
||||
read_time = ObTimeUtility::current_time() - read_time;
|
||||
@ -729,10 +740,12 @@ TEST_F(TestTmpFile, test_inner_read_offset_and_seek)
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf, macro_block_size + 256);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
io_info.size_ = 200;
|
||||
ret = ObTmpFileManager::get_instance().read(io_info, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().seek(fd, 0, ObTmpFile::SET_SEEK);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
@ -743,6 +756,7 @@ TEST_F(TestTmpFile, test_inner_read_offset_and_seek)
|
||||
cmp = memcmp(handle.get_buffer(), write_buf, 201);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().seek(fd, 199, ObTmpFile::CUR_SEEK);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
@ -753,6 +767,7 @@ TEST_F(TestTmpFile, test_inner_read_offset_and_seek)
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + 400, 199);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_inner_read_offset_and_seek");
|
||||
STORAGE_LOG(INFO, "io time", K(write_time), K(read_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -784,6 +799,7 @@ TEST_F(TestTmpFile, test_single_file_single_thread_read_write)
|
||||
test.wait();
|
||||
io_time = ObTimeUtility::current_time() - io_time;
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_single_file_single_thread_read_write");
|
||||
STORAGE_LOG(INFO, "io time", K(io_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -800,23 +816,24 @@ TEST_F(TestTmpFile, test_aio_read_and_write)
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t dir = -1;
|
||||
int64_t fd = -1;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
ObTmpFileIOInfo io_info;
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = ObTmpFileManager::get_instance().alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTmpFileManager::get_instance().open(fd, dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
char* write_buf = new char[macro_block_size + 256];
|
||||
char *write_buf = new char [macro_block_size + 256];
|
||||
for (int i = 0; i < macro_block_size + 256; ++i) {
|
||||
write_buf[i] = static_cast<char>(i % 256);
|
||||
}
|
||||
char* read_buf = new char[macro_block_size + 256];
|
||||
char *read_buf = new char [macro_block_size + 256];
|
||||
|
||||
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = macro_block_size + 256;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -838,9 +855,11 @@ TEST_F(TestTmpFile, test_aio_read_and_write)
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf, macro_block_size + 256);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().seek(fd, 100, ObTmpFile::SET_SEEK);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
|
||||
io_info.size_ = macro_block_size;
|
||||
ret = ObTmpFileManager::get_instance().aio_read(io_info, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
@ -851,6 +870,7 @@ TEST_F(TestTmpFile, test_aio_read_and_write)
|
||||
ASSERT_EQ(0, cmp);
|
||||
handle.reset();
|
||||
|
||||
|
||||
io_info.size_ = macro_block_size;
|
||||
ret = ObTmpFileManager::get_instance().aio_pread(io_info, 0, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
@ -861,6 +881,7 @@ TEST_F(TestTmpFile, test_aio_read_and_write)
|
||||
ASSERT_EQ(0, cmp);
|
||||
handle.reset();
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_aio_read_and_write");
|
||||
STORAGE_LOG(INFO, "io time", K(write_time), K(read_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -934,6 +955,7 @@ TEST_F(TestTmpFile, test_single_file_multi_thread_read_write)
|
||||
test.wait();
|
||||
io_time = ObTimeUtility::current_time() - io_time;
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_single_file_multi_thread_read_write");
|
||||
STORAGE_LOG(INFO, "io time", K(io_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -963,6 +985,7 @@ TEST_F(TestTmpFile, test_multi_file_single_thread_read_write)
|
||||
test.wait();
|
||||
io_time = ObTimeUtility::current_time() - io_time;
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_multi_file_single_thread_read_write");
|
||||
STORAGE_LOG(INFO, "io time", K(io_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -992,6 +1015,7 @@ TEST_F(TestTmpFile, test_multi_file_multi_thread_read_write)
|
||||
test.wait();
|
||||
io_time = ObTimeUtility::current_time() - io_time;
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_multi_file_multi_thread_read_write");
|
||||
STORAGE_LOG(INFO, "io time", K(io_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -1021,6 +1045,7 @@ TEST_F(TestTmpFile, test_write_not_macro_size)
|
||||
test.wait();
|
||||
io_time = ObTimeUtility::current_time() - io_time;
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_write_not_macro_size");
|
||||
STORAGE_LOG(INFO, "io time", K(io_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -1043,15 +1068,15 @@ TEST_F(TestTmpFile, test_write_less_than_macro_block_size)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTmpFileManager::get_instance().open(fd, dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
char* write_buf = new char[256];
|
||||
char *write_buf = new char [256];
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
write_buf[i] = static_cast<char>(i);
|
||||
}
|
||||
char* read_buf = new char[256];
|
||||
char *read_buf = new char [256];
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = 256;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -1061,6 +1086,7 @@ TEST_F(TestTmpFile, test_write_less_than_macro_block_size)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
io_info.buf_ = read_buf;
|
||||
|
||||
|
||||
int64_t read_time = ObTimeUtility::current_time();
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, 0, timeout_ms, handle);
|
||||
read_time = ObTimeUtility::current_time() - read_time;
|
||||
@ -1069,6 +1095,7 @@ TEST_F(TestTmpFile, test_write_less_than_macro_block_size)
|
||||
int cmp = memcmp(handle.get_buffer(), write_buf, 256);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
io_info.size_ = 255;
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, 0, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
@ -1076,12 +1103,14 @@ TEST_F(TestTmpFile, test_write_less_than_macro_block_size)
|
||||
cmp = memcmp(handle.get_buffer(), write_buf, 255);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, 20, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
ASSERT_EQ(256 - 20, handle.get_data_size());
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + 20, 256 - 20);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
io_info.size_ = 20;
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, 40, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
@ -1089,6 +1118,7 @@ TEST_F(TestTmpFile, test_write_less_than_macro_block_size)
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + 40, handle.get_data_size());
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
io_info.size_ = 100;
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, 156, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
@ -1096,9 +1126,11 @@ TEST_F(TestTmpFile, test_write_less_than_macro_block_size)
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + 156, handle.get_data_size());
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, 256, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_write_less_than_macro_block_size");
|
||||
STORAGE_LOG(INFO, "io time", K(write_time), K(read_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -1117,22 +1149,22 @@ TEST_F(TestTmpFile, test_write_more_than_one_macro_block)
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t dir = -1;
|
||||
int64_t fd = -1;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
ObTmpFileIOInfo io_info;
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = ObTmpFileManager::get_instance().alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ret = ObTmpFileManager::get_instance().open(fd, dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
char* write_buf = new char[macro_block_size + 256];
|
||||
char *write_buf = new char [macro_block_size + 256];
|
||||
for (int i = 0; i < macro_block_size + 256; ++i) {
|
||||
write_buf[i] = static_cast<char>(i % 256);
|
||||
}
|
||||
char* read_buf = new char[macro_block_size + 256];
|
||||
char *read_buf = new char [macro_block_size + 256];
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = macro_block_size + 256;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -1185,6 +1217,7 @@ TEST_F(TestTmpFile, test_write_more_than_one_macro_block)
|
||||
cmp = memcmp(handle.get_buffer(), write_buf + macro_block_size + 10, handle.get_data_size());
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
io_info.size_ = 200;
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, macro_block_size + 100, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
@ -1195,6 +1228,7 @@ TEST_F(TestTmpFile, test_write_more_than_one_macro_block)
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info, macro_block_size + 256, timeout_ms, handle);
|
||||
ASSERT_EQ(OB_ITER_END, ret);
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_write_more_than_one_macro_block");
|
||||
STORAGE_LOG(INFO, "io time", K(write_time), K(read_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -1222,18 +1256,18 @@ TEST_F(TestTmpFile, test_single_dir_two_file)
|
||||
ret = ObTmpFileManager::get_instance().alloc_dir(dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
char* write_buf = new char[macro_block_size + 256];
|
||||
char *write_buf = new char [macro_block_size + 256];
|
||||
for (int i = 0; i < macro_block_size + 256; ++i) {
|
||||
write_buf[i] = static_cast<char>(i % 256);
|
||||
}
|
||||
char* read_buf = new char[macro_block_size + 256];
|
||||
char *read_buf = new char [macro_block_size + 256];
|
||||
|
||||
ret = ObTmpFileManager::get_instance().open(fd_1, dir);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
io_info1.fd_ = fd_1;
|
||||
io_info1.tenant_id_ = 1;
|
||||
io_info1.io_desc_.category_ = USER_IO;
|
||||
io_info1.io_desc_.wait_event_no_ = 2;
|
||||
io_info1.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info1.io_desc_.set_wait_event(2);
|
||||
io_info1.buf_ = write_buf;
|
||||
io_info1.size_ = macro_block_size + 256;
|
||||
|
||||
@ -1241,8 +1275,8 @@ TEST_F(TestTmpFile, test_single_dir_two_file)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
io_info2.fd_ = fd_2;
|
||||
io_info2.tenant_id_ = 1;
|
||||
io_info2.io_desc_.category_ = USER_IO;
|
||||
io_info2.io_desc_.wait_event_no_ = 2;
|
||||
io_info2.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info2.io_desc_.set_wait_event(2);
|
||||
io_info2.buf_ = write_buf;
|
||||
io_info2.size_ = macro_block_size + 256;
|
||||
|
||||
@ -1257,6 +1291,7 @@ TEST_F(TestTmpFile, test_single_dir_two_file)
|
||||
write_time = ObTimeUtility::current_time() - write_time;
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
|
||||
io_info1.buf_ = read_buf;
|
||||
int64_t read_time = ObTimeUtility::current_time();
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info1, 0, timeout_ms, handle1);
|
||||
@ -1266,6 +1301,7 @@ TEST_F(TestTmpFile, test_single_dir_two_file)
|
||||
int cmp = memcmp(handle1.get_buffer(), write_buf, macro_block_size + 256);
|
||||
ASSERT_EQ(0, cmp);
|
||||
|
||||
|
||||
io_info2.buf_ = read_buf;
|
||||
read_time = ObTimeUtility::current_time();
|
||||
ret = ObTmpFileManager::get_instance().pread(io_info2, 0, timeout_ms, handle2);
|
||||
@ -1291,7 +1327,7 @@ TEST_F(TestTmpFile, test_single_dir_two_file)
|
||||
int64_t new_dir = -1;
|
||||
int64_t new_fd = -1;
|
||||
int old_fd = -1;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
ObTmpFileIOInfo new_io_info;
|
||||
ObTmpFileIOHandle new_handle;
|
||||
ObMacroFileIOInfo old_io_info;
|
||||
@ -1310,15 +1346,15 @@ TEST_F(TestTmpFile, test_single_dir_two_file)
|
||||
|
||||
new_io_info.fd_ = new_fd;
|
||||
new_io_info.tenant_id_ = 1;
|
||||
new_io_info.io_desc_.category_ = USER_IO;
|
||||
new_io_info.io_desc_.wait_event_no_ = 2;
|
||||
new_io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
new_io_info.io_desc_.set_wait_event(2);
|
||||
new_io_info.buf_ = write_buf;
|
||||
new_io_info.size_ = macro_block_size + 256;
|
||||
|
||||
old_io_info.fd_ = old_fd;
|
||||
old_io_info.tenant_id_ = 1;
|
||||
old_io_info.io_desc_.category_ = USER_IO;
|
||||
old_io_info.io_desc_.wait_event_no_ = 2;
|
||||
old_io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
old_io_info.io_desc_.set_wait_event(2);
|
||||
old_io_info.buf_ = write_buf;
|
||||
old_io_info.size_ = macro_block_size + 256;
|
||||
|
||||
@ -1371,6 +1407,7 @@ TEST_F(TestTmpFile, test_single_dir_multi_file)
|
||||
test.wait();
|
||||
io_time = ObTimeUtility::current_time() - io_time;
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_single_dir_multi_file");
|
||||
STORAGE_LOG(INFO, "io time", K(io_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
@ -1400,6 +1437,7 @@ TEST_F(TestTmpFile, test_drop_tenant_file)
|
||||
ASSERT_EQ(0, ObTmpFileManager::get_instance().files_.map_.size());
|
||||
ASSERT_EQ(1, ObTmpFileStore::get_instance().tenant_file_stores_.size());
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().remove_tenant_file(1);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
@ -1432,6 +1470,7 @@ TEST_F(TestTmpFile, test_drop_tenant_file)
|
||||
ASSERT_EQ(100, ObTmpFileManager::get_instance().files_.map_.size());
|
||||
ASSERT_EQ(1, ObTmpFileStore::get_instance().tenant_file_stores_.size());
|
||||
|
||||
|
||||
ret = ObTmpFileManager::get_instance().remove_tenant_file(1);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
@ -1457,8 +1496,8 @@ TEST_F(TestTmpFile, test_handle_double_wait)
|
||||
char *read_buf = new char [256];
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = 256;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -1497,7 +1536,7 @@ TEST_F(TestTmpFile, test_sql_workload)
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t dir = -1;
|
||||
int64_t fd = -1;
|
||||
const int64_t macro_block_size = OB_FILE_SYSTEM.get_macro_block_size();
|
||||
const int64_t macro_block_size = OB_SERVER_BLOCK_MGR.get_macro_block_size();
|
||||
ObTmpFileIOInfo io_info;
|
||||
ObTmpFileIOHandle handle;
|
||||
ret = ObTmpFileManager::get_instance().alloc_dir(dir);
|
||||
@ -1515,8 +1554,8 @@ TEST_F(TestTmpFile, test_sql_workload)
|
||||
|
||||
io_info.fd_ = fd;
|
||||
io_info.tenant_id_ = 1;
|
||||
io_info.io_desc_.category_ = USER_IO;
|
||||
io_info.io_desc_.wait_event_no_ = 2;
|
||||
io_info.io_desc_.set_category(ObIOCategory::USER_IO);
|
||||
io_info.io_desc_.set_wait_event(2);
|
||||
io_info.buf_ = write_buf;
|
||||
io_info.size_ = write_size;
|
||||
const int64_t timeout_ms = 5000;
|
||||
@ -1578,7 +1617,7 @@ TEST_F(TestTmpFile, test_sql_workload)
|
||||
|
||||
|
||||
STORAGE_LOG(INFO, "test_sql_workload");
|
||||
STORAGE_LOG(INFO, "io time", K((write_size * cnt) / (1024 * 1024 * 1024)), K(write_time), K(read_time));
|
||||
STORAGE_LOG(INFO, "io time", K((write_size * cnt) / (1024*1024*1024)), K(write_time), K(read_time));
|
||||
ObTmpTenantFileStoreHandle store_handle;
|
||||
OB_TMP_FILE_STORE.get_store(1, store_handle);
|
||||
store_handle.get_tenant_store()->print_block_usage();
|
||||
@ -1593,7 +1632,7 @@ TEST_F(TestTmpFile, test_sql_workload)
|
||||
TEST_F(TestTmpFile, test_page_buddy)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArenaAllocator allocator;
|
||||
ObArenaAllocator allocator;
|
||||
ObTmpFilePageBuddy page_buddy_1;
|
||||
|
||||
ret = page_buddy_1.init(allocator);
|
||||
@ -1612,7 +1651,7 @@ TEST_F(TestTmpFile, test_page_buddy)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_EQ(false, page_buddy_1.is_empty());
|
||||
|
||||
page_buddy_1.free(start_page_id + 63, page_nums - 63);
|
||||
page_buddy_1.free(start_page_id + 63, page_nums -63);
|
||||
page_buddy_1.free(start_page_id_2 + 1, page_nums - 1);
|
||||
page_nums = 63;
|
||||
page_buddy_1.free(start_page_id, page_nums);
|
||||
@ -1670,7 +1709,7 @@ TEST_F(TestTmpFile, test_page_buddy)
|
||||
} // end namespace unittest
|
||||
} // end namespace oceanbase
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
system("rm -f test_tmp_file.log*");
|
||||
oceanbase::common::ObLogger::get_logger().set_log_level("INFO");
|
||||
|
||||
Reference in New Issue
Block a user