add print log for debug that tx_end is mis-set

This commit is contained in:
obdev
2023-04-18 12:11:27 +00:00
committed by ob-robot
parent 8daff3e658
commit 5f55944e51
5 changed files with 20 additions and 21 deletions

View File

@ -3411,5 +3411,17 @@ int ObTablet::set_frozen_for_all_memtables()
return ret; return ret;
} }
void ObTablet::print_memtables_for_table()
{
int ret = OB_SUCCESS;
common::ObSArray<storage::ObITable *> memtables;
if (OB_FAIL(get_memtables(memtables, true))) {
LOG_WARN("failed to get_memtables", K(ret), KPC(this));
} else {
LOG_INFO("memtables print", K(memtables), KPC(this));
}
}
} // namespace storage } // namespace storage
} // namespace oceanbase } // namespace oceanbase

View File

@ -504,6 +504,7 @@ private:
const share::SCN &scn, const share::SCN &scn,
const bool for_replay, const bool for_replay,
const memtable::MemtableRefOp ref_op); const memtable::MemtableRefOp ref_op);
void print_memtables_for_table();
private: private:
static const int32_t TABLET_VERSION = 1; static const int32_t TABLET_VERSION = 1;
@ -651,6 +652,7 @@ int ObTablet::prepare_data(T &multi_source_data_unit, const transaction::ObMulSo
TRANS_LOG(WARN, "invalid args", K(ret), K(multi_source_data_unit)); TRANS_LOG(WARN, "invalid args", K(ret), K(multi_source_data_unit));
} else if (OB_UNLIKELY(multi_source_data_unit.is_tx_end())) { } else if (OB_UNLIKELY(multi_source_data_unit.is_tx_end())) {
TRANS_LOG(INFO, "skip for is_tx_end is true", K(multi_source_data_unit)); TRANS_LOG(INFO, "skip for is_tx_end is true", K(multi_source_data_unit));
print_memtables_for_table();
} else if (FALSE_IT(multi_source_data_unit.set_tx_end(true))) { } else if (FALSE_IT(multi_source_data_unit.set_tx_end(true))) {
} else if (OB_FAIL(save_multi_source_data_unit(&multi_source_data_unit, scn, trans_flags.for_replay_/*for_replay*/, memtable::MemtableRefOp::INC_REF))) { } else if (OB_FAIL(save_multi_source_data_unit(&multi_source_data_unit, scn, trans_flags.for_replay_/*for_replay*/, memtable::MemtableRefOp::INC_REF))) {
TRANS_LOG(WARN, "failed to save multi_source_data", K(ret), K(multi_source_data_unit), K(scn)); TRANS_LOG(WARN, "failed to save multi_source_data", K(ret), K(multi_source_data_unit), K(scn));

View File

@ -951,7 +951,7 @@ int ObTabletBindingHelper::set_scn(ObTabletHandle &handle, const ObMulSourceData
LOG_WARN("failed to get data", K(ret)); LOG_WARN("failed to get data", K(ret));
} else if (OB_UNLIKELY(data.tx_id_ != tx_id)) { } else if (OB_UNLIKELY(data.tx_id_ != tx_id)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
ObTabletCreateDeleteHelper::print_memtables_for_table(handle); handle.get_obj()->print_memtables_for_table();
LOG_WARN("cannot set log ts for unlocked tablet", K(ret), K(tx_id), K(data), "tablet_id", tablet->get_tablet_meta().tablet_id_); LOG_WARN("cannot set log ts for unlocked tablet", K(ret), K(tx_id), K(data), "tablet_id", tablet->get_tablet_meta().tablet_id_);
} else if (OB_UNLIKELY(!data.tx_scn_.is_valid())) { } else if (OB_UNLIKELY(!data.tx_scn_.is_valid())) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
@ -1051,7 +1051,7 @@ int ObTabletBindingHelper::unlock_tablet_binding(ObTabletHandle &handle, const O
} else { } else {
const ObTabletMeta &tablet_meta = tablet->get_tablet_meta(); const ObTabletMeta &tablet_meta = tablet->get_tablet_meta();
LOG_WARN("already unlocked or bug", K(ret), K(tablet_meta), K(scn), K(trans_flags), K(tx_data)); LOG_WARN("already unlocked or bug", K(ret), K(tablet_meta), K(scn), K(trans_flags), K(tx_data));
ObTabletCreateDeleteHelper::print_memtables_for_table(handle); handle.get_obj()->print_memtables_for_table();
} }
} }
return ret; return ret;

View File

@ -639,7 +639,7 @@ int ObTabletCreateDeleteHelper::do_commit_create_tablet(
} else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) { } else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("tx id does not equal", K(ret), K(key), K(trans_flags), K(tx_data)); LOG_WARN("tx id does not equal", K(ret), K(key), K(trans_flags), K(tx_data));
print_memtables_for_table(tablet_handle); tablet_handle.get_obj()->print_memtables_for_table();
} else if (OB_UNLIKELY(ObTabletStatus::CREATING != tx_data.tablet_status_)) { } else if (OB_UNLIKELY(ObTabletStatus::CREATING != tx_data.tablet_status_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("tablet status is not CREATING", K(ret), K(key), K(trans_flags), K(tx_data)); LOG_WARN("tablet status is not CREATING", K(ret), K(key), K(trans_flags), K(tx_data));
@ -924,7 +924,7 @@ int ObTabletCreateDeleteHelper::do_abort_create_tablet(
} else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) { } else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("tx id does not equal", K(ret), K(tablet_id), K(trans_flags), K(tx_data)); LOG_WARN("tx id does not equal", K(ret), K(tablet_id), K(trans_flags), K(tx_data));
print_memtables_for_table(tablet_handle); tablet_handle.get_obj()->print_memtables_for_table();
} else if (OB_UNLIKELY(ObTabletStatus::CREATING != tx_data.tablet_status_)) { } else if (OB_UNLIKELY(ObTabletStatus::CREATING != tx_data.tablet_status_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("tablet status is not CREATING", K(ret), K(tablet_id), K(trans_flags), K(tx_data)); LOG_WARN("tablet status is not CREATING", K(ret), K(tablet_id), K(trans_flags), K(tx_data));
@ -1161,7 +1161,7 @@ int ObTabletCreateDeleteHelper::do_commit_remove_tablet(
} else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) { } else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("tx id does not equal", K(ret), K(key), K(trans_flags), K(tx_data)); LOG_WARN("tx id does not equal", K(ret), K(key), K(trans_flags), K(tx_data));
print_memtables_for_table(tablet_handle); tablet_handle.get_obj()->print_memtables_for_table();
} else if (OB_UNLIKELY(ObTabletStatus::DELETING != tx_data.tablet_status_)) { } else if (OB_UNLIKELY(ObTabletStatus::DELETING != tx_data.tablet_status_)) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("tablet status is not DELETING", K(ret), K(key), K(trans_flags), K(tx_data)); LOG_WARN("tablet status is not DELETING", K(ret), K(key), K(trans_flags), K(tx_data));
@ -1259,7 +1259,7 @@ int ObTabletCreateDeleteHelper::do_abort_remove_tablet(
} else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) { } else if (OB_UNLIKELY(trans_flags.tx_id_ != tx_data.tx_id_)) {
is_valid = false; is_valid = false;
LOG_INFO("tx id does not equal", K(ret), K(key), K(trans_flags), K(tx_data)); LOG_INFO("tx id does not equal", K(ret), K(key), K(trans_flags), K(tx_data));
print_memtables_for_table(tablet_handle); tablet_handle.get_obj()->print_memtables_for_table();
} else if (OB_UNLIKELY(ObTabletStatus::DELETING != tx_data.tablet_status_)) { } else if (OB_UNLIKELY(ObTabletStatus::DELETING != tx_data.tablet_status_)) {
is_valid = false; is_valid = false;
LOG_INFO("tablet status is not DELETING", K(ret), K(key), K(trans_flags), K(tx_data)); LOG_INFO("tablet status is not DELETING", K(ret), K(key), K(trans_flags), K(tx_data));
@ -2559,19 +2559,5 @@ int ObTabletCreateDeleteHelper::prepare_data_for_binding_info(const ObTabletID &
return ret; return ret;
} }
void ObTabletCreateDeleteHelper::print_memtables_for_table(ObTabletHandle &tablet_handle)
{
int ret = OB_SUCCESS;
common::ObSArray<storage::ObITable *> memtables;
if (!tablet_handle.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("tablet_handle is not valid", K(ret), K(tablet_handle));
} else if (OB_FAIL(tablet_handle.get_obj()->get_memtables(memtables, true))) {
LOG_WARN("failed to get_memtables", K(ret), K(tablet_handle));
} else {
LOG_INFO("memtables print", K(memtables), K(tablet_handle));
}
}
} // namespace storage } // namespace storage
} // namespace oceanbase } // namespace oceanbase

View File

@ -150,7 +150,6 @@ public:
static int prepare_data_for_tablet_status(const ObTabletID &tablet_id, const ObLS &ls, const transaction::ObMulSourceDataNotifyArg &trans_flags); static int prepare_data_for_tablet_status(const ObTabletID &tablet_id, const ObLS &ls, const transaction::ObMulSourceDataNotifyArg &trans_flags);
static int prepare_data_for_binding_info(const ObTabletID &tablet_id, const ObLS &ls, const transaction::ObMulSourceDataNotifyArg &trans_flags); static int prepare_data_for_binding_info(const ObTabletID &tablet_id, const ObLS &ls, const transaction::ObMulSourceDataNotifyArg &trans_flags);
static void print_memtables_for_table(ObTabletHandle &tablet_handle);
private: private:
static int verify_tablets_absence( static int verify_tablets_absence(
const obrpc::ObBatchCreateTabletArg &arg, const obrpc::ObBatchCreateTabletArg &arg,