@@ -731,7 +731,7 @@ const (
731
731
// oom-action when upgrade from v3.0.x to v4.0.11+.
732
732
tidbDefOOMAction = "default_oom_action"
733
733
734
- tiDBStatsGCLastTS = "tidb_stats_gc_last_stats "
734
+ tiDBStatsGCLastTS = "tidb_stats_gc_last_ts "
735
735
tiDBStatsGCLastTSComment = "the previous gc timestamp for statistics"
736
736
// Const for TiDB server version 2.
737
737
version2 = 2
@@ -986,7 +986,7 @@ const (
986
986
987
987
// currentBootstrapVersion is defined as a variable, so we can modify its value for testing.
988
988
// please make sure this is the largest version
989
- var currentBootstrapVersion int64 = version172
989
+ var currentBootstrapVersion int64 = version173
990
990
991
991
// 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.
992
992
var internalSQLTimeout = owner .ManagerSessionTTL + 15
@@ -2801,8 +2801,12 @@ func upgradeToVer173(s Session, ver int64) {
2801
2801
if ver >= version173 {
2802
2802
return
2803
2803
}
2804
+ writeStatsGCLastPos (s )
2805
+ }
2806
+
2807
+ func writeStatsGCLastPos (s Session ) {
2804
2808
mustExecute (s , "INSERT HIGH_PRIORITY INTO %n.%n VALUES(%?, %?, %?) ON DUPLICATE KEY UPDATE VARIABLE_VALUE = %?" ,
2805
- mysql .SystemDB , mysql .TiDBTable , tiDBStatsGCLastTS , 0 , tiDBStatsGCLastTSComment )
2809
+ mysql .SystemDB , mysql .TiDBTable , tiDBStatsGCLastTS , 0 , tiDBStatsGCLastTSComment , 0 )
2806
2810
}
2807
2811
2808
2812
func writeOOMAction (s Session ) {
@@ -3057,6 +3061,8 @@ func doDMLWorks(s Session) {
3057
3061
3058
3062
writeStmtSummaryVars (s )
3059
3063
3064
+ writeStatsGCLastPos (s )
3065
+
3060
3066
ctx := kv .WithInternalSourceType (context .Background (), kv .InternalTxnBootstrap )
3061
3067
_ , err := s .ExecuteInternal (ctx , "COMMIT" )
3062
3068
if err != nil {
0 commit comments