support asan in 3.1_opensource_release

This commit is contained in:
xy0
2022-04-08 14:00:52 +08:00
committed by LINxiansheng
parent 021cb19e6c
commit e43242fe44
4 changed files with 70 additions and 60 deletions

View File

@ -71,25 +71,25 @@ static uint64_t up2align(uint64_t x, uint64_t align)
#define __DIRECT_MALLOC__ __DM_MMAP_ALIGNED #define __DIRECT_MALLOC__ __DM_MMAP_ALIGNED
#if __DIRECT_MALLOC__ == __DM_MALLOC #if __DIRECT_MALLOC__ == __DM_MALLOC
void* direct_malloc(int64_t size) void *direct_malloc(int64_t size)
{ {
return ::malloc(size); return ::malloc(size);
} }
void direct_free(void* p, int64_t size) void direct_free(void *p, int64_t size)
{ {
UNUSED(size); UNUSED(size);
::free(p); ::free(p);
} }
#elif __DIRECT_MALLOC__ == __DM_MMAP #elif __DIRECT_MALLOC__ == __DM_MMAP
void* direct_malloc(int64_t size) void *direct_malloc(int64_t size)
{ {
void* p = NULL; void *p = NULL;
if (MAP_FAILED == (p = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0))) { if (MAP_FAILED == (p = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0))) {
p = NULL; p = NULL;
} }
return p; return p;
} }
void direct_free(void* p, int64_t size) void direct_free(void *p, int64_t size)
{ {
if (NULL != p) { if (NULL != p) {
munmap(p, size); munmap(p, size);
@ -98,9 +98,9 @@ void direct_free(void* p, int64_t size)
#elif __DIRECT_MALLOC__ == __DM_MMAP_ALIGNED #elif __DIRECT_MALLOC__ == __DM_MMAP_ALIGNED
const static uint64_t MMAP_BLOCK_ALIGN = 1ULL << 21; const static uint64_t MMAP_BLOCK_ALIGN = 1ULL << 21;
inline void* mmap_aligned(uint64_t size, uint64_t align) inline void *mmap_aligned(uint64_t size, uint64_t align)
{ {
void* ret = NULL; void *ret = NULL;
if (MAP_FAILED == (ret = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0))) { if (MAP_FAILED == (ret = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0))) {
ret = NULL; ret = NULL;
} else if (is_aligned((uint64_t)ret, align)) { } else if (is_aligned((uint64_t)ret, align)) {
@ -115,19 +115,19 @@ inline void* mmap_aligned(uint64_t size, uint64_t align)
uint64_t trailer_size = (uint64_t)ret + align - aligned_addr; uint64_t trailer_size = (uint64_t)ret + align - aligned_addr;
munmap(ret, header_size); munmap(ret, header_size);
munmap((void*)(aligned_addr + size), trailer_size); munmap((void *)(aligned_addr + size), trailer_size);
ret = (void*)aligned_addr; ret = (void *)aligned_addr;
} }
} }
return ret; return ret;
} }
void* direct_malloc(int64_t size) void *direct_malloc(int64_t size)
{ {
return mmap_aligned(size, MMAP_BLOCK_ALIGN); return mmap_aligned(size, MMAP_BLOCK_ALIGN);
} }
void direct_free(void* p, int64_t size) void direct_free(void *p, int64_t size)
{ {
if (NULL != p) { if (NULL != p) {
munmap(p, size); munmap(p, size);
@ -138,25 +138,25 @@ void direct_free(void* p, int64_t size)
namespace oceanbase { namespace oceanbase {
namespace common { namespace common {
ObIAllocator* global_default_allocator = NULL; ObIAllocator *global_default_allocator = NULL;
int ob_init_memory_pool(int64_t block_size) int ob_init_memory_pool(int64_t block_size)
{ {
UNUSED(block_size); UNUSED(block_size);
return OB_SUCCESS; return OB_SUCCESS;
} }
ObMemLeakChecker& get_mem_leak_checker() ObMemLeakChecker &get_mem_leak_checker()
{ {
return ObMemLeakChecker::get_instance(); return ObMemLeakChecker::get_instance();
} }
void reset_mem_leak_checker_label(const char* str) void reset_mem_leak_checker_label(const char *str)
{ {
get_mem_leak_checker().set_str(str); get_mem_leak_checker().set_str(str);
get_mem_leak_checker().reset(); get_mem_leak_checker().reset();
} }
const ObCtxInfo& get_global_ctx_info() const ObCtxInfo &get_global_ctx_info()
{ {
static ObCtxInfo info; static ObCtxInfo info;
return info; return info;
@ -166,15 +166,17 @@ void __attribute__((constructor(MALLOC_INIT_PRIORITY))) init_global_memory_pool(
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
// coro local storage construct function // coro local storage construct function
CoRoutine::co_cb_ = [](CoRoutine& coro) { CoRoutine::co_cb_ = [](CoRoutine &coro) {
new (coro.get_context().get_local_store()) ObLocalStore(); new (coro.get_context().get_local_store()) ObLocalStore();
new (coro.get_rtctx()) ObRuntimeContext(); new (coro.get_rtctx()) ObRuntimeContext();
auto cls = reinterpret_cast<common::ObLocalStore*>(coro.get_context().get_local_store()); auto cls = reinterpret_cast<common::ObLocalStore *>(coro.get_context().get_local_store());
coro.get_context().get_stack(cls->stack_addr_, cls->stack_size_); coro.get_context().get_stack(cls->stack_addr_, cls->stack_size_);
return OB_SUCCESS; return OB_SUCCESS;
}; };
global_default_allocator = ObMallocAllocator::get_instance(); global_default_allocator = ObMallocAllocator::get_instance();
#ifndef OB_USE_ASAN
abort_unless(OB_SUCCESS == install_ob_signal_handler()); abort_unless(OB_SUCCESS == install_ob_signal_handler());
#endif
} }
void __attribute__((destructor(MALLOC_INIT_PRIORITY))) deinit_global_memory_pool() void __attribute__((destructor(MALLOC_INIT_PRIORITY))) deinit_global_memory_pool()

View File

@ -159,7 +159,7 @@ ObServer::~ObServer()
destroy(); destroy();
} }
int ObServer::init(const ObServerOptions& opts, const ObPLogWriterCfg& log_cfg) int ObServer::init(const ObServerOptions &opts, const ObPLogWriterCfg &log_cfg)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
opts_ = opts; opts_ = opts;
@ -234,8 +234,10 @@ int ObServer::init(const ObServerOptions& opts, const ObPLogWriterCfg& log_cfg)
LOG_ERROR("should never reach here!", K(ret)); LOG_ERROR("should never reach here!", K(ret));
} else if (OB_FAIL(init_restore_ctx())) { } else if (OB_FAIL(init_restore_ctx())) {
LOG_ERROR("init restore context fail", K(ret)); LOG_ERROR("init restore context fail", K(ret));
#ifndef OB_USE_ASAN
} else if (OB_FAIL(ObMemoryDump::get_instance().init())) { } else if (OB_FAIL(ObMemoryDump::get_instance().init())) {
LOG_ERROR("init memory dumper fail", K(ret)); LOG_ERROR("init memory dumper fail", K(ret));
#endif
} else if (OB_FAIL(ObDagScheduler::get_instance().init(OBSERVER.get_self()))) { } else if (OB_FAIL(ObDagScheduler::get_instance().init(OBSERVER.get_self()))) {
LOG_ERROR("init scheduler fail, ", K(ret)); LOG_ERROR("init scheduler fail, ", K(ret));
} else if (OB_FAIL(init_global_kvcache())) { } else if (OB_FAIL(init_global_kvcache())) {
@ -588,7 +590,7 @@ int ObServer::stop()
LOG_INFO("cache size calcucator has stopped"); LOG_INFO("cache size calcucator has stopped");
LOG_INFO("begin stop distributed scheduler manager"); LOG_INFO("begin stop distributed scheduler manager");
ObDistributedSchedulerManager* dist_sched_mgr = ObDistributedSchedulerManager::get_instance(); ObDistributedSchedulerManager *dist_sched_mgr = ObDistributedSchedulerManager::get_instance();
if (OB_ISNULL(dist_sched_mgr)) { if (OB_ISNULL(dist_sched_mgr)) {
LOG_ERROR("distributed scheduler manager instance is NULL"); LOG_ERROR("distributed scheduler manager instance is NULL");
} else if (OB_FAIL(dist_sched_mgr->stop())) { } else if (OB_FAIL(dist_sched_mgr->stop())) {
@ -804,7 +806,7 @@ int ObServer::init_config()
bool has_config_file = true; bool has_config_file = true;
// set dump path // set dump path
const char* dump_path = "etc/observer.config.bin"; const char *dump_path = "etc/observer.config.bin";
config_mgr_.set_dump_path(dump_path); config_mgr_.set_dump_path(dump_path);
if (OB_FILE_NOT_EXIST == (ret = config_mgr_.load_config())) { if (OB_FILE_NOT_EXIST == (ret = config_mgr_.load_config())) {
has_config_file = false; has_config_file = false;
@ -826,7 +828,7 @@ int ObServer::init_config()
config_.devname.set_version(start_time_); config_.devname.set_version(start_time_);
} else { } else {
if (!has_config_file) { if (!has_config_file) {
const char* devname = get_default_if(); const char *devname = get_default_if();
if (devname && '\0' != devname[0]) { if (devname && '\0' != devname[0]) {
LOG_INFO("guess interface name", K(devname)); LOG_INFO("guess interface name", K(devname));
config_.devname.set_value(devname); config_.devname.set_value(devname);
@ -1110,7 +1112,7 @@ int ObServer::init_restore_ctx()
int ObServer::init_interrupt() int ObServer::init_interrupt()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObGlobalInterruptManager* mgr = ObGlobalInterruptManager::getInstance(); ObGlobalInterruptManager *mgr = ObGlobalInterruptManager::getInstance();
if (OB_ISNULL(mgr)) { if (OB_ISNULL(mgr)) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail get interrupt mgr instance", K(ret)); LOG_ERROR("fail get interrupt mgr instance", K(ret));
@ -1123,7 +1125,7 @@ int ObServer::init_interrupt()
int ObServer::init_loaddata_global_stat() int ObServer::init_loaddata_global_stat()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObGlobalLoadDataStatMap* map = ObGlobalLoadDataStatMap::getInstance(); ObGlobalLoadDataStatMap *map = ObGlobalLoadDataStatMap::getInstance();
if (OB_ISNULL(map)) { if (OB_ISNULL(map)) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("fail allocate load data map for status", K(ret)); LOG_ERROR("fail allocate load data map for status", K(ret));
@ -1253,7 +1255,7 @@ int ObServer::init_multi_tenant()
// init allocator for OB_SYS_TENANT_ID and OB_SERVER_TENANT_ID // init allocator for OB_SYS_TENANT_ID and OB_SERVER_TENANT_ID
int64_t min_sys_tenant_memory = config_.get_min_sys_tenant_memory(); int64_t min_sys_tenant_memory = config_.get_min_sys_tenant_memory();
int64_t max_sys_tenant_memory = config_.get_max_sys_tenant_memory(); int64_t max_sys_tenant_memory = config_.get_max_sys_tenant_memory();
ObMallocAllocator* allocator = ObMallocAllocator::get_instance(); ObMallocAllocator *allocator = ObMallocAllocator::get_instance();
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (!OB_ISNULL(allocator)) { if (!OB_ISNULL(allocator)) {
allocator->set_tenant_limit(OB_SYS_TENANT_ID, max_sys_tenant_memory); allocator->set_tenant_limit(OB_SYS_TENANT_ID, max_sys_tenant_memory);
@ -1262,7 +1264,7 @@ int ObServer::init_multi_tenant()
} }
// set tenant mem limits // set tenant mem limits
ObTenantManager& omti = ObTenantManager::get_instance(); ObTenantManager &omti = ObTenantManager::get_instance();
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (OB_FAIL( if (OB_FAIL(
omti.init(self_addr_, srv_rpc_proxy_, rs_rpc_proxy_, rs_mgr_, net_frame_.get_req_transport(), &config_))) { omti.init(self_addr_, srv_rpc_proxy_, rs_rpc_proxy_, rs_mgr_, net_frame_.get_req_transport(), &config_))) {
@ -1433,7 +1435,7 @@ int ObServer::init_sql_runner()
int ObServer::init_sequence() int ObServer::init_sequence()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObSequenceCache& cache = ObSequenceCache::get_instance(); ObSequenceCache &cache = ObSequenceCache::get_instance();
if (OB_FAIL(cache.init(schema_service_, sql_proxy_))) { if (OB_FAIL(cache.init(schema_service_, sql_proxy_))) {
LOG_ERROR("init sequence engine failed", K(ret)); LOG_ERROR("init sequence engine failed", K(ret));
} else { } else {
@ -1588,7 +1590,7 @@ int ObServer::wait_gts()
int ObServer::init_ts_mgr() int ObServer::init_ts_mgr()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
ObILocationAdapter* location_adapter = ObPartitionService::get_instance().get_trans_service()->get_location_adapter(); ObILocationAdapter *location_adapter = ObPartitionService::get_instance().get_trans_service()->get_location_adapter();
if (OB_FAIL(OB_TS_MGR.init(self_addr_, location_adapter, net_frame_.get_req_transport(), &gts_))) { if (OB_FAIL(OB_TS_MGR.init(self_addr_, location_adapter, net_frame_.get_req_transport(), &gts_))) {
LOG_ERROR("gts cache mgr init failed", K_(self_addr), KP(location_adapter), K(ret)); LOG_ERROR("gts cache mgr init failed", K_(self_addr), KP(location_adapter), K(ret));
@ -1633,7 +1635,7 @@ int ObServer::init_storage()
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
const char* redundancy_level = config_.redundancy_level; const char *redundancy_level = config_.redundancy_level;
if (0 == strcasecmp(redundancy_level, "EXTERNAL")) { if (0 == strcasecmp(redundancy_level, "EXTERNAL")) {
storage_env_.redundancy_level_ = ObStorageEnv::EXTERNAL_REDUNDANCY; storage_env_.redundancy_level_ = ObStorageEnv::EXTERNAL_REDUNDANCY;
} else if (0 == strcasecmp(redundancy_level, "NORMAL")) { } else if (0 == strcasecmp(redundancy_level, "NORMAL")) {
@ -1706,7 +1708,7 @@ int ObServer::init_gc_partition_adapter()
return ret; return ret;
} }
int ObServer::get_network_speed_from_sysfs(int64_t& network_speed) int ObServer::get_network_speed_from_sysfs(int64_t &network_speed)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
// sys_bkgd_net_percentage_ = config_.sys_bkgd_net_percentage; // sys_bkgd_net_percentage_ = config_.sys_bkgd_net_percentage;
@ -1722,9 +1724,9 @@ int ObServer::get_network_speed_from_sysfs(int64_t& network_speed)
return ret; return ret;
} }
char* strtrim(char* str) char *strtrim(char *str)
{ {
char* ptr; char *ptr;
if (str == NULL) { if (str == NULL) {
return NULL; return NULL;
@ -1742,9 +1744,9 @@ char* strtrim(char* str)
return str; return str;
} }
static int64_t nic_rate_parse(const char* str, bool& valid) static int64_t nic_rate_parse(const char *str, bool &valid)
{ {
char* p_unit = nullptr; char *p_unit = nullptr;
int64_t value = 0; int64_t value = 0;
if (OB_ISNULL(str) || '\0' == str[0]) { if (OB_ISNULL(str) || '\0' == str[0]) {
@ -1776,16 +1778,16 @@ static int64_t nic_rate_parse(const char* str, bool& valid)
return value; return value;
} }
int ObServer::get_network_speed_from_config_file(int64_t& network_speed) int ObServer::get_network_speed_from_config_file(int64_t &network_speed)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
const char* nic_rate_path = "etc/nic.rate.config"; const char *nic_rate_path = "etc/nic.rate.config";
const int64_t MAX_NIC_CONFIG_FILE_SIZE = 1 << 10; // 1KB const int64_t MAX_NIC_CONFIG_FILE_SIZE = 1 << 10; // 1KB
FILE* fp = nullptr; FILE *fp = nullptr;
char* buf = nullptr; char *buf = nullptr;
static int nic_rate_file_exist = 1; static int nic_rate_file_exist = 1;
if (OB_ISNULL(buf = static_cast<char*>(ob_malloc(MAX_NIC_CONFIG_FILE_SIZE + 1, ObModIds::OB_BUFFER)))) { if (OB_ISNULL(buf = static_cast<char *>(ob_malloc(MAX_NIC_CONFIG_FILE_SIZE + 1, ObModIds::OB_BUFFER)))) {
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("alloc buffer failed", LITERAL_K(MAX_NIC_CONFIG_FILE_SIZE), K(ret)); LOG_ERROR("alloc buffer failed", LITERAL_K(MAX_NIC_CONFIG_FILE_SIZE), K(ret));
} else if (OB_ISNULL(fp = fopen(nic_rate_path, "r"))) { } else if (OB_ISNULL(fp = fopen(nic_rate_path, "r"))) {
@ -1810,7 +1812,7 @@ int ObServer::get_network_speed_from_config_file(int64_t& network_speed)
} }
memset(buf, 0, MAX_NIC_CONFIG_FILE_SIZE + 1); memset(buf, 0, MAX_NIC_CONFIG_FILE_SIZE + 1);
fread(buf, 1, MAX_NIC_CONFIG_FILE_SIZE, fp); fread(buf, 1, MAX_NIC_CONFIG_FILE_SIZE, fp);
char* prate = nullptr; char *prate = nullptr;
if (OB_UNLIKELY(0 != ferror(fp))) { if (OB_UNLIKELY(0 != ferror(fp))) {
ret = OB_IO_ERROR; ret = OB_IO_ERROR;
@ -1953,7 +1955,7 @@ int ObServer::check_server_can_start_service()
return ret; return ret;
} }
storage::ObPartitionService& ObServer::get_partition_service() storage::ObPartitionService &ObServer::get_partition_service()
{ {
return ObPartitionService::get_instance(); return ObPartitionService::get_instance();
} }
@ -1961,7 +1963,7 @@ storage::ObPartitionService& ObServer::get_partition_service()
ObServer::ObCTASCleanUpTask::ObCTASCleanUpTask() : obs_(nullptr), is_inited_(false) ObServer::ObCTASCleanUpTask::ObCTASCleanUpTask() : obs_(nullptr), is_inited_(false)
{} {}
int ObServer::ObCTASCleanUpTask::init(ObServer* obs, int tg_id) int ObServer::ObCTASCleanUpTask::init(ObServer *obs, int tg_id)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_UNLIKELY(is_inited_)) { if (OB_UNLIKELY(is_inited_)) {
@ -2009,7 +2011,7 @@ void ObServer::ObCTASCleanUpTask::runTimerTask()
// Traverse the current session and determine whether the given table schema needs to be deleted according to the // Traverse the current session and determine whether the given table schema needs to be deleted according to the
// session id and last active time // session id and last active time
bool ObServer::ObCTASCleanUp::operator()(sql::ObSQLSessionMgr::Key key, sql::ObSQLSessionInfo* sess_info) bool ObServer::ObCTASCleanUp::operator()(sql::ObSQLSessionMgr::Key key, sql::ObSQLSessionInfo *sess_info)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if ((ObCTASCleanUp::TEMP_TAB_PROXY_RULE == get_cleanup_type() && get_drop_flag()) || if ((ObCTASCleanUp::TEMP_TAB_PROXY_RULE == get_cleanup_type() && get_drop_flag()) ||
@ -2073,7 +2075,7 @@ bool ObServer::ObCTASCleanUp::operator()(sql::ObSQLSessionMgr::Key key, sql::ObS
// Traverse the current session, if the session has updated sess_active_time recently, execute alter system refresh // Traverse the current session, if the session has updated sess_active_time recently, execute alter system refresh
// tables in session xxx Synchronously update the last active time of all temporary tables under the current session // tables in session xxx Synchronously update the last active time of all temporary tables under the current session
bool ObServer::ObRefreshTime::operator()(sql::ObSQLSessionMgr::Key key, sql::ObSQLSessionInfo* sess_info) bool ObServer::ObRefreshTime::operator()(sql::ObSQLSessionMgr::Key key, sql::ObSQLSessionInfo *sess_info)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(key); UNUSED(key);
@ -2098,7 +2100,7 @@ bool ObServer::ObRefreshTime::operator()(sql::ObSQLSessionMgr::Key key, sql::ObS
ObServer::ObRefreshTimeTask::ObRefreshTimeTask() : obs_(nullptr), is_inited_(false) ObServer::ObRefreshTimeTask::ObRefreshTimeTask() : obs_(nullptr), is_inited_(false)
{} {}
int ObServer::ObRefreshTimeTask::init(ObServer* obs, int tg_id) int ObServer::ObRefreshTimeTask::init(ObServer *obs, int tg_id)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_UNLIKELY(is_inited_)) { if (OB_UNLIKELY(is_inited_)) {
@ -2155,7 +2157,7 @@ int ObServer::refresh_temp_table_sess_active_time()
ObServer::ObRefreshNetworkSpeedTask::ObRefreshNetworkSpeedTask() : obs_(nullptr), is_inited_(false) ObServer::ObRefreshNetworkSpeedTask::ObRefreshNetworkSpeedTask() : obs_(nullptr), is_inited_(false)
{} {}
int ObServer::ObRefreshNetworkSpeedTask::init(ObServer* obs, int tg_id) int ObServer::ObRefreshNetworkSpeedTask::init(ObServer *obs, int tg_id)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (OB_UNLIKELY(is_inited_)) { if (OB_UNLIKELY(is_inited_)) {
@ -2271,12 +2273,12 @@ int ObServer::clean_up_invalid_tables()
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
int tmp_ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS;
ObSchemaGetterGuard schema_guard; ObSchemaGetterGuard schema_guard;
const ObDatabaseSchema* database_schema = NULL; const ObDatabaseSchema *database_schema = NULL;
ObSEArray<const ObTableSchema*, 512> table_schemas; ObSEArray<const ObTableSchema *, 512> table_schemas;
const int64_t CONNECT_TIMEOUT_VALUE = 50L * 60L * 60L * 1000L * 1000L; // default value is 50hrs const int64_t CONNECT_TIMEOUT_VALUE = 50L * 60L * 60L * 1000L * 1000L; // default value is 50hrs
obrpc::ObDropTableArg drop_table_arg; obrpc::ObDropTableArg drop_table_arg;
obrpc::ObTableItem table_item; obrpc::ObTableItem table_item;
obrpc::ObCommonRpcProxy* common_rpc_proxy = NULL; obrpc::ObCommonRpcProxy *common_rpc_proxy = NULL;
char create_host_str[OB_MAX_HOST_NAME_LENGTH]; char create_host_str[OB_MAX_HOST_NAME_LENGTH];
if (OB_FAIL(schema_service_.get_schema_guard(schema_guard))) { if (OB_FAIL(schema_service_.get_schema_guard(schema_guard))) {
LOG_WARN("fail to get schema guard", K(ret)); LOG_WARN("fail to get schema guard", K(ret));
@ -2289,7 +2291,7 @@ int ObServer::clean_up_invalid_tables()
common_rpc_proxy = GCTX.rs_rpc_proxy_; common_rpc_proxy = GCTX.rs_rpc_proxy_;
MYADDR.ip_port_to_string(create_host_str, OB_MAX_HOST_NAME_LENGTH); MYADDR.ip_port_to_string(create_host_str, OB_MAX_HOST_NAME_LENGTH);
for (int64_t i = 0; i < table_schemas.count() && OB_SUCC(tmp_ret); i++) { for (int64_t i = 0; i < table_schemas.count() && OB_SUCC(tmp_ret); i++) {
const ObTableSchema* table_schema = table_schemas.at(i); const ObTableSchema *table_schema = table_schemas.at(i);
if (OB_ISNULL(table_schema)) { if (OB_ISNULL(table_schema)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("got invalid schema", K(ret), K(i)); LOG_WARN("got invalid schema", K(ret), K(i));

View File

@ -76,7 +76,7 @@ int ObSignalHandle::change_signal_mask()
return ret; return ret;
} }
int ObSignalHandle::add_signums_to_set(sigset_t& sig_set) int ObSignalHandle::add_signums_to_set(sigset_t &sig_set)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
if (0 != sigemptyset(&sig_set)) { if (0 != sigemptyset(&sig_set)) {
@ -221,8 +221,10 @@ int ObSignalHandle::deal_signals(int signum)
break; break;
} }
case 60: { case 60: {
#ifndef OB_USE_ASAN
send_request_and_wait(VERB_LEVEL_1, syscall(SYS_gettid) /*exclude_id*/); send_request_and_wait(VERB_LEVEL_1, syscall(SYS_gettid) /*exclude_id*/);
break; break;
#endif
} }
case 62: { case 62: {
// RESP_DUMP_TRACE_TO_FILE(); // RESP_DUMP_TRACE_TO_FILE();

View File

@ -19,7 +19,7 @@ using namespace common;
namespace oceanbase { namespace oceanbase {
namespace blocksstable { namespace blocksstable {
ObSelfBufferWriter::ObSelfBufferWriter(const int64_t size, const char* label, const bool need_align) ObSelfBufferWriter::ObSelfBufferWriter(const int64_t size, const char *label, const bool need_align)
: ObBufferWriter(NULL, 0, 0), label_(label), is_aligned_(need_align), macro_block_mem_ctx_() : ObBufferWriter(NULL, 0, 0), label_(label), is_aligned_(need_align), macro_block_mem_ctx_()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
@ -39,11 +39,11 @@ ObSelfBufferWriter::~ObSelfBufferWriter()
macro_block_mem_ctx_.destroy(); macro_block_mem_ctx_.destroy();
} }
char* ObSelfBufferWriter::alloc(const int64_t size) char *ObSelfBufferWriter::alloc(const int64_t size)
{ {
char* data = NULL; char *data = NULL;
if (size == macro_block_mem_ctx_.get_block_size()) { if (size == macro_block_mem_ctx_.get_block_size()) {
data = (char*)macro_block_mem_ctx_.alloc(); data = (char *)macro_block_mem_ctx_.alloc();
if (OB_ISNULL(data)) { if (OB_ISNULL(data)) {
STORAGE_LOG(WARN, "fail to alloc buf from mem ctx", K(size)); STORAGE_LOG(WARN, "fail to alloc buf from mem ctx", K(size));
} }
@ -52,9 +52,9 @@ char* ObSelfBufferWriter::alloc(const int64_t size)
// alloc from mem ctx fail // alloc from mem ctx fail
if (OB_ISNULL(data)) { if (OB_ISNULL(data)) {
if (is_aligned_) { if (is_aligned_) {
data = (char*)ob_malloc_align(BUFFER_ALIGN_SIZE, size, label_); data = (char *)ob_malloc_align(BUFFER_ALIGN_SIZE, size, label_);
} else { } else {
data = (char*)ob_malloc(size, label_); data = (char *)ob_malloc(size, label_);
} }
} }
return data; return data;
@ -79,7 +79,7 @@ int ObSelfBufferWriter::ensure_space(int64_t size)
} }
} else if (capacity_ < size) { } else if (capacity_ < size) {
// resize; // resize;
char* new_data = NULL; char *new_data = NULL;
if (NULL == (new_data = alloc(size))) { if (NULL == (new_data = alloc(size))) {
STORAGE_LOG(WARN, "allocate buffer memory error.", K(size)); STORAGE_LOG(WARN, "allocate buffer memory error.", K(size));
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
@ -97,17 +97,21 @@ int ObSelfBufferWriter::ensure_space(int64_t size)
void ObSelfBufferWriter::free() void ObSelfBufferWriter::free()
{ {
if (NULL != data_) { if (NULL != data_) {
#ifndef OB_USE_ASAN
if (macro_block_mem_ctx_.get_allocator().contains(data_)) { if (macro_block_mem_ctx_.get_allocator().contains(data_)) {
macro_block_mem_ctx_.free(data_); macro_block_mem_ctx_.free(data_);
} else { data_ = NULL;
}
#endif
if (NULL != data_) {
if (is_aligned_) { if (is_aligned_) {
ob_free_align(data_); ob_free_align(data_);
} else { } else {
ob_free(data_); ob_free(data_);
} }
}
}
data_ = NULL; data_ = NULL;
}
}
} }
} // namespace blocksstable } // namespace blocksstable
} // namespace oceanbase } // namespace oceanbase