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

executor: grant table level privilege should check table exist (#14540) #14611

Merged
merged 5 commits into from Feb 12, 2020

Conversation

tiancaiamao
Copy link
Contributor

Cherry-pick #14540

Release note:
Fix a bug that the table's existence is not checked when granting privileges on this table to users

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

@tiancaiamao
Copy link
Contributor Author

PTAL @jackysp @imtbkcat @shenli

Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crazycs520 crazycs520 added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 4, 2020
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jackysp
Copy link
Member

jackysp commented Feb 4, 2020

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 4, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 4, 2020

Your auto merge job has been accepted, waiting for 14610, 14614

@sre-bot
Copy link
Contributor

sre-bot commented Feb 4, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Feb 4, 2020

@tiancaiamao merge failed.

@tiancaiamao
Copy link
Contributor Author

[2020-02-04T13:29:28.804Z] ==================
[2020-02-04T13:29:28.804Z] WARNING: DATA RACE
[2020-02-04T13:29:28.804Z] Write at 0x00c000d6b278 by goroutine 139:
[2020-02-04T13:29:28.804Z]   go.etcd.io/etcd/mvcc.(*keyIndex).put()
[2020-02-04T13:29:28.804Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/key_index.go:101 +0x1f6
[2020-02-04T13:29:28.804Z]   go.etcd.io/etcd/mvcc.(*treeIndex).Put()
[2020-02-04T13:29:28.804Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/index.go:65 +0x1db
[2020-02-04T13:29:28.804Z]   go.etcd.io/etcd/mvcc.(*storeTxnWrite).put()
[2020-02-04T13:29:28.804Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/kvstore_txn.go:211 +0x40e
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*storeTxnWrite).Put()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/kvstore_txn.go:97 +0x8b
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*metricsTxnWrite).Put()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/metrics_txn.go:46 +0xeb
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*watchableStoreTxnWrite).Put()
[2020-02-04T13:29:28.805Z]       <autogenerated>:1 +0xbb
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*applierV3backend).Put()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/apply.go:217 +0x36c
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*quotaApplierV3).Put()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/apply.go:829 +0xc2
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*authApplierV3).Put()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/apply_auth.go:83 +0x1b5
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*applierV3backend).Apply()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/apply.go:124 +0x38d
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*quotaApplierV3).Apply()
[2020-02-04T13:29:28.805Z]       <autogenerated>:1 +0x68
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*authApplierV3).Apply()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/apply_auth.go:58 +0x111
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).applyEntryNormal()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/server.go:2011 +0x5d8
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).apply()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/server.go:1925 +0x792
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).applyEntries()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/server.go:1349 +0x177
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).applyAll()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/server.go:1075 +0x98
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).run.func8()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/server.go:1020 +0x53
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/pkg/schedule.(*fifo).run()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/pkg/schedule/schedule.go:157 +0x11b
[2020-02-04T13:29:28.805Z] 
[2020-02-04T13:29:28.805Z] Previous read at 0x00c000d6b278 by goroutine 22:
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*keyIndex).get()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/key_index.go:365 +0x684
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*treeIndex).Revisions.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/index.go:116 +0xab
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*treeIndex).visit.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/index.go:102 +0x8b
[2020-02-04T13:29:28.805Z]   github.com/google/btree.(*node).iterate()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/google/btree@v0.0.0-20180813153112-4030bb1f1f0c/btree.go:524 +0x85e
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*treeIndex).visit()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/google/btree@v0.0.0-20180813153112-4030bb1f1f0c/btree.go:768 +0x40f
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*treeIndex).Revisions()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/index.go:115 +0x20d
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*storeTxnRead).rangeKeys()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/kvstore_txn.go:128 +0x377
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*storeTxnRead).Range()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/kvstore_txn.go:50 +0xe4
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*txnReadWrite).Range()
[2020-02-04T13:29:28.805Z]       <autogenerated>:1 +0xf4
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/mvcc.(*metricsTxnWrite).Range()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/mvcc/metrics_txn.go:36 +0x12a
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*applierV3backend).Range()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/apply.go:275 +0x325
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).Range.func3()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/v3_server.go:104 +0x9d
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).doSerialize()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/v3_server.go:554 +0xad
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).Range()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/v3_server.go:105 +0x1f5
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver/api/v3rpc.(*kvServer).Range()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/api/v3rpc/key.go:52 +0xb0
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver/api/v3rpc.(*quotaKVServer).Range()
[2020-02-04T13:29:28.805Z]       <autogenerated>:1 +0x87
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver/etcdserverpb._KV_Range_Handler.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/etcdserverpb/rpc.pb.go:3473 +0xa1
[2020-02-04T13:29:28.805Z]   github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/chain.go:31 +0x2d3
[2020-02-04T13:29:28.805Z]   github.com/grpc-ecosystem/go-grpc-prometheus.(*ServerMetrics).UnaryServerInterceptor.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-prometheus@v1.2.0/server_metrics.go:107 +0xff
[2020-02-04T13:29:28.805Z]   github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/chain.go:34 +0x1d9
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver/api/v3rpc.newUnaryInterceptor.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/api/v3rpc/interceptor.go:60 +0x10c
[2020-02-04T13:29:28.805Z]   github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/chain.go:34 +0x1d9
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver/api/v3rpc.newLogUnaryInterceptor.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/api/v3rpc/interceptor.go:67 +0xda
[2020-02-04T13:29:28.805Z]   github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.0.1-0.20190118093823-f849b5445de4/chain.go:39 +0x33f
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver/etcdserverpb._KV_Range_Handler()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/etcdserverpb/rpc.pb.go:3475 +0x1d8
[2020-02-04T13:29:28.805Z]   google.golang.org/grpc.(*Server).processUnaryRPC()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/server.go:966 +0x92f
[2020-02-04T13:29:28.805Z]   google.golang.org/grpc.(*Server).handleStream()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/server.go:1245 +0x132b
[2020-02-04T13:29:28.805Z]   google.golang.org/grpc.(*Server).serveStreams.func1.1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/server.go:685 +0xc8
[2020-02-04T13:29:28.805Z] 
[2020-02-04T13:29:28.805Z] Goroutine 139 (running) created at:
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/pkg/schedule.NewFIFOScheduler()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/pkg/schedule/schedule.go:70 +0x2b1
[2020-02-04T13:29:28.805Z]   go.etcd.io/etcd/etcdserver.(*EtcdServer).run()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/go.etcd.io/etcd@v0.0.0-20190320044326-77d4b742cdbf/etcdserver/server.go:905 +0x327
[2020-02-04T13:29:28.805Z] 
[2020-02-04T13:29:28.805Z] Goroutine 22 (finished) created at:
[2020-02-04T13:29:28.805Z]   google.golang.org/grpc.(*Server).serveStreams.func1()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/server.go:683 +0xb8
[2020-02-04T13:29:28.805Z]   google.golang.org/grpc/internal/transport.(*http2Server).operateHeaders()
[2020-02-04T13:29:28.805Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/internal/transport/http2_server.go:419 +0x14e2
[2020-02-04T13:29:28.805Z]   google.golang.org/grpc/internal/transport.(*http2Server).HandleStreams()
[2020-02-04T13:29:28.806Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/internal/transport/http2_server.go:459 +0x39f
[2020-02-04T13:29:28.806Z]   google.golang.org/grpc.(*Server).serveStreams()
[2020-02-04T13:29:28.806Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/server.go:681 +0x19a
[2020-02-04T13:29:28.806Z]   google.golang.org/grpc.(*Server).handleRawConn.func1()
[2020-02-04T13:29:28.806Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/pkg/mod/google.golang.org/grpc@v1.17.0/server.go:643 +0x50
[2020-02-04T13:29:28.806Z] ==================

@tiancaiamao
Copy link
Contributor Author

tiancaiamao commented Feb 5, 2020

/run-unit-test

Maybe I find the reason why sometimes TestSyncerSimple is not stable, maybe it's related to this data race.

@zz-jason
Copy link
Member

zz-jason commented Feb 5, 2020

/run-unit-test

Maybe I find the reason why sometimes TestSyncerSimple is not stable, maybe it's related to this data race.

@tiancaiamao How about filing an issue to record this data race and fix it in another PR?

@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 5, 2020
@zz-jason
Copy link
Member

zz-jason commented Feb 5, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

Your auto merge job has been accepted, waiting for 14569, 14635, 14592, 14377

@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

@tiancaiamao merge failed.

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

return err
}
err = infoschema.ErrTableNotExists.GenWithStackByArgs(dbName, e.Level.TableName)
// Note the table name compare is case sensitive here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiancaiamao Hi, may i ask. The TiDB lower_case_table_names is default 2. So in this, i think we need check case insensitive here? Some case in #34610

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/privilege status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants