Skip to content

Commit

Permalink
Revert "Parallelize child node execution in promql engine"
Browse files Browse the repository at this point in the history
This reverts commit bedd9cd.
  • Loading branch information
jacksontj committed Sep 17, 2021
1 parent 1776d4c commit 0c8fa0a
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions promql/parser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package parser

import (
"context"
"sync"
"time"

"github.com/pkg/errors"
Expand Down Expand Up @@ -334,26 +333,12 @@ func Walk(ctx context.Context, v Visitor, s *EvalStmt, node Node, path []Node, n
}
path = append(path, node)

// We parallelize the execution of children
wg := &sync.WaitGroup{}
children := Children(node)
errs := make([]error, len(children))
for i, e := range children {
wg.Add(1)
go func(i int, e Node) {
defer wg.Done()
if childNode, childErr := Walk(ctx, v, s, e, path, nr); err != nil {
errs[i] = childErr
} else {
SetChild(node, i, childNode)
}
}(i, e)
}
wg.Wait()
// If there was an error we return the first one
for _, err := range errs {
if err != nil {
// TODO: parallel execution of children
for i, e := range Children(node) {
if childNode, err := Walk(ctx, v, s, e, path, nr); err != nil {
return node, err
} else {
SetChild(node, i, childNode)
}
}

Expand Down

0 comments on commit 0c8fa0a

Please sign in to comment.