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
@@ -441,7 +441,19 @@ const (
441
441
);`
442
442
// CreateMDLView is a view about metadata locks.
443
443
CreateMDLView=`CREATE OR REPLACE VIEW mysql.tidb_mdl_view as (
444
-
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
444
+
SELECT job_id,
445
+
db_name,
446
+
table_name,
447
+
query,
448
+
session_id,
449
+
txnstart,
450
+
tidb_decode_sql_digests(all_sql_digests, 4096) AS SQL_DIGESTS
451
+
FROM information_schema.ddl_jobs,
452
+
information_schema.cluster_tidb_trx,
453
+
information_schema.cluster_processlist
454
+
WHERE (ddl_jobs.state != 'synced' and ddl_jobs.state != 'cancelled')
455
+
AND Find_in_set(ddl_jobs.table_id, cluster_tidb_trx.related_table_ids)
456
+
AND cluster_tidb_trx.session_id = cluster_processlist.id
445
457
);`
446
458
447
459
// CreatePlanReplayerStatusTable is a table about plan replayer status
@@ -779,11 +791,13 @@ const (
779
791
version110=110
780
792
// version111 adds the table tidb_ttl_task and tidb_ttl_job_history
781
793
version111=111
794
+
// version112 modifies the view tidb_mdl_view
795
+
version112=112
782
796
)
783
797
784
798
// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
785
799
// please make sure this is the largest version
786
-
varcurrentBootstrapVersionint64=version111
800
+
varcurrentBootstrapVersionint64=version112
787
801
788
802
// 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.
789
803
varinternalSQLTimeout=owner.ManagerSessionTTL+15
@@ -902,6 +916,7 @@ var (
902
916
upgradeToVer109,
903
917
upgradeToVer110,
904
918
upgradeToVer111,
919
+
upgradeToVer112,
905
920
}
906
921
)
907
922
@@ -2262,6 +2277,13 @@ func upgradeToVer111(s Session, ver int64) {
2262
2277
doReentrantDDL(s, CreateTTLJobHistory)
2263
2278
}
2264
2279
2280
+
funcupgradeToVer112(sSession, verint64) {
2281
+
ifver>=version112 {
2282
+
return
2283
+
}
2284
+
doReentrantDDL(s, CreateMDLView)
2285
+
}
2286
+
2265
2287
funcwriteOOMAction(sSession) {
2266
2288
comment:="oom-action is `log` by default in v3.0.x, `cancel` by default in v4.0.11+"
2267
2289
mustExecute(s, `INSERT HIGH_PRIORITY INTO %n.%n VALUES (%?, %?, %?) ON DUPLICATE KEY UPDATE VARIABLE_VALUE= %?`,
0 commit comments