-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
store: fix routine/client leak when get a cached store #42779
Changes from 1 commit
d4800bf
98dddca
ab89d5d
9a25989
1feb1af
07c5792
e83b723
45e255f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,28 @@ package txntest | |
import ( | ||
"testing" | ||
|
||
"github.com/pingcap/tidb/store/driver" | ||
"github.com/pingcap/tidb/testkit" | ||
"github.com/pingcap/tidb/tests/realtikvtest" | ||
"github.com/pingcap/tidb/util" | ||
"github.com/stretchr/testify/require" | ||
"go.opencensus.io/stats/view" | ||
) | ||
|
||
func TestGetCachedStore(t *testing.T) { | ||
defer view.Stop() | ||
var d driver.TiKVDriver | ||
// when get the cached store, there should not have routine leak. | ||
store1, err := d.Open(*realtikvtest.TiKVPath) | ||
require.NoError(t, err) | ||
defer func() { | ||
require.NoError(t, store1.Close()) | ||
}() | ||
store2, err := d.Open(*realtikvtest.TiKVPath) | ||
require.NoError(t, err) | ||
require.Equal(t, store1, store2) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. already has it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I supposed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they're not in the list, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. previous, there's no test case to get the |
||
/* | ||
These test cases come from the paper <A Critique of ANSI SQL Isolation Levels>. | ||
The sign 'P0', 'P1'.... can be found in the paper. These cases will run under snapshot isolation. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need real tikv to test it, so put it here