btree.BTreeG.clone() maybe called concurrently
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
In the comments of btree.BTree.Clone(), it is stated that btree.BTree.Clone() method cannot be called concurrently.
https://github.com/google/btree/blob/aeba20f7a1e1315badec4eca4fdc9f754f5f880a/btree_generic.go#L613
But I noticed that in the tidb code, using btree.BTree.clone() does not add a lock.
I am concerned that btree.BTree.Clone() may be called concurrently and result in some strange memory leaks.
https://github.com/pingcap/tidb/blob/3580f5196ef1c12d5d7b2b1c2bb11f8112c33b0f/pkg/infoschema/infoschema_v2.go#L91
### 1. Minimal reproduce step (Required)
### 2. What did you expect to see? (Required)
Clone should not be called concurrently
### 3. What did you see instead (Required)
code did not add a lock when using btree.BTree.Clone()。
### 4. What is your TiDB version? (Required)
master
Contributor guide
Assessment
This issue has not been assessed yet.