patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -24,13 +24,18 @@
#include "share/config/ob_server_config.h"
#include "share/ob_define.h"
#include "observer/omt/ob_tenant_config_mgr.h"
#include "share/ob_simple_mem_limit_getter.h"
namespace oceanbase {
namespace oceanbase
{
using namespace omt;
namespace sql {
namespace sql
{
using namespace common;
static ObSimpleMemLimitGetter getter;
class TestEnv : public ::testing::Environment {
class TestEnv : public ::testing::Environment
{
public:
virtual void SetUp() override
{
@ -38,7 +43,7 @@ public:
uint64_t cluster_version = CLUSTER_VERSION_3000;
common::ObClusterVersion::get_instance().update_cluster_version(cluster_version);
int ret = OB_SUCCESS;
lib::ObMallocAllocator* malloc_allocator = lib::ObMallocAllocator::get_instance();
lib::ObMallocAllocator *malloc_allocator = lib::ObMallocAllocator::get_instance();
ret = malloc_allocator->create_tenant_ctx_allocator(OB_SYS_TENANT_ID);
ASSERT_EQ(OB_SUCCESS, ret);
ret = malloc_allocator->create_tenant_ctx_allocator(OB_SYS_TENANT_ID, common::ObCtxIds::WORK_AREA);
@ -49,29 +54,29 @@ public:
}
virtual void TearDown() override
{}
{
}
};
#define CALL(func, ...) \
func(__VA_ARGS__); \
ASSERT_FALSE(HasFatalFailure());
#define CALL(func, ...) func(__VA_ARGS__); ASSERT_FALSE(HasFatalFailure());
class TestHashDistinct : public ObHashDistinct {
class TestHashDistinct : public ObHashDistinct
{
public:
TestHashDistinct() : ObHashDistinct(alloc_)
{}
~TestHashDistinct()
{}
TestHashDistinct() :ObHashDistinct(alloc_) {}
~TestHashDistinct() {}
};
#define CALL(func, ...) \
func(__VA_ARGS__); \
ASSERT_FALSE(HasFatalFailure());
#define CALL(func, ...) func(__VA_ARGS__); ASSERT_FALSE(HasFatalFailure());
class TestHashDistinctTest : public blocksstable::TestDataFilePrepare {
class TestHashDistinctTest: public blocksstable::TestDataFilePrepare
{
public:
TestHashDistinctTest() : blocksstable::TestDataFilePrepare("TestDisk_distinct", 2 << 20, 5000)
{}
TestHashDistinctTest() : blocksstable::TestDataFilePrepare(&getter,
"TestDisk_distinct", 2<<20, 5000)
{
}
virtual ~TestHashDistinctTest();
virtual void SetUp() override
{
@ -81,8 +86,6 @@ public:
blocksstable::TestDataFilePrepare::SetUp();
ret = blocksstable::ObTmpFileManager::get_instance().init();
ASSERT_EQ(OB_SUCCESS, ret);
ret = blocksstable::ObTmpFileManager::get_instance().start();
ASSERT_EQ(OB_SUCCESS, ret);
row_.count_ = COLS;
row_.cells_ = cells_;
@ -104,116 +107,119 @@ public:
{
blocksstable::ObTmpFileManager::get_instance().destroy();
blocksstable::TestDataFilePrepare::TearDown();
common::ObModItem mod;
lib::get_tenant_mod_memory(tenant_id_, static_cast<int>(mod_id_), mod);
ASSERT_EQ(0, mod.hold_);
lib::get_tenant_mod_memory(tenant_id_, static_cast<int>(mod_id2_), mod);
ASSERT_EQ(0, mod.hold_);
lib::get_tenant_mod_memory(tenant_id_, static_cast<int>(mod_id3_), mod);
ASSERT_EQ(0, mod.hold_);
ObTenantManager::get_instance().destroy();
SQL_ENG_LOG(WARN, "TearDown finished");
common::ObLabelItem item;
lib::get_tenant_label_memory(tenant_id_, ObNewModIds::TEST1, item);
ASSERT_EQ(0, item.hold_);
lib::get_tenant_label_memory(tenant_id_, ObNewModIds::TEST2, item);
ASSERT_EQ(0, item.hold_);
lib::get_tenant_label_memory(tenant_id_, ObNewModIds::TEST3, item);
ASSERT_EQ(0, item.hold_);
SQL_ENG_LOG(WARN,"TearDown finished");
}
ObNewRow& gen_row(int64_t row_id)
ObNewRow &gen_row(int64_t row_id)
{
cells_[0].set_int(row_id);
int64_t max_size = 512;
if (enable_big_row_ && row_id > 0 && random() % 100000 < 5) {
max_size = 1 << 20;
max_size = 1 << 20;
}
int64_t size = 10 + random() % max_size;
cells_[2].set_varchar(str_buf_, (int)size);
return row_;
}
// varify next row
// template <typename T>
void verify_row(ObExecContext& ctx, TestHashDistinct& op, bool verify_all = false)
{
const ObNewRow* result_row = &row_verify_;
int ret = op.get_next_row(ctx, result_row);
ASSERT_EQ(OB_SUCCESS, ret);
//varify next row
//template <typename T>
void verify_row(ObExecContext &ctx, TestHashDistinct &op, bool verify_all = false)
{
const ObNewRow *result_row = &row_verify_;
int ret = op.get_next_row(ctx, result_row);
ASSERT_EQ(OB_SUCCESS, ret);
int64_t v;
result_row->get_cell(0).get_int(v);
if (verify_all) {
result_row->get_cell(1).is_null();
ObString s = result_row->get_cell(2).get_varchar();
if (0 != strncmp(str_buf_, s.ptr(), s.length())) {
SQL_ENG_LOG(WARN, "verify failed", K(s.ptr()), K(s.length()));
}
ASSERT_EQ(0, strncmp(str_buf_, s.ptr(), s.length()));
}
int64_t v;
result_row->get_cell(0).get_int(v);
if (verify_all) {
result_row->get_cell(1).is_null();
ObString s = result_row->get_cell(2).get_varchar();
if (0 != strncmp(str_buf_, s.ptr(), s.length())) {
SQL_ENG_LOG(WARN, "verify failed", K(s.ptr()), K(s.length()));
}
ASSERT_EQ(0, strncmp(str_buf_, s.ptr(), s.length()));
}
ASSERT_EQ(hit_val[v], '0');
hit_val[v] = 1;
}
ASSERT_EQ(hit_val[v], '0');
hit_val[v] = 1;
}
void verify_n_rows(ObExecContext& ctx, TestHashDistinct& op, int64_t n, bool verify_all = false, int64_t start = 0)
{
memset(hit_val, '0', BUF_SIZE);
void verify_n_rows(ObExecContext &ctx, TestHashDistinct &op,
int64_t n, bool verify_all = false, int64_t start = 0)
{
memset(hit_val, '0', BUF_SIZE);
for (int64_t i = start; i < n; i++) {
CALL(verify_row, ctx, op, verify_all);
}
for (int64_t i = start; i < n; i++) {
CALL(verify_row, ctx, op, verify_all);
}
ASSERT_EQ(0, memcpy(hit_val, hit_val_base, sizeof(char) * n));
}
ASSERT_EQ(0, memcpy(hit_val, hit_val_base, sizeof(char) * n));
}
void verify_all_rows(ObExecContext& ctx, TestHashDistinct& op, int64_t n, bool verify_all = false)
{
int64_t i = 0;
int64_t v;
memset(hit_val, '0', BUF_SIZE);
while (true) {
const ObNewRow* result_row = &row_verify_;
int ret = op.get_next_row(ctx, result_row);
if (OB_ITER_END == ret) {
break;
}
ASSERT_EQ(OB_SUCCESS, ret);
i++;
result_row->get_cell(0).get_int(v);
if (verify_all) {
result_row->get_cell(1).is_null();
ObString s = result_row->get_cell(2).get_varchar();
if (0 != strncmp(str_buf_, s.ptr(), s.length())) {
SQL_ENG_LOG(WARN, "verify failed", K(s.ptr()), K(s.length()), K(v), K(i));
void verify_all_rows(ObExecContext &ctx, TestHashDistinct &op,
int64_t n, bool verify_all = false)
{
int64_t i = 0;
int64_t v;
memset(hit_val, '0', BUF_SIZE);
while (true) {
const ObNewRow *result_row = &row_verify_;
int ret = op.get_next_row(ctx, result_row);
if (OB_ITER_END == ret)
{
break;
}
ASSERT_EQ(0, strncmp(str_buf_, s.ptr(), s.length()));
ASSERT_EQ(OB_SUCCESS, ret);
i++;
result_row->get_cell(0).get_int(v);
if (verify_all) {
result_row->get_cell(1).is_null();
ObString s = result_row->get_cell(2).get_varchar();
if (0 != strncmp(str_buf_, s.ptr(), s.length())) {
SQL_ENG_LOG(WARN, "verify failed", K(s.ptr()), K(s.length()), K(v), K(i));
}
ASSERT_EQ(0, strncmp(str_buf_, s.ptr(), s.length()));
}
if (hit_val[v] != '0') {
SQL_ENG_LOG(WARN, "alread hitted", K(i), K(v));
}
ASSERT_EQ(hit_val[v], '0');
hit_val[v] = '1';
}
if (hit_val[v] != '0') {
SQL_ENG_LOG(WARN, "alread hitted", K(i), K(v));
if (n != i) {
SQL_ENG_LOG(WARN, "already hitted", K(i), K(v));
}
ASSERT_EQ(hit_val[v], '0');
hit_val[v] = '1';
ASSERT_EQ(n, i);
ASSERT_EQ(0, MEMCMP(hit_val, hit_val_base, sizeof(char) * n));
}
if (n != i) {
SQL_ENG_LOG(WARN, "already hitted", K(i), K(v));
}
ASSERT_EQ(n, i);
ASSERT_EQ(0, MEMCMP(hit_val, hit_val_base, sizeof(char) * n));
}
void append_rows(int64_t cnt)
{
int64_t ret = OB_SUCCESS;
// int64_t base = fake_table_.get_rows();
for (int64_t i = 0; i < cnt; i++) {
ObNewRow& row = gen_row(i);
fake_table_.add_row(row);
ASSERT_EQ(OB_SUCCESS, ret);
// if (i % 1000 == 0) {
// LOG_WARN("appended rows:", K(i));
//}
}
// ASSERT_EQ(base + cnt, fake_table_.get_rows());
}
void append_rows(int64_t cnt)
{
int64_t ret = OB_SUCCESS;
//int64_t base = fake_table_.get_rows();
for (int64_t i = 0; i < cnt; i++) {
ObNewRow &row = gen_row(i);
fake_table_.add_row(row);
ASSERT_EQ(OB_SUCCESS, ret);
//if (i % 1000 == 0) {
// LOG_WARN("appended rows:", K(i));
//}
}
//ASSERT_EQ(base + cnt, fake_table_.get_rows());
}
void init(ObExecContext& ctx, ObSQLSessionInfo& my_session, TestHashDistinct& hash_distinct, int64_t col_count)
void init(ObExecContext &ctx, ObSQLSessionInfo &my_session, TestHashDistinct &hash_distinct, int64_t col_count)
{
ASSERT_EQ(OB_SUCCESS, my_session.test_init(0, 0, 0, NULL));
ASSERT_EQ(OB_SUCCESS, my_session.test_init(0,0,0,NULL));
ASSERT_EQ(OB_SUCCESS, ObPreProcessSysVars::init_sys_var());
ASSERT_EQ(OB_SUCCESS, my_session.load_default_sys_variable(false, true));
ASSERT_EQ(OB_SUCCESS, my_session.init_tenant("test", OB_SYS_TENANT_ID));
@ -250,41 +256,30 @@ public:
ctx.get_physical_plan_ctx()->set_phy_plan(&physical_plan_);
}
void open_operator(ObExecContext& ctx, TestHashDistinct& hash_distinct)
void open_operator(ObExecContext &ctx, TestHashDistinct &hash_distinct)
{
ASSERT_EQ(OB_SUCCESS, hash_distinct.open(ctx));
ObHashDistinct::ObHashDistinctCtx* distinct_ctx = NULL;
bool is_null =
OB_ISNULL(distinct_ctx = GET_PHY_OPERATOR_CTX(ObHashDistinct::ObHashDistinctCtx, ctx, hash_distinct.get_id()));
ObHashDistinct::ObHashDistinctCtx *distinct_ctx = NULL;
bool is_null = OB_ISNULL(distinct_ctx = GET_PHY_OPERATOR_CTX(ObHashDistinct::ObHashDistinctCtx, ctx, hash_distinct.get_id()));
ASSERT_EQ(is_null, false);
distinct_ctx->enable_sql_dumped_ = true;
ASSERT_EQ(OB_SUCCESS, result_table_.open(ctx));
}
void close_operator(ObExecContext& ctx, TestHashDistinct& hash_distinct)
void close_operator(ObExecContext &ctx, TestHashDistinct &hash_distinct)
{
ASSERT_EQ(OB_SUCCESS, hash_distinct.close(ctx));
ASSERT_EQ(OB_SUCCESS, result_table_.close(ctx));
}
ObFakeTable& get_fake_table()
{
return fake_table_;
}
ObFakeTable& get_result_table()
{
return result_table_;
}
ObPhysicalPlan& get_physical_plan()
{
return physical_plan_;
}
ObFakeTable &get_fake_table() { return fake_table_; }
ObFakeTable &get_result_table() { return result_table_; }
ObPhysicalPlan &get_physical_plan() { return physical_plan_; }
protected:
ObFakeTable fake_table_;
ObFakeTable result_table_;
ObPhysicalPlan physical_plan_;
int32_t projector[3] = {0, 1, 2};
int32_t projector[3] = {0,1,2};
const static int64_t COLS = 3;
bool enable_big_row_ = false;
@ -300,24 +295,20 @@ protected:
private:
int64_t tenant_id_ = OB_SYS_TENANT_ID;
int64_t ctx_id_ = ObCtxIds::WORK_AREA;
int64_t mod_id_ = ObNewModIds::TEST1;
int64_t mod_id2_ = ObNewModIds::TEST2;
int64_t mod_id3_ = ObNewModIds::TEST3;
// disallow copy
TestHashDistinctTest(const TestHashDistinctTest& other);
TestHashDistinctTest& operator=(const TestHashDistinctTest& other);
TestHashDistinctTest(const TestHashDistinctTest &other);
TestHashDistinctTest& operator=(const TestHashDistinctTest &other);
private:
// data members
};
TestHashDistinctTest::~TestHashDistinctTest()
{}
{
}
int TestHashDistinctTest::init_tenant_mgr()
{
int ret = OB_SUCCESS;
ObTenantManager& tm = ObTenantManager::get_instance();
ObAddr self;
oceanbase::rpc::frame::ObReqTransport req_transport(NULL, NULL);
oceanbase::obrpc::ObSrvRpcProxy rpc_proxy;
@ -330,30 +321,26 @@ int TestHashDistinctTest::init_tenant_mgr()
GCONF.enable_sql_operator_dump.set_value("True");
uint64_t cluster_version = CLUSTER_VERSION_3000;
common::ObClusterVersion::get_instance().update_cluster_version(cluster_version);
ret = tm.init(self, rpc_proxy, rs_rpc_proxy, rs_mgr, &req_transport, &ObServerConfig::get_instance());
EXPECT_EQ(OB_SUCCESS, ret);
ret = tm.add_tenant(tenant_id);
EXPECT_EQ(OB_SUCCESS, ret);
ret = tm.set_tenant_mem_limit(tenant_id, 2L * 1024L * 1024L * 1024L, 4L * 1024L * 1024L * 1024L);
EXPECT_EQ(OB_SUCCESS, ret);
ret = tm.add_tenant(OB_SYS_TENANT_ID);
EXPECT_EQ(OB_SUCCESS, ret);
ret = tm.add_tenant(OB_SERVER_TENANT_ID);
ret = getter.add_tenant(tenant_id,
2L * 1024L * 1024L * 1024L, 4L * 1024L * 1024L * 1024L);
EXPECT_EQ(OB_SUCCESS, ret);
const int64_t ulmt = 128LL << 30;
const int64_t llmt = 128LL << 30;
ret = tm.set_tenant_mem_limit(OB_SYS_TENANT_ID, ulmt, llmt);
ret = getter.add_tenant(OB_SERVER_TENANT_ID,
ulmt,
llmt);
EXPECT_EQ(OB_SUCCESS, ret);
oceanbase::lib::set_memory_limit(128LL << 32);
return ret;
}
TEST_F(TestHashDistinctTest, test_big_data00)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
@ -361,13 +348,13 @@ TEST_F(TestHashDistinctTest, test_big_data00)
enable_big_row_ = true;
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 1000000);
CALL(append_rows, 1000000);
hash_distinct.init(1);
hash_distinct.add_distinct_column(0, cs_type);
// hash_distinct.add_distinct_column(1, cs_type);
//hash_distinct.add_distinct_column(1, cs_type);
open_operator(ctx, hash_distinct);
CALL(verify_all_rows, ctx, hash_distinct, 1000000, true);
close_operator(ctx, hash_distinct);
@ -377,8 +364,8 @@ TEST_F(TestHashDistinctTest, test_big_data01)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
@ -386,7 +373,7 @@ TEST_F(TestHashDistinctTest, test_big_data01)
enable_big_row_ = true;
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 1000000);
CALL(append_rows, 100000);
CALL(append_rows, 1000000);
@ -395,24 +382,26 @@ TEST_F(TestHashDistinctTest, test_big_data01)
hash_distinct.init(1);
hash_distinct.add_distinct_column(0, cs_type);
// hash_distinct.add_distinct_column(1, cs_type);
//hash_distinct.add_distinct_column(1, cs_type);
open_operator(ctx, hash_distinct);
CALL(verify_all_rows, ctx, hash_distinct, 1000000, true);
close_operator(ctx, hash_distinct);
}
TEST_F(TestHashDistinctTest, test_utf8mb4_bin)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_BIN;
ObSQLSessionInfo my_session;
init(ctx, my_session, hash_distinct, 3);
// fake table: distinct column(c1)
ADD_ROW(fake_table, COL("r"), COL(1), COL(1));
//fake table: distinct column(c1)
ADD_ROW(fake_table, COL("r"), COL(1), COL(1));
ADD_ROW(fake_table, COL("r"), COL(1), COL(2));
ADD_ROW(fake_table, COL("s"), COL(2), COL(3));
ADD_ROW(fake_table, COL("s"), COL(1), COL(3));
@ -439,13 +428,13 @@ TEST_F(TestHashDistinctTest, test_utf8mb4_general_ci)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
init(ctx, my_session, hash_distinct, 3);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
ADD_ROW(fake_table, COL("r"), COL("r"), COL(1));
ADD_ROW(fake_table, COL("r"), COL("r"), COL(2));
ADD_ROW(fake_table, COL("s"), COL("s"), COL(3));
@ -474,15 +463,15 @@ TEST_F(TestHashDistinctTest, test_all_in_mem)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
init(ctx, my_session, hash_distinct, 3);
hash_distinct.set_mem_limit(64 * 1024 * 1024);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 1000);
fake_table_.set_rows(1000);
@ -501,15 +490,15 @@ TEST_F(TestHashDistinctTest, test_all_in_mem1)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
init(ctx, my_session, hash_distinct, 3);
hash_distinct.set_mem_limit(64 * 1024 * 1024);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 3000);
fake_table_.set_rows(3000);
@ -528,15 +517,15 @@ TEST_F(TestHashDistinctTest, test_all_in_mem2)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
init(ctx, my_session, hash_distinct, 3);
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 3000);
CALL(append_rows, 3000);
CALL(append_rows, 3000);
@ -545,17 +534,18 @@ TEST_F(TestHashDistinctTest, test_all_in_mem2)
hash_distinct.add_distinct_column(0, cs_type);
hash_distinct.add_distinct_column(1, cs_type);
open_operator(ctx, hash_distinct);
// ASSERT_EQ(3000, hash_distinct.get_rows());
//ASSERT_EQ(3000, hash_distinct.get_rows());
CALL(verify_all_rows, ctx, hash_distinct, 3000, true);
close_operator(ctx, hash_distinct);
}
TEST_F(TestHashDistinctTest, test_big_data)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
@ -563,7 +553,7 @@ TEST_F(TestHashDistinctTest, test_big_data)
enable_big_row_ = true;
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 20000);
hash_distinct.init(2);
@ -574,6 +564,7 @@ TEST_F(TestHashDistinctTest, test_big_data)
close_operator(ctx, hash_distinct);
}
TEST_F(TestHashDistinctTest, test_big_data2)
{
int ret = OB_SUCCESS;
@ -585,7 +576,7 @@ TEST_F(TestHashDistinctTest, test_big_data2)
enable_big_row_ = true;
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 20000);
CALL(append_rows, 20000);
CALL(append_rows, 20000);
@ -598,12 +589,13 @@ TEST_F(TestHashDistinctTest, test_big_data2)
close_operator(ctx, hash_distinct);
}
TEST_F(TestHashDistinctTest, test_big_data3)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
@ -611,7 +603,7 @@ TEST_F(TestHashDistinctTest, test_big_data3)
enable_big_row_ = true;
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 50000);
CALL(append_rows, 50000);
CALL(append_rows, 50000);
@ -628,8 +620,8 @@ TEST_F(TestHashDistinctTest, test_big_data4)
{
int ret = OB_SUCCESS;
ObExecContext ctx;
ObFakeTable& fake_table = get_fake_table();
ObFakeTable& result_table = get_result_table();
ObFakeTable &fake_table = get_fake_table();
ObFakeTable &result_table = get_result_table();
TestHashDistinct hash_distinct;
ObCollationType cs_type = CS_TYPE_UTF8MB4_GENERAL_CI;
ObSQLSessionInfo my_session;
@ -637,7 +629,7 @@ TEST_F(TestHashDistinctTest, test_big_data4)
enable_big_row_ = true;
hash_distinct.set_mem_limit(64 * 1024 * 1024 * 10);
// fake table: distinct column(c1)
//fake table: distinct column(c1)
CALL(append_rows, 1000000);
CALL(append_rows, 1000000);
CALL(append_rows, 1000000);
@ -652,17 +644,20 @@ TEST_F(TestHashDistinctTest, test_big_data4)
close_operator(ctx, hash_distinct);
}
} // end namespace sql
} // end namespace oceanbase
int main(int argc, char** argv)
} // end namespace sql
} // end namespace oceanbase
int main(int argc, char **argv)
{
oceanbase::sql::init_sql_factories();
oceanbase::common::ObLogger::get_logger().set_log_level("WARN");
testing::InitGoogleTest(&argc, argv);
auto* env = new (oceanbase::sql::TestEnv);
auto *env = new (oceanbase::sql::TestEnv);
testing::AddGlobalTestEnvironment(env);
int ret = RUN_ALL_TESTS();
OB_LOGGER.disable();
return ret;
}