Add logs to debug memtable and callback

This commit is contained in:
obdev 2022-12-29 08:08:10 +00:00 committed by ob-robot
parent 7fbad9b552
commit 4996ffad0b
4 changed files with 37 additions and 6 deletions

View File

@ -674,8 +674,14 @@ bool ObMvccRowCallback::is_logging_blocked() const
{
const bool is_blocked = memtable_->get_logging_blocked();
if (is_blocked) {
TRANS_LOG(WARN, "block logging", K(is_blocked), KP(memtable_),
K(memtable_->get_key().get_tablet_id()));
int ret = OB_SUCCESS;
ObTransID trans_id;
if (OB_FAIL(get_trans_id(trans_id))) {
TRANS_LOG(WARN, "fail to get trans_id", K(ret));
} else {
TRANS_LOG(WARN, "block logging", K(is_blocked), KP(memtable_),
K(memtable_->get_key().get_tablet_id()), K(trans_id));
}
}
return is_blocked;
}

View File

@ -412,7 +412,8 @@ class ObTxEndFunctor : public ObITxCallbackFunctor
{
public:
ObTxEndFunctor(bool is_commit)
: is_commit_(is_commit) {}
: is_commit_(is_commit),
need_print_(false) {}
virtual int operator()(ObITransCallback *callback) override
{
@ -434,15 +435,37 @@ public:
TRANS_LOG(ERROR, "trans abort failed", KPC(callback));
} else {
need_remove_callback_ = true;
print_callback_if_logging_block_(callback);
}
return ret;
}
VIRTUAL_TO_STRING_KV(K_(is_commit));
VIRTUAL_TO_STRING_KV(K_(is_commit), K_(need_print));
private:
int print_callback_if_logging_block_(ObITransCallback *callback)
{
// print callback list
// if a callback has not been submitted log and
// the memtable linked to it is logging_blocked
int ret = OB_SUCCESS;
if (!is_commit_ &&
!need_print_ &&
callback->need_submit_log() &&
callback->need_fill_redo() &&
callback->is_logging_blocked()) {
need_print_ = true;
}
if (need_print_) {
callback->print_callback();
}
return ret;
}
private:
const bool is_commit_;
bool need_print_;
};
class ObCleanUnlogCallbackFunctor : public ObITxCallbackFunctor

View File

@ -225,6 +225,7 @@ int ObTabletMemtableMgr::create_memtable(const SCN clog_checkpoint_scn,
int64_t unsynced_cnt = last_frozen_memtable->get_unsynced_cnt();
if (write_ref > 0 || unsubmitted_cnt > 0) {
memtable->set_logging_blocked();
TRANS_LOG(INFO, "set logging_block", KPC(last_frozen_memtable), KPC(memtable));
}
if (write_ref > 0 || unsynced_cnt > 0) {
last_frozen_memtable->set_resolve_active_memtable_left_boundary(false);
@ -235,7 +236,7 @@ int ObTabletMemtableMgr::create_memtable(const SCN clog_checkpoint_scn,
0 == unsubmitted_cnt &&
0 == unsynced_cnt)) {
last_frozen_memtable->resolve_right_boundary();
TRANS_LOG(INFO, "[resolve_right_boundary] create_memtable", K(for_replay), K(ls_id), KPC(last_frozen_memtable));
TRANS_LOG(INFO, "[resolve_right_boundary] last_frozen_memtable in create_memtable", K(for_replay), K(ls_id), KPC(last_frozen_memtable));
if (memtable != last_frozen_memtable) {
const SCN &new_start_scn = MAX(last_frozen_memtable->get_end_scn(), last_frozen_memtable->get_migration_clog_checkpoint_scn());
memtable->resolve_left_boundary(new_start_scn);

View File

@ -1221,7 +1221,8 @@ void ObTenantFreezer::log_frozen_memstore_info_if_need_(const ObTenantFreezeCtx
{
int ret = OB_SUCCESS;
ObTenantMemstoreAllocator *tenant_allocator = NULL;
if (ctx.total_memstore_hold_ > ctx.memstore_freeze_trigger_) {
if (ctx.total_memstore_hold_ > ctx.memstore_freeze_trigger_ ||
ctx.active_memstore_used_ > ctx.memstore_freeze_trigger_) {
// There is an unreleased memstable
LOG_INFO("[TenantFreezer] tenant have inactive memstores",
K(ctx.active_memstore_used_),