admin: fix admin check table false alarm in the case that index contains pkIsHandle column (#7317)

This commit is contained in:
winkyao
2018-08-09 17:37:47 +08:00
committed by GitHub
parent 22519aefc2
commit 702a116a5e
2 changed files with 10 additions and 1 deletions

View File

@ -246,6 +246,11 @@ func (s *testSuite) TestAdmin(c *C) {
// For "checksum_with_index", we have two checksums, so the result will be 1^1 = 0.
// For "checksum_without_index", we only have one checksum, so the result will be 1.
res.Sort().Check(testkit.Rows("test checksum_with_index 0 2 2", "test checksum_without_index 1 1 1"))
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(a bigint unsigned primary key, b int, c int, index idx(a, b));")
tk.MustExec("insert into t values(1, 1, 1)")
tk.MustExec("admin check table t")
}
func (s *testSuite) fillData(tk *testkit.TestKit, table string) {

View File

@ -628,7 +628,11 @@ func iterRecords(sessCtx sessionctx.Context, retriever kv.Retriever, t table.Tab
data := make([]types.Datum, 0, len(cols))
for _, col := range cols {
if col.IsPKHandleColumn(t.Meta()) {
data = append(data, types.NewIntDatum(handle))
if mysql.HasUnsignedFlag(col.Flag) {
data = append(data, types.NewUintDatum(uint64(handle)))
} else {
data = append(data, types.NewIntDatum(handle))
}
} else {
data = append(data, rowMap[col.ID])
}