Skip to content

Commit eb62c74

Browse files
ti-chi-botYuJuncen
authored andcommitted
statistics: fix the panic when to async load stats with dropped index (pingcap#58887) (pingcap#58964)
close pingcap#58865
1 parent 4b3d47e commit eb62c74

File tree

1 file changed

+4
-0
lines changed
  • pkg/statistics/handle/storage

1 file changed

+4
-0
lines changed

pkg/statistics/handle/storage/read.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,10 @@ func loadNeededIndexHistograms(sctx sessionctx.Context, is infoschema.InfoSchema
759759
return nil
760760
}
761761
idxInfo := tblInfo.Meta().FindIndexByID(idx.ID)
762+
if idxInfo == nil {
763+
asyncload.AsyncLoadHistogramNeededItems.Delete(idx)
764+
return errors.NotFoundf("index %d in table %d", idx.ID, idx.TableID)
765+
}
762766
hg, err := HistogramFromStorageWithPriority(sctx, idx.TableID, idx.ID, types.NewFieldType(mysql.TypeBlob), hgMeta.NDV, 1, hgMeta.LastUpdateVersion, hgMeta.NullCount, hgMeta.TotColSize, hgMeta.Correlation, kv.PriorityHigh)
763767
if err != nil {
764768
return errors.Trace(err)

0 commit comments

Comments
 (0)