Skip to content

Commit

Permalink
admin: fix admin check byte compare bug
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 committed Oct 15, 2018
1 parent 4de8887 commit 3bb6889
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,15 @@ func (s *testSuite) TestAdmin(c *C) {
tk.MustExec("alter table t1 add index idx_i(i);")
tk.MustExec("alter table t1 add index idx_m(a,c,d,e,f,g,h,i,j);")
tk.MustExec("admin check table t1;")

tk.MustExec("drop table if exists t1;")
tk.MustExec("CREATE TABLE t1 (c1 int);")
tk.MustExec("INSERT INTO t1 SET c1 = 1;")
tk.MustExec("ALTER TABLE t1 ADD COLUMN cc1 CHAR(36) NULL DEFAULT '';")
tk.MustExec("ALTER TABLE t1 ADD COLUMN cc2 VARCHAR(36) NULL DEFAULT ''")
tk.MustExec("ALTER TABLE t1 ADD INDEX idx1 (cc1);")
tk.MustExec("ALTER TABLE t1 ADD INDEX idx2 (cc2);")
tk.MustExec("admin check table t1;")
}

func (s *testSuite) fillData(tk *testkit.TestKit, table string) {
Expand Down
5 changes: 3 additions & 2 deletions util/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,13 @@ func compareDatumSlice(sc *stmtctx.StatementContext, val1s, val2s []types.Datum)
return false
}
for i, v := range val1s {
if v.Kind() == types.KindMysqlDecimal {
switch v.Kind() {
case types.KindMysqlDecimal, types.KindBytes:
res, err := v.CompareDatum(sc, &val2s[i])
if err != nil || res != 0 {
return false
}
} else {
default:
if !reflect.DeepEqual(v, val2s[i]) {
return false
}
Expand Down

0 comments on commit 3bb6889

Please sign in to comment.