Skip to content

Commit

Permalink
planner: fix goroutine leak problem in some unit tests (#26500) (#26506)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Sep 16, 2021
1 parent f005851 commit 1cae2c5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions planner/core/prepare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,12 @@ func (s *testPrepareSerialSuite) TestPrepareCacheWithJoinTable(c *C) {
}

func (s *testPlanSerialSuite) TestPlanCacheSnapshot(c *C) {
store, _, err := newStoreWithBootstrap()
store, dom, err := newStoreWithBootstrap()
c.Assert(err, IsNil)
tk := testkit.NewTestKit(c, store)
orgEnable := core.PreparedPlanCacheEnabled()
defer func() {
dom.Close()
err = store.Close()
c.Assert(err, IsNil)
core.SetPreparedPlanCache(orgEnable)
Expand Down Expand Up @@ -1073,11 +1074,12 @@ func (s *testPlanSerialSuite) TestPlanCacheSnapshot(c *C) {
}

func (s *testPlanSerialSuite) TestPlanCachePointGetAndTableDual(c *C) {
store, _, err := newStoreWithBootstrap()
store, dom, err := newStoreWithBootstrap()
c.Assert(err, IsNil)
tk := testkit.NewTestKit(c, store)
orgEnable := core.PreparedPlanCacheEnabled()
defer func() {
dom.Close()
store.Close()
core.SetPreparedPlanCache(orgEnable)
}()
Expand Down Expand Up @@ -1166,11 +1168,12 @@ func (s *testPlanSerialSuite) TestPlanCachePointGetAndTableDual(c *C) {
}

func (s *testPlanSerialSuite) TestIssue23671(c *C) {
store, _, err := newStoreWithBootstrap()
store, dom, err := newStoreWithBootstrap()
c.Assert(err, IsNil)
tk := testkit.NewTestKit(c, store)
orgEnable := core.PreparedPlanCacheEnabled()
defer func() {
dom.Close()
store.Close()
core.SetPreparedPlanCache(orgEnable)
}()
Expand Down

0 comments on commit 1cae2c5

Please sign in to comment.