Skip to content

Commit f569f80

Browse files
committed
statistics: fix the panic when to async load stats with dropped index
Signed-off-by: Weizhen Wang <[email protected]>
1 parent 6463db6 commit f569f80

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
@@ -753,6 +753,10 @@ func loadNeededIndexHistograms(sctx sessionctx.Context, is infoschema.InfoSchema
753753
return nil
754754
}
755755
idxInfo := tblInfo.Meta().FindIndexByID(idx.ID)
756+
if idxInfo == nil {
757+
asyncload.AsyncLoadHistogramNeededItems.Delete(idx)
758+
return errors.NotFoundf("index %d in table %d", idx.ID, idx.TableID)
759+
}
756760
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)
757761
if err != nil {
758762
return errors.Trace(err)

0 commit comments

Comments
 (0)