[4377] add diagnose info for 4377 of index lookup

This commit is contained in:
Handora
2023-04-04 09:44:52 +00:00
committed by ob-robot
parent d27b7ab7a2
commit fea5ff60a9
6 changed files with 81 additions and 5 deletions

View File

@ -227,6 +227,23 @@ int ObMultipleGetMerge::inner_get_next_row(ObDatumRow &row)
STORAGE_LOG(DEBUG, "Success to merge get row, ", KP(this), K(fuse_row), K(get_row_range_idx_), K(fuse_row.group_idx_));
}
break;
} else {
// When the index lookups the rowkeys from the main table, it should exists
// and if we find that it does not exist, there must be an anomaly
if (GCONF.enable_defensive_check()
&& access_ctx_->query_flag_.is_lookup_for_4377()) {
ret = OB_ERR_DEFENSIVE_CHECK;
ObString func_name = ObString::make_string("[index lookup]ObMultipleGetMerge::inner_get_next_row");
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
K(rowkeys_),
K(get_row_range_idx_ - 1),
K(rowkeys_->at(get_row_range_idx_ - 1)),
K(fuse_row),
KPC(access_ctx_->store_ctx_));
dump_table_statistic_for_4377();
dump_tx_statistic_for_4377(access_ctx_->store_ctx_);
}
}
}
}

View File

@ -29,6 +29,7 @@
#include "sql/engine/expr/ob_expr_lob_utils.h"
#include "storage/ob_tenant_tablet_stat_mgr.h"
#include "storage/tablet/ob_tablet.h"
#include "storage/tx/ob_trans_part_ctx.h"
namespace oceanbase
{
@ -1388,5 +1389,40 @@ void ObMultipleMerge::reuse_lob_locator()
lob_reader_.reuse();
}
void ObMultipleMerge::dump_tx_statistic_for_4377(ObStoreCtx *store_ctx)
{
int ret = OB_SUCCESS;
LOG_ERROR("==================== Start trx info ====================");
if (NULL != store_ctx) {
store_ctx->force_print_trace_log();
if (NULL != store_ctx->mvcc_acc_ctx_.tx_ctx_) {
LOG_ERROR("Dump trx info", K(ret), KPC(store_ctx->mvcc_acc_ctx_.tx_ctx_));
if (NULL != store_ctx->mvcc_acc_ctx_.mem_ctx_) {
// TODO(handora.qc): Shall we dump the row?
store_ctx->mvcc_acc_ctx_.mem_ctx_->print_callbacks();
}
} else {
LOG_ERROR("no some of the trx info", K(ret), KPC(store_ctx));
}
} else {
LOG_ERROR("no trx info completely", K(ret));
}
LOG_ERROR("==================== End trx info ====================");
}
void ObMultipleMerge::dump_table_statistic_for_4377()
{
int ret = OB_SUCCESS;
int64_t table_idx = -1;
LOG_ERROR("==================== Start table info ====================");
for (table_idx = tables_.count() - 1; table_idx >= 0; --table_idx) {
ObITable *table = tables_.at(table_idx);
LOG_ERROR("Dump table info", K(ret), KPC(table));
}
LOG_ERROR("==================== End table info ====================");
}
}
}

View File

@ -82,6 +82,9 @@ protected:
blocksstable::ObDatumRow &projected_row);
void reset_iter_array();
void reuse_iter_array();
void dump_tx_statistic_for_4377(ObStoreCtx *store_ctx);
void dump_table_statistic_for_4377();
private:
int get_next_normal_row(blocksstable::ObDatumRow *&row);
int get_next_normal_rows(int64_t &count, int64_t capacity);

View File

@ -352,6 +352,26 @@ int ObSingleMerge::inner_get_next_row(ObDatumRow &row)
access_ctx_->defensive_check_record_.reset();
*/
#endif
// When the index lookups the rowkeys from the main table, it should exists
// and if we find that it does not exist, there must be an anomaly
if (GCONF.enable_defensive_check()
&& access_ctx_->query_flag_.is_lookup_for_4377()
&& OB_ITER_END == ret) {
ret = OB_ERR_DEFENSIVE_CHECK;
ObString func_name = ObString::make_string("[index lookup]ObSingleMerge::inner_get_next_row");
LOG_USER_ERROR(OB_ERR_DEFENSIVE_CHECK, func_name.length(), func_name.ptr());
LOG_DBA_ERROR(OB_ERR_DEFENSIVE_CHECK, "msg", "Fatal Error!!! Catch a defensive error!", K(ret),
K(have_uncommited_row),
K(enable_fuse_row_cache),
K(read_snapshot_version),
KPC(read_info),
KPC(access_ctx_->store_ctx_),
K(tables_));
dump_table_statistic_for_4377();
dump_tx_statistic_for_4377(access_ctx_->store_ctx_);
}
rowkey_ = NULL;
} else {
ret = OB_ITER_END;