Skip to content

Should log table and index name when data inconsistencies occour #24643

@youjiali1995

Description

@youjiali1995

Bug Report

TiDB will report and log an error message if it detects data inconsistencies, but it only logs the index name. We don't know the table name! For example,

tidb/executor/distsql.go

Lines 1215 to 1223 in b7c22aa

logutil.Logger(ctx).Error("inconsistent index handles", zap.String("index", w.idxLookup.index.Name.O),
zap.Int("index_cnt", handleCnt), zap.Int("table_cnt", len(task.rows)),
zap.String("missing_handles", fmt.Sprint(GetLackHandles(task.handles, obtainedHandlesMap))),
zap.String("total_handles", fmt.Sprint(task.handles)))
// table scan in double read can never has conditions according to convertToIndexScan.
// if this table scan has no condition, the number of rows it returns must equal to the length of handles.
return errors.Errorf("inconsistent index %s handle count %d isn't equal to value count %d",
w.idxLookup.index.Name.O, handleCnt, len(task.rows))

TiDB should log enough information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions