Files
oceanbase/unittest/storage/multi_data_source/test_mds_compile.cpp
hiddenbomb c981050104 [FEAT MERGE] mds_mvs
Co-authored-by: xuhuleon <xuhuleon@qq.com>
Co-authored-by: godyangfight <godyangfight@gmail.com>
Co-authored-by: JiahuaChen <garfieldjia@qq.com>
2024-06-25 07:51:39 +00:00

85 lines
2.4 KiB
C++

/**
* Copyright (c) 2021 OceanBase
* OceanBase CE is licensed under Mulan PubL v2.
* You can use this software according to the terms and conditions of the Mulan PubL v2.
* You may obtain a copy of Mulan PubL v2 at:
* http://license.coscl.org.cn/MulanPubL-2.0
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PubL v2 for more details.
*/
#define UNITTEST_DEBUG
#include <gtest/gtest.h>
#include <thread>
#include <iostream>
#include <vector>
#include <chrono>
#include "common/ob_clock_generator.h"
#include "storage/multi_data_source/mds_table_handle.h"
#include "storage/multi_data_source/compile_utility/compile_mapper.h"
#include "storage/tablet/ob_mds_schema_helper.h"
namespace oceanbase {
namespace storage {
namespace mds {
void *DefaultAllocator::alloc(const int64_t size) {
void *ptr = std::malloc(size);// ob_malloc(size, "MDS");
ATOMIC_INC(&alloc_times_);
MDS_LOG(DEBUG, "alloc obj", KP(ptr), K(size), K(lbt()));
return ptr;
}
void DefaultAllocator::free(void *ptr) {
ATOMIC_INC(&free_times_);
MDS_LOG(DEBUG, "free obj", KP(ptr), K(lbt()));
std::free(ptr);// ob_free(ptr);
}
void *MdsAllocator::alloc(const int64_t size) {
void *ptr = std::malloc(size);// ob_malloc(size, "MDS");
ATOMIC_INC(&alloc_times_);
MDS_LOG(DEBUG, "alloc obj", KP(ptr), K(size), K(lbt()));
return ptr;
}
void MdsAllocator::free(void *ptr) {
ATOMIC_INC(&free_times_);
MDS_LOG(DEBUG, "free obj", KP(ptr), K(lbt()));
std::free(ptr);// ob_free(ptr);
}
}}}
namespace oceanbase {
namespace unittest {
using namespace common;
using namespace std;
class TestMdsCompile: public ::testing::Test
{
public:
TestMdsCompile() { ObMdsSchemaHelper::get_instance().init(); };
virtual ~TestMdsCompile() {};
virtual void SetUp() {
};
virtual void TearDown() {
};
private:
// disallow copy
DISALLOW_COPY_AND_ASSIGN(TestMdsCompile);
};
TEST_F(TestMdsCompile, basic) {
ObTuple<int, double, char> tuple_;
tuple_.element<int>() = 1;
}
}
}
int main(int argc, char **argv)
{
system("rm -rf test_ob_occam_timer.log");
oceanbase::common::ObLogger &logger = oceanbase::common::ObLogger::get_logger();
logger.set_file_name("test_ob_occam_timer.log", false);
logger.set_log_level(OB_LOG_LEVEL_DEBUG);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}