Fix the problem of arm atomic operation crash caused by global variable address misalignment

This commit is contained in:
obdev
2023-01-29 16:32:29 +08:00
committed by ob-robot
parent 367cd4c339
commit 700e4a2978
2 changed files with 2 additions and 2 deletions

View File

@ -378,7 +378,7 @@ ObTenantCtxAllocator *ObMallocAllocator::take_off_tenant_allocator(uint64_t tena
void ObMallocAllocator::set_root_allocator() void ObMallocAllocator::set_root_allocator()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
static char buf[sizeof(ObTenantCtxAllocator) * ObCtxIds::MAX_CTX_ID]; static char buf[sizeof(ObTenantCtxAllocator) * ObCtxIds::MAX_CTX_ID] __attribute__((__aligned__(16)));
ObTenantCtxAllocator *allocator = NULL; ObTenantCtxAllocator *allocator = NULL;
abort_unless(OB_SUCCESS == create_tenant_allocator(OB_SERVER_TENANT_ID, buf, allocator)); abort_unless(OB_SUCCESS == create_tenant_allocator(OB_SERVER_TENANT_ID, buf, allocator));
abort_unless(OB_SUCCESS == add_tenant_allocator(allocator)); abort_unless(OB_SUCCESS == add_tenant_allocator(allocator));

View File

@ -611,7 +611,7 @@ int ObResourceMgr::create_tenant_resource_mgr_unsafe(const uint64_t tenant_id,
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(tenant_id)); LOG_WARN("invalid argument", K(ret), K(tenant_id));
} else if (OB_UNLIKELY(OB_SERVER_TENANT_ID == tenant_id)) { } else if (OB_UNLIKELY(OB_SERVER_TENANT_ID == tenant_id)) {
static char buf[sizeof(ObTenantResourceMgr)]; static char buf[sizeof(ObTenantResourceMgr)] __attribute__((__aligned__(16)));
ptr = buf; ptr = buf;
} else { } else {
ObMemAttr attr(OB_SERVER_TENANT_ID, "TntResourceMgr"); ObMemAttr attr(OB_SERVER_TENANT_ID, "TntResourceMgr");