diff --git a/ddl/ingest/engine.go b/ddl/ingest/engine.go index ac0287b26637a..fce350df09e40 100644 --- a/ddl/ingest/engine.go +++ b/ddl/ingest/engine.go @@ -204,7 +204,7 @@ func (ei *engineInfo) newWriterContext(workerID int, unique bool) (*WriterContex func (ei *engineInfo) closeWriters() error { var firstErr error - for wid := range ei.writerCache.Keys() { + for _, wid := range ei.writerCache.Keys() { if w, ok := ei.writerCache.Load(wid); ok { _, err := w.Close(ei.ctx) if err != nil {