Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#53606
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
hawkingrei authored and ti-chi-bot committed May 28, 2024
1 parent 6a6455a commit 9c35c0b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/statistics/handle/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,13 @@ type MaxTidRecord struct {
tid atomic.Int64
}

<<<<<<< HEAD
func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache util.StatsCache, iter *chunk.Iterator4Chunk) {
var physicalID int64
=======
func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache statstypes.StatsCache, iter *chunk.Iterator4Chunk) {
var physicalID, maxPhysicalID int64
>>>>>>> bdb0545f733 (statistics: make sure that get max table id when to init stats (#53606))
for row := iter.Begin(); row != iter.End(); row = iter.Next() {
physicalID = row.GetInt64(1)
// The table is read-only. Please do not modify it.
Expand All @@ -59,6 +64,7 @@ func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache util.StatsC
logutil.BgLogger().Debug("unknown physical ID in stats meta table, maybe it has been dropped", zap.Int64("ID", physicalID))
continue
}
maxPhysicalID = max(physicalID, maxPhysicalID)
tableInfo := table.Meta()
newHistColl := statistics.HistColl{
PhysicalID: physicalID,
Expand All @@ -76,7 +82,7 @@ func (h *Handle) initStatsMeta4Chunk(is infoschema.InfoSchema, cache util.StatsC
}
maxTidRecord.mu.Lock()
defer maxTidRecord.mu.Unlock()
if maxTidRecord.tid.Load() < physicalID {
if maxTidRecord.tid.Load() < maxPhysicalID {
maxTidRecord.tid.Store(physicalID)
}
}
Expand Down

0 comments on commit 9c35c0b

Please sign in to comment.