You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tk3.MustQuery("select DB_NAME, QUERY, SQL_DIGESTS from mysql.tidb_mdl_view").Check(testkit.Rows("test alter table test.t add column b int; [\"begin\",\"select ? ;\",\"select * from `t` ;\"]"))
862
+
tk3.MustQuery("select DB_NAME, QUERY, SQL_DIGESTS from mysql.tidb_mdl_view").Check(testkit.Rows(
Copy file name to clipboardexpand all lines: session/bootstrap.go
+24-2
Original file line number
Diff line number
Diff line change
@@ -442,7 +442,19 @@ const (
442
442
);`
443
443
// CreateMDLView is a view about metadata locks.
444
444
CreateMDLView=`CREATE OR REPLACE VIEW mysql.tidb_mdl_view as (
445
-
select JOB_ID, DB_NAME, TABLE_NAME, QUERY, SESSION_ID, TxnStart, TIDB_DECODE_SQL_DIGESTS(ALL_SQL_DIGESTS, 4096) AS SQL_DIGESTS from information_schema.ddl_jobs, information_schema.CLUSTER_TIDB_TRX, information_schema.CLUSTER_PROCESSLIST where ddl_jobs.STATE = 'running' and find_in_set(ddl_jobs.table_id, CLUSTER_TIDB_TRX.RELATED_TABLE_IDS) and CLUSTER_TIDB_TRX.SESSION_ID=CLUSTER_PROCESSLIST.ID
445
+
SELECT job_id,
446
+
db_name,
447
+
table_name,
448
+
query,
449
+
session_id,
450
+
txnstart,
451
+
tidb_decode_sql_digests(all_sql_digests, 4096) AS SQL_DIGESTS
452
+
FROM information_schema.ddl_jobs,
453
+
information_schema.cluster_tidb_trx,
454
+
information_schema.cluster_processlist
455
+
WHERE (ddl_jobs.state != 'synced' and ddl_jobs.state != 'cancelled')
456
+
AND Find_in_set(ddl_jobs.table_id, cluster_tidb_trx.related_table_ids)
457
+
AND cluster_tidb_trx.session_id = cluster_processlist.id
446
458
);`
447
459
448
460
// CreatePlanReplayerStatusTable is a table about plan replayer status
@@ -780,11 +792,13 @@ const (
780
792
version110=110
781
793
// version111 adds the table tidb_ttl_task and tidb_ttl_job_history
782
794
version111=111
795
+
// version112 modifies the view tidb_mdl_view
796
+
version112=112
783
797
)
784
798
785
799
// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
786
800
// please make sure this is the largest version
787
-
varcurrentBootstrapVersionint64=version111
801
+
varcurrentBootstrapVersionint64=version112
788
802
789
803
// 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.
790
804
varinternalSQLTimeout=owner.ManagerSessionTTL+15
@@ -903,6 +917,7 @@ var (
903
917
upgradeToVer109,
904
918
upgradeToVer110,
905
919
upgradeToVer111,
920
+
upgradeToVer112,
906
921
}
907
922
)
908
923
@@ -2263,6 +2278,13 @@ func upgradeToVer111(s Session, ver int64) {
2263
2278
doReentrantDDL(s, CreateTTLJobHistory)
2264
2279
}
2265
2280
2281
+
funcupgradeToVer112(sSession, verint64) {
2282
+
ifver>=version112 {
2283
+
return
2284
+
}
2285
+
doReentrantDDL(s, CreateMDLView)
2286
+
}
2287
+
2266
2288
funcwriteOOMAction(sSession) {
2267
2289
comment:="oom-action is `log` by default in v3.0.x, `cancel` by default in v4.0.11+"
2268
2290
mustExecute(s, `INSERT HIGH_PRIORITY INTO %n.%n VALUES (%?, %?, %?) ON DUPLICATE KEY UPDATE VARIABLE_VALUE= %?`,
0 commit comments