Skip to content

Commit 294d543

Browse files
committed
statistics: enhance DDL subscriber to handle schema drop events and update stats meta
Signed-off-by: Rustin170506 <[email protected]>
1 parent 773bfc1 commit 294d543

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/statistics/handle/ddl/subscriber.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,20 @@ func (h subscriber) handle(
232232
case model.ActionFlashbackCluster:
233233
return errors.Trace(storage.UpdateStatsVersion(ctx, sctx))
234234
case model.ActionAddIndex:
235-
// No need to update the stats meta for the adding index event.
235+
// No need to update the stats meta for the adding index event.
236+
case model.ActionDropSchema:
237+
miniDBInfo := change.GetDropSchemaInfo()
238+
intest.Assert(miniDBInfo != nil)
239+
for _, table := range miniDBInfo.Tables {
240+
// Try best effort to update the stats meta version for gc.
241+
if err := h.delayedDeleteStats4PhysicalID(ctx, sctx, table.ID); err != nil {
242+
logutil.StatsLogger().Error(
243+
"Failed to update stats meta version for gc",
244+
zap.Int64("tableID", table.ID),
245+
zap.Error(err),
246+
)
247+
}
248+
}
236249
default:
237250
intest.Assert(false)
238251
logutil.StatsLogger().Error("Unhandled schema change event",

0 commit comments

Comments
 (0)