Skip to content

Commit 6180fb7

Browse files
authored
statistics: fix the panic when to async load stats with dropped index (#58887)
close #58865
1 parent aa21818 commit 6180fb7

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
@@ -746,6 +746,10 @@ func loadNeededIndexHistograms(sctx sessionctx.Context, is infoschema.InfoSchema
746746
return nil
747747
}
748748
idxInfo := tblInfo.Meta().FindIndexByID(idx.ID)
749+
if idxInfo == nil {
750+
asyncload.AsyncLoadHistogramNeededItems.Delete(idx)
751+
return errors.NotFoundf("index %d in table %d", idx.ID, idx.TableID)
752+
}
749753
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)
750754
if err != nil {
751755
return errors.Trace(err)

0 commit comments

Comments
 (0)