Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hnwyllmm committed May 30, 2024
2 parents d66ce5d + 323dbd5 commit c510185
Show file tree
Hide file tree
Showing 461 changed files with 17,348 additions and 2,163 deletions.
3 changes: 2 additions & 1 deletion cmake/Pack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(CPACK_PACKAGING_INSTALL_PREFIX /home/admin/oceanbase)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OceanBase is a distributed relational database")
set(CPACK_PACKAGE_VENDOR "OceanBase Inc.")
set(CPACK_PACKAGE_DESCRIPTION "OceanBase is a distributed relational database")
set(CPACK_COMPONENTS_ALL server libs sql-parser)
set(CPACK_COMPONENTS_ALL server sql-parser)

if (OB_BUILD_OPENSOURCE)
set(CPACK_PACKAGE_NAME "oceanbase-ce")
Expand Down Expand Up @@ -353,6 +353,7 @@ endif()

if(OB_BUILD_OPENSOURCE)
## oceanbase-libs
list(APPEND CPACK_COMPONENTS_ALL libs)
install(PROGRAMS
deps/3rd/usr/local/oceanbase/deps/devel/lib/libaio.so.1
deps/3rd/usr/local/oceanbase/deps/devel/lib/libaio.so.1.0.1
Expand Down
1 change: 1 addition & 0 deletions deps/init/dep_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function get_os_release() {
if [[ "${OS_ARCH}x" == "x86_64x" ]]; then
case "$ID" in
alinux)
version_ge "3.0" && compat_centos9 && return
version_ge "2.1903" && compat_centos7 && return
;;
alios)
Expand Down
2 changes: 1 addition & 1 deletion deps/init/oceanbase.el7.aarch64.deps
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ obdevtools-llvm-11.0.1-312022092921.el7.aarch64.rpm
[tools-deps]
devdeps-oblogmsg-1.0-192024032014.el7.aarch64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el7.aarch64.rpm
obshell-4.2.3.0-102024031414.el7.aarch64.rpm target=community
obshell-4.2.3.1-42024052814.el7.aarch64.rpm target=community

[test-utils]
ob-deploy-2.8.0-4.el7.aarch64.rpm target=community
Expand Down
2 changes: 1 addition & 1 deletion deps/init/oceanbase.el7.x86_64.deps
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ obdevtools-llvm-11.0.1-312022092921.el7.x86_64.rpm
[tools-deps]
devdeps-oblogmsg-1.0-192024032014.el7.x86_64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el7.x86_64.rpm
obshell-4.2.3.0-102024031414.el7.x86_64.rpm target=community
obshell-4.2.3.1-42024052814.el7.x86_64.rpm target=community

[test-utils]
ob-deploy-2.8.0-4.el7.x86_64.rpm target=community
Expand Down
2 changes: 1 addition & 1 deletion deps/init/oceanbase.el8.aarch64.deps
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ obdevtools-llvm-11.0.1-312022092921.el8.aarch64.rpm
[tools-deps]
devdeps-oblogmsg-1.0-192024032014.el8.aarch64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el8.aarch64.rpm
obshell-4.2.3.0-102024031414.el8.aarch64.rpm target=community
obshell-4.2.3.1-42024052814.el8.aarch64.rpm target=community

[test-utils]
ob-deploy-2.8.0-4.el8.aarch64.rpm target=community
Expand Down
2 changes: 1 addition & 1 deletion deps/init/oceanbase.el8.x86_64.deps
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ obdevtools-llvm-11.0.1-312022092921.el8.x86_64.rpm
[tools-deps]
devdeps-oblogmsg-1.0-192024032014.el8.x86_64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el8.x86_64.rpm
obshell-4.2.3.0-102024031414.el8.x86_64.rpm target=community
obshell-4.2.3.1-42024052814.el8.x86_64.rpm target=community

[test-utils]
ob-deploy-2.8.0-4.el8.x86_64.rpm target=community
Expand Down
2 changes: 1 addition & 1 deletion deps/init/oceanbase.el9.aarch64.deps
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ obdevtools-llvm-11.0.1-312022092921.el8.aarch64.rpm
[tools-deps]
devdeps-oblogmsg-1.0-192024032014.el8.aarch64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el8.aarch64.rpm
obshell-4.2.3.0-102024031414.el8.aarch64.rpm target=community
obshell-4.2.3.1-42024052814.el8.aarch64.rpm target=community

[test-utils]
ob-deploy-1.6.0-41.el8.aarch64.rpm target=community
Expand Down
2 changes: 1 addition & 1 deletion deps/init/oceanbase.el9.x86_64.deps
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ obdevtools-llvm-11.0.1-312022092921.el8.x86_64.rpm
[tools-deps]
devdeps-oblogmsg-1.0-192024032014.el8.x86_64.rpm
devdeps-rocksdb-6.22.1.1-52022100420.el8.x86_64.rpm
obshell-4.2.3.0-102024031414.el8.x86_64.rpm target=community
obshell-4.2.3.1-42024052814.el8.x86_64.rpm target=community

[test-utils]
ob-deploy-1.6.0-41.el8.x86_64.rpm target=community
Expand Down
7 changes: 2 additions & 5 deletions deps/oblib/src/common/ob_common_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define _OCEABASE_COMMON_OB_COMMON_UTILITY_H_
#include <sys/time.h>
#include "lib/ob_define.h"
#include "lib/time/ob_tsc_timestamp.h"
namespace oceanbase
{
namespace common
Expand Down Expand Up @@ -57,11 +58,7 @@ class ObFatalErrExtraInfoGuard

inline int64_t get_cur_ts()
{
struct timeval tv;
gettimeofday(&tv, NULL);
const int64_t us =
static_cast<int64_t>(tv.tv_sec) * static_cast<int64_t>(1000000) + static_cast<int64_t>(tv.tv_usec);
return us;
return OB_TSC_TIMESTAMP.fast_current_time();
}

class ObBasicTimeGuard
Expand Down
5 changes: 4 additions & 1 deletion deps/oblib/src/common/object/ob_obj_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ enum VecValueTypeClass: uint16_t {
VEC_TC_DEC_INT128,
VEC_TC_DEC_INT256,
VEC_TC_DEC_INT512,
VEC_TC_COLLECTION,
MAX_VEC_TC
};

Expand Down Expand Up @@ -1246,7 +1247,9 @@ OB_INLINE VecValueTypeClass get_vec_value_tc(const ObObjType type, const int16_t
VEC_TC_LOB, // ObLobType
VEC_TC_JSON, // ObJsonType
VEC_TC_GEO, // ObGeometryType
VEC_TC_UDT // ObUserDefinedSQLType
VEC_TC_UDT, // ObUserDefinedSQLType
MAX_VEC_TC, // invalid for ObDecimalIntType
VEC_TC_COLLECTION // ObCollectionSQLType
};
VecValueTypeClass t = MAX_VEC_TC;
if (type < 0 || type >= ObMaxType) {
Expand Down
13 changes: 0 additions & 13 deletions deps/oblib/src/lib/alloc/block_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "lib/allocator/ob_tc_malloc.h"
#include "lib/ob_define.h"
#include "lib/alloc/ob_tenant_ctx_allocator.h"
#include "lib/alloc/ob_malloc_callback.h"

using namespace oceanbase;
using namespace oceanbase::lib;
Expand Down Expand Up @@ -92,12 +91,6 @@ ABlock *BlockSet::alloc_block(const uint64_t size, const ObMemAttr &attr)
uint64_t payload = 0;
block->hold(&payload);
UNUSED(ATOMIC_FAA(&total_used_, payload));
if (OB_NOT_NULL(malloc_callback)) {
(*malloc_callback)(attr, size);
for (auto *p = malloc_callback->next(); p != malloc_callback; p = p->next()) {
(*p)(attr, size);
}
}
}

return block;
Expand All @@ -117,12 +110,6 @@ void BlockSet::free_block(ABlock *const block)
if (!!block->is_large_) {
free_chunk(chunk);
} else {
if (OB_NOT_NULL(malloc_callback)) {
(*malloc_callback)(attr_, -block->alloc_bytes_);
for (auto *p = malloc_callback->next(); p != malloc_callback; p = p->next()) {
(*p)(attr_, -block->alloc_bytes_);
}
}
ABlock *prev_block = NULL;
ABlock *next_block = NULL;

Expand Down
107 changes: 65 additions & 42 deletions deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "lib/utility/ob_print_utils.h"
#include "lib/alloc/memory_dump.h"
#include "lib/alloc/memory_sanity.h"
#include "lib/alloc/ob_malloc_callback.h"
#include "lib/oblog/ob_log.h"
#include "common/ob_smart_var.h"
#include "rpc/obrpc/ob_rpc_packet.h"
Expand Down Expand Up @@ -401,6 +402,66 @@ void ObTenantCtxAllocator::update_wash_stat(int64_t related_chunks, int64_t bloc
(void)ATOMIC_FAA(&washed_size_, size);
}

void ObTenantCtxAllocator::on_alloc(AObject& obj, const ObMemAttr& attr)
{
if (attr.label_.str_ != nullptr) {
STRNCPY(obj.label_, attr.label_.str_, sizeof(obj.label_));
obj.label_[sizeof(obj.label_) - 1] = '\0';
} else {
MEMSET(obj.label_, '\0', sizeof(obj.label_));
}
if (attr.alloc_extra_info_) {
void *addrs[100] = {nullptr};
ob_backtrace(addrs, ARRAYSIZEOF(addrs));
STATIC_ASSERT(AOBJECT_BACKTRACE_SIZE < sizeof(addrs), "AOBJECT_BACKTRACE_SIZE must be less than addrs!");
MEMCPY(obj.bt(), (char*)addrs, AOBJECT_BACKTRACE_SIZE);
obj.on_malloc_sample_ = true;
}
obj.ignore_version_ = attr.ignore_version() || ObMemVersionNode::tl_ignore_node;
if (!obj.ignore_version_) {
obj.version_ = ObMemVersionNode::tl_node->version_;
}
get_mem_leak_checker().on_alloc(obj, attr);
SANITY_POISON(&obj, obj.nobjs_ * AOBJECT_CELL_BYTES);
SANITY_UNPOISON(obj.data_, obj.alloc_bytes_);
if (OB_NOT_NULL(malloc_callback)) {
const int64_t size = obj.alloc_bytes_;
(*malloc_callback)(attr, size);
for (auto *p = malloc_callback->next(); p != malloc_callback; p = p->next()) {
(*p)(attr, size);
}
}
}

void ObTenantCtxAllocator::on_free(AObject &obj)
{

abort_unless(obj.is_valid());
abort_unless(obj.in_use_);

ABlock *block = obj.block();
abort_unless(block->is_valid());
abort_unless(block->in_use_);
abort_unless(NULL != block->obj_set_);

SANITY_POISON(obj.data_, obj.alloc_bytes_);
get_mem_leak_checker().on_free(obj);

IBlockMgr *blk_mgr = block->obj_set_->get_block_mgr();
abort_unless(NULL != blk_mgr);

int64_t tenant_id = blk_mgr->get_tenant_id();
int64_t ctx_id = blk_mgr->get_ctx_id();
ObMemAttr attr(tenant_id, obj.label_, ctx_id);
if (OB_NOT_NULL(malloc_callback)) {
const int64_t size = obj.alloc_bytes_;
(*malloc_callback)(attr, -size);
for (auto *p = malloc_callback->next(); p != malloc_callback; p = p->next()) {
(*p)(attr, -size);
}
}
}

template <typename T>
void* ObTenantCtxAllocator::common_realloc(const void *ptr, const int64_t size,
const ObMemAttr &attr, ObTenantCtxAllocator& ta,
Expand All @@ -417,12 +478,7 @@ void* ObTenantCtxAllocator::common_realloc(const void *ptr, const int64_t size,
bool is_errsim = false;
if (NULL != ptr) {
obj = reinterpret_cast<AObject*>((char*)ptr - AOBJECT_HEADER_SIZE);
abort_unless(obj->is_valid());
abort_unless(obj->in_use_);
abort_unless(obj->block()->is_valid());
abort_unless(obj->block()->in_use_);
SANITY_POISON(obj->data_, obj->alloc_bytes_);
get_mem_leak_checker().on_free(*obj);
on_free(*obj);
}

#ifdef ERRSIM
Expand Down Expand Up @@ -459,27 +515,8 @@ void* ObTenantCtxAllocator::common_realloc(const void *ptr, const int64_t size,
}

if (obj != NULL) {
if (inner_attr.label_.str_ != nullptr) {
STRNCPY(obj->label_, inner_attr.label_.str_, sizeof(obj->label_));
obj->label_[sizeof(obj->label_) - 1] = '\0';
} else {
MEMSET(obj->label_, '\0', sizeof(obj->label_));
}
if (sample_allowed) {
void *addrs[100] = {nullptr};
ob_backtrace(addrs, ARRAYSIZEOF(addrs));
STATIC_ASSERT(AOBJECT_BACKTRACE_SIZE < sizeof(addrs), "AOBJECT_BACKTRACE_SIZE must be less than addrs!");
MEMCPY(obj->bt(), (char*)addrs, AOBJECT_BACKTRACE_SIZE);
obj->on_malloc_sample_ = true;
}
obj->ignore_version_ = inner_attr.ignore_version() || ObMemVersionNode::tl_ignore_node;
if (!obj->ignore_version_) {
obj->version_ = ObMemVersionNode::tl_node->version_;
}
on_alloc(*obj, inner_attr);
nptr = obj->data_;
get_mem_leak_checker().on_alloc(*obj, inner_attr);
SANITY_POISON(obj, obj->nobjs_ * AOBJECT_CELL_BYTES);
SANITY_UNPOISON(obj->data_, size);
} else if (TC_REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
#ifdef FATAL_ERROR_HANG
if (g_alloc_failed_ctx().reach_limit_except_ctx() &&
Expand All @@ -506,22 +543,8 @@ void ObTenantCtxAllocator::common_free(void *ptr)
SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range
if (NULL != ptr) {
AObject *obj = reinterpret_cast<AObject*>((char*)ptr - AOBJECT_HEADER_SIZE);
abort_unless(NULL != obj);
abort_unless(obj->MAGIC_CODE_ == AOBJECT_MAGIC_CODE
|| obj->MAGIC_CODE_ == BIG_AOBJECT_MAGIC_CODE);
abort_unless(obj->in_use_);
SANITY_POISON(obj->data_, obj->alloc_bytes_);

get_mem_leak_checker().on_free(*obj);
AChunk *chunk = AChunk::ptr2chunk(obj);
abort_unless(chunk->is_valid());
ABlock *block = chunk->ptr2blk(obj);
abort_unless(block);
abort_unless(block->is_valid());
abort_unless(block->in_use_);
abort_unless(block->obj_set_ != NULL);

ObjectSet *os = block->obj_set_;
on_free(*obj);
ObjectSet *os = obj->block()->obj_set_;
os->free_object(obj);
}
}
3 changes: 3 additions & 0 deletions deps/oblib/src/lib/alloc/ob_tenant_ctx_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ class ReqChunkMgr : public IChunkMgr
}
return ret;
}
private:
static void on_alloc(AObject& obj, const ObMemAttr& attr);
static void on_free(AObject& obj);
public:
template <typename T>
static void* common_realloc(const void *ptr, const int64_t size,
Expand Down
5 changes: 5 additions & 0 deletions deps/oblib/src/lib/allocator/ob_concurrent_fifo_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ void ObConcurrentFIFOAllocator::destroy()
inner_allocator_.destroy();
}

void ObConcurrentFIFOAllocator::purge()
{
inner_allocator_.purge();
}

void ObConcurrentFIFOAllocator::set_label(const lib::ObLabel &label)
{
inner_allocator_.set_label(label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ObConcurrentFIFOAllocator : public common::ObIAllocator
const lib::ObMemAttr &attr,
const int64_t total_limit);
void destroy();
void purge();
public:
void set_label(const lib::ObLabel &label);
void set_attr(const lib::ObMemAttr &attr);
Expand Down
3 changes: 3 additions & 0 deletions deps/oblib/src/lib/allocator/ob_vslice_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class ObVSliceAlloc : public common::ObIAllocator
purge_extra_cached_block(0, true);
bsize_ = 0;
}
void purge() {
purge_extra_cached_block(0);
}
void set_nway(int nway) {
if (nway <= 0) {
nway = 1;
Expand Down
6 changes: 5 additions & 1 deletion deps/oblib/src/lib/mysqlclient/ob_isql_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ class ObISQLConnection
last_set_client_charset_cstr_(NULL),
last_set_connection_charset_cstr_(NULL),
last_set_results_charset_cstr_(NULL),
next_conn_(NULL)
next_conn_(NULL),
check_priv_(false)
{}
virtual ~ObISQLConnection() {
allocator_.reset();
Expand Down Expand Up @@ -265,6 +266,8 @@ class ObISQLConnection
void dblink_unwlock() { dblink_lock_.wlock()->unlock(); }
ObISQLConnection *get_next_conn() { return next_conn_; }
void set_next_conn(ObISQLConnection *conn) { next_conn_ = conn; }
void set_check_priv(bool on) { check_priv_ = on; }
bool is_check_priv() { return check_priv_; }
protected:
bool oracle_mode_;
bool is_inited_; // for oracle dblink, we have to init remote env with some sql
Expand All @@ -283,6 +286,7 @@ class ObISQLConnection
common::ObArenaAllocator allocator_;
obsys::ObRWLock dblink_lock_;
ObISQLConnection *next_conn_; // used in dblink_conn_map_
bool check_priv_;
};

} // end namespace sqlclient
Expand Down
4 changes: 3 additions & 1 deletion deps/oblib/src/lib/ob_define.h
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ const uint64_t COLUMN_GROUP_START_ID = 1000;
const uint64_t DEFAULT_CUSTOMIZED_CG_NUM = 2;
const int64_t OB_CG_NAME_PREFIX_LENGTH = 5; // length of cg prefix like "__cg_"
const int64_t OB_MAX_COLUMN_GROUP_NAME_LENGTH = OB_MAX_COLUMN_NAME_LENGTH * OB_MAX_CHAR_LEN + OB_CG_NAME_PREFIX_LENGTH; //(max_column_name_length(128) * ob_max_char_len(3)) + prefix
const int64_t MAX_NAME_CHAR_LEN = 64;

//Oracle
const int64_t MAX_ORACLE_COMMENT_LENGTH = 4000;

Expand Down Expand Up @@ -1507,7 +1509,7 @@ const char *const OB_MYSQL_OCI_CLIENT_NAME = "OceanBase Connector/C";
const char *const OB_MYSQL_JAVA_CLIENT_MODE_NAME = "__ob_java_client";
const char *const OB_MYSQL_OCI_CLIENT_MODE_NAME = "__ob_libobclient";
const char *const OB_MYSQL_JDBC_CLIENT_MODE_NAME = "__ob_jdbc_client";

const char *const OB_MYSQL_CLIENT_PROXY_USER_NAME = "__ob_client_proxy_user_name";
const char *const OB_MYSQL_CLIENT_ATTRIBUTE_CAPABILITY_FLAG = "__ob_client_attribute_capability_flag";

enum ObClientMode
Expand Down
2 changes: 2 additions & 0 deletions deps/oblib/src/lib/ob_name_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -1119,4 +1119,6 @@
#define N_PRIV_ST_MAKEVALID "_st_makevalid"
#define N_CAN_ACCESS_TRIGGER "can_access_trigger"
#define N_SDO_RELATE "sdo_relate"
#define N_INNER_TABLE_OPTION_PRINTER "inner_table_option_printer"
#define N_INNER_TABLE_SEQUENCE_GETTER "inner_table_sequence_getter"
#endif //OCEANBASE_LIB_OB_NAME_DEF_H_
Loading

0 comments on commit c510185

Please sign in to comment.