From e4d948f97362218726dd32193316f123fbf1f9a2 Mon Sep 17 00:00:00 2001 From: Lynn Date: Thu, 1 Aug 2019 17:22:38 +0800 Subject: [PATCH] executor: fix baseExecutor'children may not close --- executor/executor.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/executor/executor.go b/executor/executor.go index 6c754f4e62741..76735ce06e387 100644 --- a/executor/executor.go +++ b/executor/executor.go @@ -104,13 +104,13 @@ func (e *baseExecutor) Open(ctx context.Context) error { // Close closes all executors and release all resources. func (e *baseExecutor) Close() error { - for _, child := range e.children { - err := child.Close() - if err != nil { - return err + var firstErr error + for _, src := range e.children { + if err := src.Close(); err != nil && firstErr == nil { + firstErr = err } } - return nil + return firstErr } // Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.