diff --git a/planner/core/debugtrace.go b/planner/core/debugtrace.go index 13928cfb69..609651b9c5 100644 --- a/planner/core/debugtrace.go +++ b/planner/core/debugtrace.go @@ -202,7 +202,9 @@ func debugTraceGetStatsTbl( root.AppendStepToCurrentContext(traceInfo) } +// Only for test. func stabilizeGetStatsTblInfo(info *getStatsTblInfo) { + info.TblInfoID = 100 info.InputPhysicalID = 100 tbl := info.StatsTblInfo if tbl == nil { diff --git a/server/server_test.go b/server/server_test.go index 9bfc5d38d9..0621a27187 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -34,6 +34,9 @@ import ( "github.com/stretchr/testify/require" ) +// cmd: go test -run=^TestOptimizerDebugTrace$ --tags=intest github.com/pingcap/tidb/server +// If you want to update the test result, please run the following command: +// cmd: go test -run=^TestOptimizerDebugTrace$ --tags=intest github.com/pingcap/tidb/server --record func TestOptimizerDebugTrace(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/planner/SetBindingTimeToZero", `return(true)`)) require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/planner/core/DebugTraceStableStatsTbl", `return(true)`)) diff --git a/server/testdata/optimizer_suite_out.json b/server/testdata/optimizer_suite_out.json index 9b28c6e947..16b0e6f88e 100644 --- a/server/testdata/optimizer_suite_out.json +++ b/server/testdata/optimizer_suite_out.json @@ -71,7 +71,7 @@ "Version": 440930000000000000 }, "TableName": "t", - "TblInfoID": 98, + "TblInfoID": 100, "Uninitialized": true, "UsePartitionStats": false } @@ -139,7 +139,7 @@ "Version": 440930000000000000 }, "TableName": "t", - "TblInfoID": 98, + "TblInfoID": 100, "Uninitialized": true, "UsePartitionStats": false } @@ -379,7 +379,7 @@ "Version": 440930000000000000 }, "TableName": "t", - "TblInfoID": 98, + "TblInfoID": 100, "Uninitialized": true, "UsePartitionStats": false } @@ -550,7 +550,7 @@ "Version": 440930000000000000 }, "TableName": "t", - "TblInfoID": 98, + "TblInfoID": 100, "Uninitialized": true, "UsePartitionStats": false } @@ -618,7 +618,7 @@ "Version": 440930000000000000 }, "TableName": "t", - "TblInfoID": 98, + "TblInfoID": 100, "Uninitialized": true, "UsePartitionStats": false }