Skip to content

Commit 02f4a28

Browse files
authored
ddl: enable fast create table on default (#57215) (#57254)
close #57214
1 parent 8f8f6d5 commit 02f4a28

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

br/pkg/restore/snap_client/systable_restore_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ func TestCheckSysTableCompatibility(t *testing.T) {
116116
//
117117
// The above variables are in the file br/pkg/restore/systable_restore.go
118118
func TestMonitorTheSystemTableIncremental(t *testing.T) {
119-
require.Equal(t, int64(217), session.CurrentBootstrapVersion)
119+
require.Equal(t, int64(218), session.CurrentBootstrapVersion)
120120
}

pkg/ddl/tests/fastcreatetable/fastcreatetable_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestSwitchFastCreateTable(t *testing.T) {
3939
conn := server.CreateMockConn(t, sv)
4040
tk := testkit.NewTestKitWithSession(t, store, conn.Context().Session)
4141

42-
tk.MustQuery("show global variables like 'tidb_enable_fast_create_table'").Check(testkit.Rows("tidb_enable_fast_create_table OFF"))
42+
tk.MustQuery("show global variables like 'tidb_enable_fast_create_table'").Check(testkit.Rows("tidb_enable_fast_create_table ON"))
4343

4444
tk.MustExec("create database db1;")
4545
tk.MustExec("create database db2;")

pkg/session/bootstrap.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,11 +1186,21 @@ const (
11861186
// version 217
11871187
// Keep tidb_schema_cache_size to 0 if this variable does not exist (upgrading from old version pre 8.1).
11881188
version217 = 217
1189+
1190+
// version 218
1191+
// enable fast_create_table on default
1192+
version218 = 218
1193+
1194+
// ...
1195+
// [version219, version238] is the version range reserved for patches of 8.5.x
1196+
// ...
1197+
1198+
// next version should start with 239
11891199
)
11901200

11911201
// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
11921202
// please make sure this is the largest version
1193-
var currentBootstrapVersion int64 = version217
1203+
var currentBootstrapVersion int64 = version218
11941204

11951205
// DDL owner key's expired time is ManagerSessionTTL seconds, we should wait the time and give more time to have a chance to finish it.
11961206
var internalSQLTimeout = owner.ManagerSessionTTL + 15
@@ -1363,6 +1373,7 @@ var (
13631373
upgradeToVer215,
13641374
upgradeToVer216,
13651375
upgradeToVer217,
1376+
upgradeToVer218,
13661377
}
13671378
)
13681379

@@ -3254,6 +3265,13 @@ func upgradeToVer217(s sessiontypes.Session, ver int64) {
32543265
mustExecute(s, "INSERT IGNORE INTO mysql.global_variables VALUES ('tidb_schema_cache_size', 0)")
32553266
}
32563267

3268+
func upgradeToVer218(_ sessiontypes.Session, ver int64) {
3269+
if ver >= version218 {
3270+
return
3271+
}
3272+
// empty, just make lint happy.
3273+
}
3274+
32573275
// initGlobalVariableIfNotExists initialize a global variable with specific val if it does not exist.
32583276
func initGlobalVariableIfNotExists(s sessiontypes.Session, name string, val any) {
32593277
ctx := kv.WithInternalSourceType(context.Background(), kv.InternalTxnBootstrap)

pkg/sessionctx/variable/tidb_vars.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ const (
14411441
DefTiDBEnablePrepPlanCacheMemoryMonitor = true
14421442
DefTiDBPrepPlanCacheMemoryGuardRatio = 0.1
14431443
DefTiDBEnableDistTask = true
1444-
DefTiDBEnableFastCreateTable = false
1444+
DefTiDBEnableFastCreateTable = true
14451445
DefTiDBSimplifiedMetrics = false
14461446
DefTiDBEnablePaging = true
14471447
DefTiFlashFineGrainedShuffleStreamCount = 0

0 commit comments

Comments
 (0)