[CP] fix core about ObTenantTabletStatMgr
This commit is contained in:
@ -511,6 +511,7 @@ int ObTenantTabletStatMgr::init(const int64_t tenant_id)
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
const bool repeat = true;
|
const bool repeat = true;
|
||||||
|
int64_t bucket_num = DEFAULT_BUCKET_NUM;
|
||||||
|
|
||||||
if (IS_INIT) {
|
if (IS_INIT) {
|
||||||
ret = OB_INIT_TWICE;
|
ret = OB_INIT_TWICE;
|
||||||
@ -519,7 +520,8 @@ int ObTenantTabletStatMgr::init(const int64_t tenant_id)
|
|||||||
LOG_WARN("failed to init tablet stream pool", K(ret));
|
LOG_WARN("failed to init tablet stream pool", K(ret));
|
||||||
} else if (OB_FAIL(stream_map_.create(DEFAULT_BUCKET_NUM, ObMemAttr(tenant_id, "TabletStats")))) {
|
} else if (OB_FAIL(stream_map_.create(DEFAULT_BUCKET_NUM, ObMemAttr(tenant_id, "TabletStats")))) {
|
||||||
LOG_WARN("failed to create TabletStats", K(ret));
|
LOG_WARN("failed to create TabletStats", K(ret));
|
||||||
} else if (OB_FAIL(bucket_lock_.init(DEFAULT_BUCKET_NUM, ObLatchIds::DEFAULT_BUCKET_LOCK,
|
} else if (FALSE_IT(bucket_num = stream_map_.bucket_count())) {
|
||||||
|
} else if (OB_FAIL(bucket_lock_.init(bucket_num, ObLatchIds::DEFAULT_BUCKET_LOCK,
|
||||||
ObMemAttr(tenant_id, "TabStatMgrLock")))) {
|
ObMemAttr(tenant_id, "TabStatMgrLock")))) {
|
||||||
LOG_WARN("failed to init bucket lock", K(ret));
|
LOG_WARN("failed to init bucket lock", K(ret));
|
||||||
} else if (OB_FAIL(TG_CREATE_TENANT(lib::TGDefIDs::TabletStatRpt, report_tg_id_))) {
|
} else if (OB_FAIL(TG_CREATE_TENANT(lib::TGDefIDs::TabletStatRpt, report_tg_id_))) {
|
||||||
@ -803,6 +805,8 @@ void ObTenantTabletStatMgr::process_stats()
|
|||||||
|
|
||||||
void ObTenantTabletStatMgr::refresh_all(const int64_t step)
|
void ObTenantTabletStatMgr::refresh_all(const int64_t step)
|
||||||
{
|
{
|
||||||
|
ObBucketWLockAllGuard lock_guard(bucket_lock_);
|
||||||
|
|
||||||
TabletStreamMap::iterator iter = stream_map_.begin();
|
TabletStreamMap::iterator iter = stream_map_.begin();
|
||||||
for ( ; iter != stream_map_.end(); ++iter) {
|
for ( ; iter != stream_map_.end(); ++iter) {
|
||||||
for (int64_t i = 0; i < step; ++i) {
|
for (int64_t i = 0; i < step; ++i) {
|
||||||
|
@ -355,7 +355,13 @@ private:
|
|||||||
private:
|
private:
|
||||||
typedef common::hash::ObHashMap<ObTabletStatKey,
|
typedef common::hash::ObHashMap<ObTabletStatKey,
|
||||||
ObTabletStreamNode *,
|
ObTabletStreamNode *,
|
||||||
common::hash::NoPthreadDefendMode> TabletStreamMap;
|
common::hash::NoPthreadDefendMode,
|
||||||
|
common::hash::hash_func<ObTabletStatKey>,
|
||||||
|
common::hash::equal_to<ObTabletStatKey>,
|
||||||
|
common::hash::SimpleAllocer<typename common::hash::HashMapTypes<ObTabletStatKey, ObTabletStreamNode *>::AllocType>,
|
||||||
|
common::hash::NormalPointer,
|
||||||
|
common::ObMalloc,
|
||||||
|
1 /*disable auto expansion */> TabletStreamMap;
|
||||||
|
|
||||||
static constexpr int64_t TABLET_STAT_PROCESS_INTERVAL = 5 * 1000L * 1000L; //5s
|
static constexpr int64_t TABLET_STAT_PROCESS_INTERVAL = 5 * 1000L * 1000L; //5s
|
||||||
static constexpr int64_t CHECK_INTERVAL = 120L * 1000L * 1000L; //120s
|
static constexpr int64_t CHECK_INTERVAL = 120L * 1000L * 1000L; //120s
|
||||||
@ -363,7 +369,7 @@ private:
|
|||||||
static constexpr int64_t CHECK_SYS_STAT_INTERVAL = 10 * 1000LL * 1000LL; //10s
|
static constexpr int64_t CHECK_SYS_STAT_INTERVAL = 10 * 1000LL * 1000LL; //10s
|
||||||
static constexpr int32_t DEFAULT_MAX_FREE_STREAM_CNT = 5000;
|
static constexpr int32_t DEFAULT_MAX_FREE_STREAM_CNT = 5000;
|
||||||
static constexpr int32_t DEFAULT_UP_LIMIT_STREAM_CNT = 20000;
|
static constexpr int32_t DEFAULT_UP_LIMIT_STREAM_CNT = 20000;
|
||||||
static constexpr int32_t DEFAULT_BUCKET_NUM = 1000;
|
static constexpr int32_t DEFAULT_BUCKET_NUM = 1543; // should be a prime to guarantee the bucket nums of hashmap and bucketlock are equal
|
||||||
static constexpr int32_t DEFAULT_MAX_PENDING_CNT = 40000;
|
static constexpr int32_t DEFAULT_MAX_PENDING_CNT = 40000;
|
||||||
static constexpr int32_t MAX_REPORT_RETRY_CNT = 5;
|
static constexpr int32_t MAX_REPORT_RETRY_CNT = 5;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user