@@ -28,7 +28,6 @@ import (
28
28
"github.com/pingcap/tidb/pkg/meta/model"
29
29
"github.com/pingcap/tidb/pkg/testkit"
30
30
"github.com/pingcap/tidb/pkg/testkit/testfailpoint"
31
- "github.com/pingcap/tidb/tests/realtikvtest"
32
31
"github.com/stretchr/testify/assert"
33
32
"github.com/stretchr/testify/require"
34
33
)
@@ -121,7 +120,7 @@ func TestIngestError(t *testing.T) {
121
120
}
122
121
123
122
func TestAddIndexIngestPanic (t * testing.T ) {
124
- store := realtikvtest . CreateMockStoreAndSetup (t )
123
+ store := testkit . CreateMockStore (t )
125
124
tk := testkit .NewTestKit (t , store )
126
125
tk .MustExec ("use test;" )
127
126
defer ingesttestutil .InjectMockBackendMgr (t , store )()
@@ -147,8 +146,34 @@ func TestAddIndexIngestPanic(t *testing.T) {
147
146
})
148
147
}
149
148
149
+ func TestAddIndexSetInternalSessions (t * testing.T ) {
150
+ store := testkit .CreateMockStore (t )
151
+ tk := testkit .NewTestKit (t , store )
152
+ tk .MustExec ("use test;" )
153
+ defer ingesttestutil .InjectMockBackendMgr (t , store )()
154
+
155
+ tk .MustExec ("set global tidb_enable_dist_task = 0;" )
156
+ tk .MustExec ("set @@tidb_ddl_reorg_worker_cnt = 1;" )
157
+ tk .MustExec ("create table t (a int);" )
158
+ tk .MustExec ("insert into t values (1);" )
159
+ expectInternalTS := []uint64 {}
160
+ actualInternalTS := []uint64 {}
161
+ testfailpoint .EnableCall (t , "github.com/pingcap/tidb/pkg/ddl/wrapInBeginRollbackStartTS" , func (startTS uint64 ) {
162
+ expectInternalTS = append (expectInternalTS , startTS )
163
+ })
164
+ testfailpoint .EnableCall (t , "github.com/pingcap/tidb/pkg/ddl/scanRecordExec" , func () {
165
+ mgr := tk .Session ().GetSessionManager ()
166
+ actualInternalTS = mgr .GetInternalSessionStartTSList ()
167
+ })
168
+ tk .MustExec ("alter table t add index idx(a);" )
169
+ require .Len (t , expectInternalTS , 1 )
170
+ for _ , ts := range expectInternalTS {
171
+ require .Contains (t , actualInternalTS , ts )
172
+ }
173
+ }
174
+
150
175
func TestAddIndexIngestCancel (t * testing.T ) {
151
- store , dom := realtikvtest . CreateMockStoreAndDomainAndSetup (t )
176
+ store , dom := testkit . CreateMockStoreAndDomain (t )
152
177
tk := testkit .NewTestKit (t , store )
153
178
tk .MustExec ("use test;" )
154
179
defer ingesttestutil .InjectMockBackendMgr (t , store )()
0 commit comments