Skip to content

Commit 5de1105

Browse files
authored
statistics: lite init used wrong value to build table stats ver (#58021)
close #58020
1 parent 8c88823 commit 5de1105

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pkg/statistics/handle/bootstrap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (*Handle) initStatsHistograms4ChunkLite(cache statstypes.StatsCache, iter *
134134
id := row.GetInt64(2)
135135
ndv := row.GetInt64(3)
136136
nullCount := row.GetInt64(5)
137-
statsVer := row.GetInt64(7)
137+
statsVer := row.GetInt64(8)
138138
// All the objects in the table share the same stats version.
139139
if statsVer != statistics.Version0 {
140140
table.StatsVer = int(statsVer)

pkg/statistics/handle/handletest/handle_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,7 @@ func TestInitStatsLite(t *testing.T) {
14141414
require.NoError(t, h.InitStatsLite(context.Background()))
14151415
statsTbl1 := h.GetTableStats(tblInfo)
14161416
checkAllEvicted(t, statsTbl1)
1417+
require.Equal(t, int(statistics.Version2), statsTbl1.StatsVer)
14171418
{
14181419
// internal.AssertTableEqual(t, statsTbl0, statsTbl1)
14191420
// statsTbl0 is loaded when the cache has pseudo table.

0 commit comments

Comments
 (0)