remove memtable stat
This commit is contained in:
parent
0a76ae999f
commit
9da5b3061d
@ -243,13 +243,6 @@ int ObSignalHandle::deal_signals(int signum)
|
||||
ObTenantMemoryPrinter::get_instance().print_tenant_usage();
|
||||
break;
|
||||
}
|
||||
case 64: {
|
||||
// Print memtable stat. By yijun.fyj.
|
||||
if (OB_FAIL(memtable::ObMemtableStat::get_instance().print_stat())) {
|
||||
LOG_WARN("Print memtable stat error", K(ret));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOG_WARN("Ignore unknown signal", K(signum));
|
||||
break;
|
||||
|
@ -181,7 +181,6 @@ int ObMemtable::init(const ObITable::TableKey &table_key,
|
||||
TRANS_LOG(WARN, "failed to set_table_key", K(ret), K(table_key));
|
||||
} else {
|
||||
ls_handle_ = ls_handle;
|
||||
ObMemtableStat::get_instance().register_memtable(this);
|
||||
if (table_key.get_tablet_id().is_sys_tablet()) {
|
||||
mode_ = lib::Worker::CompatMode::MYSQL;
|
||||
} else {
|
||||
@ -232,8 +231,6 @@ void ObMemtable::destroy()
|
||||
}
|
||||
STORAGE_LOG(INFO, "memtable destroyed", K(*this));
|
||||
time_guard.click();
|
||||
ObMemtableStat::get_instance().unregister_memtable(this);
|
||||
time_guard.click();
|
||||
ObTenantFreezer *freezer = nullptr;
|
||||
freezer = MTL(ObTenantFreezer *);
|
||||
if (OB_SUCCESS != freezer->unset_tenant_slow_freeze(tablet_id)) {
|
||||
@ -2416,77 +2413,6 @@ bool ObMemtable::has_multi_source_data_unit(const MultiSourceDataUnitType type)
|
||||
}
|
||||
|
||||
|
||||
ObMemtableStat::ObMemtableStat()
|
||||
: lock_(common::ObLatchIds::MEMTABLE_STAT_LOCK),
|
||||
memtables_()
|
||||
{
|
||||
memtables_.set_attr(SET_USE_500("MemTables"));
|
||||
}
|
||||
|
||||
ObMemtableStat::~ObMemtableStat()
|
||||
{}
|
||||
|
||||
ObMemtableStat &ObMemtableStat::get_instance()
|
||||
{
|
||||
static ObMemtableStat s_instance;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
int ObMemtableStat::register_memtable(ObMemtable *memtable)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSpinLockGuard guard(lock_);
|
||||
if (OB_ISNULL(memtable)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
TRANS_LOG(WARN, "invalid argument", K(memtable));
|
||||
} else if (OB_FAIL(memtables_.push_back(memtable))) {
|
||||
TRANS_LOG(ERROR, "err push memtable ptr", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMemtableStat::unregister_memtable(ObMemtable *memtable)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSpinLockGuard guard(lock_);
|
||||
bool done = false;
|
||||
if (OB_ISNULL(memtable)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
TRANS_LOG(WARN, "invalid argument", K(memtable));
|
||||
} else {
|
||||
for (int64_t idx = 0, cnt = memtables_.size();
|
||||
(OB_SUCC(ret)) && !done && (idx < cnt);
|
||||
++idx) {
|
||||
if (memtable == memtables_.at(idx)) {
|
||||
memtables_.at(idx) = memtables_.at(cnt - 1);
|
||||
if (OB_FAIL(memtables_.remove(cnt - 1))) {
|
||||
TRANS_LOG(WARN, "memtable remove fail", K(ret), K(idx));
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!done && OB_SUCCESS == ret) {
|
||||
ret = OB_ENTRY_NOT_EXIST;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMemtableStat::print_stat()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSpinLockGuard guard(lock_);
|
||||
TRANS_LOG(INFO, "[memtable stat]", "memtable_cnt", memtables_.size());
|
||||
for (int64_t idx = 0, cnt = memtables_.size(); OB_SUCC(ret) && (idx < cnt); ++idx) {
|
||||
if (OB_FAIL(memtables_.at(idx)->print_stat())) {
|
||||
TRANS_LOG(ERROR, "print memtable stat fail", K(ret));
|
||||
}
|
||||
}
|
||||
TRANS_LOG(INFO, "[memtable stat] end.");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int RowHeaderGetter::get()
|
||||
{
|
||||
int ret = OB_ENTRY_NOT_EXIST;
|
||||
|
@ -693,29 +693,6 @@ int ObMemtable::get_multi_source_data_unit_list(
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef ObMemtable ObMemStore;
|
||||
|
||||
/*
|
||||
* Print memtable statistics when receiving a signal.
|
||||
* For debug use.
|
||||
*/
|
||||
class ObMemtableStat
|
||||
{
|
||||
public:
|
||||
ObMemtableStat();
|
||||
virtual ~ObMemtableStat();
|
||||
static ObMemtableStat &get_instance();
|
||||
public:
|
||||
int register_memtable(ObMemtable *memtable);
|
||||
int unregister_memtable(ObMemtable *memtable);
|
||||
public:
|
||||
int print_stat();
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObMemtableStat);
|
||||
ObSpinLock lock_;
|
||||
ObArray<ObMemtable *> memtables_;
|
||||
};
|
||||
|
||||
class RowHeaderGetter
|
||||
{
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user