Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckRecordAndIndex can panic #29469

Closed
ekexium opened this issue Nov 4, 2021 · 2 comments
Closed

CheckRecordAndIndex can panic #29469

ekexium opened this issue Nov 4, 2021 · 2 comments
Labels
severity/major sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@ekexium
Copy link
Contributor

ekexium commented Nov 4, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

When there are data-index inconsistency, run admin check table.

2. What did you expect to see? (Required)

Don't panic.

3. What did you see instead (Required)

TiDB panics.

goroutine 8061 [running]:
github.com/pingcap/tidb/server.(*clientConn).Run.func1(0x6ec37b0, 0xc0024de180, 0xc001942000)
	/Users/ekexium/code/tidb/server/conn.go:918 +0xf5
panic(0x65664c0, 0x89a1110)
	/usr/local/Cellar/go/1.16.5/libexec/src/runtime/panic.go:965 +0x1b9
github.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1(0xc00212e000, 0xc002af0af8, 0xc002af0ad8)
	/Users/ekexium/code/tidb/executor/adapter.go:334 +0x4d4
panic(0x65664c0, 0x89a1110)
	/usr/local/Cellar/go/1.16.5/libexec/src/runtime/panic.go:965 +0x1b9
github.com/pingcap/tidb/util/admin.CheckRecordAndIndex.func1.2(0xc002389200, 0xc0022d6dc0, 0x5, 0x5)
	/Users/ekexium/code/tidb/util/admin/admin.go:384 +0xc2
github.com/pingcap/tidb/util/logutil/consistency.(*Reporter).ReportAdminCheckInconsistent(0xc002389230, 0x6ec37b0, 0xc001d627e0, 0x6ef57b8, 0x87c2330, 0xc002389200, 0xc0023891d0, 0x6ef57b8, 0x87c2330)
	/Users/ekexium/code/tidb/util/logutil/consistency/reporter.go:270 +0xda5
github.com/pingcap/tidb/util/admin.CheckRecordAndIndex.func2(0x6ef57b8, 0x87c2330, 0xc0023601b0, 0x2, 0x2, 0xc0029d7c00, 0x2, 0x2, 0xc00127bd50, 0x89b64c0, ...)
	/Users/ekexium/code/tidb/util/admin/admin.go:424 +0x54b
github.com/pingcap/tidb/util/admin.iterRecords(0x6f0ab38, 0xc0020c8600, 0x9ec7e60, 0xc0020c8610, 0x6efb3b0, 0xc001888000, 0xc001fadcf8, 0x13, 0x13, 0xc0029d7c00, ...)
	/Users/ekexium/code/tidb/util/admin/admin.go:495 +0x8a5
github.com/pingcap/tidb/util/admin.CheckRecordAndIndex(0x6ec37b0, 0xc001d627e0, 0x6f0ab38, 0xc0020c8600, 0x6f06730, 0xc0020c8610, 0x6efb3b0, 0xc001888000, 0x6eec5b8, 0xc0011ab900, ...)
	/Users/ekexium/code/tidb/util/admin/admin.go:436 +0x438
github.com/pingcap/tidb/executor.(*CheckTableExec).checkTableRecord(0xc0021f05a0, 0x6ec37b0, 0xc001d627e0, 0x1, 0xc001ff2240, 0x5)
	/Users/ekexium/code/tidb/executor/executor.go:805 +0x48a
github.com/pingcap/tidb/executor.(*CheckTableExec).Next(0xc0021f05a0, 0x6ec37b0, 0xc001d627e0, 0xc002398dc0, 0x0, 0x0)
	/Users/ekexium/code/tidb/executor/executor.go:762 +0x5e5
github.com/pingcap/tidb/executor.Next(0x6ec37b0, 0xc001d627e0, 0x6ec8178, 0xc0021f05a0, 0xc002398dc0, 0x0, 0x0)
	/Users/ekexium/code/tidb/executor/executor.go:286 +0x2de
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor(0xc00212e000, 0x6ec37b0, 0xc001d627e0, 0x6ec8178, 0xc0021f05a0, 0x0, 0x0, 0x0, 0x0)
	/Users/ekexium/code/tidb/executor/adapter.go:581 +0x33c
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay(0xc00212e000, 0x6ec37b0, 0xc001d627e0, 0x6ec8178, 0xc0021f05a0, 0x8a3f500, 0x6ec3701, 0x0, 0x0, 0x0, ...)
	/Users/ekexium/code/tidb/executor/adapter.go:462 +0x1e5
github.com/pingcap/tidb/executor.(*ExecStmt).Exec(0xc00212e000, 0x6ec37b0, 0xc001d627e0, 0x0, 0x0, 0x0, 0x0)
	/Users/ekexium/code/tidb/executor/adapter.go:411 +0x78e
github.com/pingcap/tidb/session.runStmt(0x6ec37b0, 0xc001d62450, 0xc0020c8600, 0x6edc910, 0xc00212e000, 0x0, 0x0, 0x0, 0x0)
	/Users/ekexium/code/tidb/session/session.go:1674 +0x37f
github.com/pingcap/tidb/session.(*session).ExecuteStmt(0xc0020c8600, 0x6ec37b0, 0xc001d62450, 0x6ee0248, 0xc001315e40, 0x0, 0x0, 0x0, 0x0)
	/Users/ekexium/code/tidb/session/session.go:1568 +0xb31
github.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt(0xc0024deb40, 0x6ec37b0, 0xc001d62450, 0x6ee0248, 0xc001315e40, 0xc0021b5da0, 0x6ec37b0, 0xc001d62450, 0xc002af10d0)
	/Users/ekexium/code/tidb/server/driver_tidb.go:219 +0x6b
github.com/pingcap/tidb/server.(*clientConn).handleStmt(0xc001942000, 0x6ec3708, 0xc001d62450, 0x6ee0248, 0xc001315e40, 0x8a72570, 0x0, 0x0, 0x1, 0x0, ...)
	/Users/ekexium/code/tidb/server/conn.go:1843 +0x1d1
github.com/pingcap/tidb/server.(*clientConn).handleQuery(0xc001942000, 0x6ec3708, 0xc002c0e300, 0xc0028d3921, 0x17, 0x0, 0x0)
	/Users/ekexium/code/tidb/server/conn.go:1707 +0x492
github.com/pingcap/tidb/server.(*clientConn).dispatch(0xc001942000, 0x6ec3708, 0xc002c0e300, 0xc0028d3920, 0x18, 0x17, 0x0, 0x0)
	/Users/ekexium/code/tidb/server/conn.go:1217 +0xafd
github.com/pingcap/tidb/server.(*clientConn).Run(0xc001942000, 0x6ec37b0, 0xc0024de180)
	/Users/ekexium/code/tidb/server/conn.go:979 +0x296

4. What is your TiDB version? (Required)

The development branch ft-data-consistency.

@ekexium ekexium added the type/bug The issue is confirmed as a bug. label Nov 4, 2021
ekexium added a commit to ekexium/tidb that referenced this issue Nov 4, 2021
Signed-off-by: ekexium <ekexium@gmail.com>
@tiancaiamao tiancaiamao added sig/transaction SIG:Transaction and removed sig/sql-infra SIG: SQL Infra labels Nov 5, 2021
ekexium added a commit that referenced this issue Nov 10, 2021
* close #29469; fix: mistakenly shadowed name idx

Signed-off-by: ekexium <ekexium@gmail.com>

* test admin check table when uniqueness is violated

Signed-off-by: ekexium <ekexium@gmail.com>
@youjiali1995
Copy link
Contributor

Fixed by #29470

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

4 participants