Skip to content

Commit

Permalink
ddl: correct the usage of json.Unmarshal in job.DecodeArgs (pingcap#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored Jun 17, 2020
1 parent 45309d1 commit 4bd4090
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ddl/delete_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func insertJobIntoDeleteRangeTable(ctx sessionctx.Context, job *model.Job) error
// The startKey here is for compatibility with previous versions, old version did not endKey so don't have to deal with.
var startKey kv.Key
var physicalTableIDs []int64
if err := job.DecodeArgs(startKey, &physicalTableIDs); err != nil {
if err := job.DecodeArgs(&startKey, &physicalTableIDs); err != nil {
return errors.Trace(err)
}
if len(physicalTableIDs) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e
github.com/pingcap/kvproto v0.0.0-20200317043902-2838e21ca222
github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd
github.com/pingcap/parser v3.1.2-0.20200507065358-a5eade012146+incompatible
github.com/pingcap/parser v3.1.2-0.20200616054905-d170b9f6100a+incompatible
github.com/pingcap/pd/v3 v3.1.0-beta.2.0.20200312100832-1206736bd050
github.com/pingcap/tidb-tools v4.0.0-beta.1.0.20200317092225-ed6b2a87af54+incompatible
github.com/pingcap/tipb v0.0.0-20200426072603-ce17d2d03251
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ github.com/pingcap/kvproto v0.0.0-20200317043902-2838e21ca222/go.mod h1:IOdRDPLy
github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8=
github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd h1:CV3VsP3Z02MVtdpTMfEgRJ4T9NGgGTxdHpJerent7rM=
github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8=
github.com/pingcap/parser v3.1.2-0.20200507065358-a5eade012146+incompatible h1:yIsvQ1+8J1ZEPkOMRIThrSn3UPyD2iiHXBi0Z3uOmXI=
github.com/pingcap/parser v3.1.2-0.20200507065358-a5eade012146+incompatible/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA=
github.com/pingcap/parser v3.1.2-0.20200616054905-d170b9f6100a+incompatible h1:XJonY7WQGZ30C+J9j0nNIk/MiZmT+IB8l2YJgHsT5VU=
github.com/pingcap/parser v3.1.2-0.20200616054905-d170b9f6100a+incompatible/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA=
github.com/pingcap/pd/v3 v3.1.0-beta.2.0.20200312100832-1206736bd050 h1:mxPdR0pxnUcRfRGX2JnaLyAd9SZWeR42SzvMp4Zv3YI=
github.com/pingcap/pd/v3 v3.1.0-beta.2.0.20200312100832-1206736bd050/go.mod h1:0HfF1LfWLMuGpui0PKhGvkXxfjv1JslMRY6B+cae3dg=
github.com/pingcap/tidb-tools v4.0.0-beta.1.0.20200317092225-ed6b2a87af54+incompatible h1:tYADqdmWwgDOwf/qEN0trJAy6H3c3Tt/QZx1z4qVrRQ=
Expand Down Expand Up @@ -284,7 +284,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sergi/go-diff v1.0.1-0.20180205163309-da645544ed44 h1:tB9NOR21++IjLyVx3/PCPhWMwqGNCMQEH96A6dMZ/gc=
github.com/sergi/go-diff v1.0.1-0.20180205163309-da645544ed44/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/shirou/gopsutil v2.19.10+incompatible h1:lA4Pi29JEVIQIgATSeftHSY0rMGI9CLrl2ZvDLiahto=
github.com/shirou/gopsutil v2.19.10+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
Expand Down
2 changes: 1 addition & 1 deletion meta/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (s *testSuite) TestDDL(c *C) {
if job.ID == historyJob1.ID {
c.Assert(*(job.Args[0].(*string)), Equals, historyJob1.Args[0])
} else {
c.Assert(job.Args, IsNil)
c.Assert(job.Args, HasLen, 0)
}
}

Expand Down
3 changes: 2 additions & 1 deletion util/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package admin

import (
"context"
"encoding/json"
"fmt"
"io"
"math"
Expand Down Expand Up @@ -157,7 +158,7 @@ func CancelJobs(txn kv.Transaction, ids []int64) ([]error, error) {

job.State = model.JobStateCancelling
// Make sure RawArgs isn't overwritten.
err := job.DecodeArgs(job.RawArgs)
err := json.Unmarshal(job.RawArgs, &job.Args)
if err != nil {
errs[i] = errors.Trace(err)
continue
Expand Down

0 comments on commit 4bd4090

Please sign in to comment.