app/vmselect/promql: make a copy of EvalConfig when executing q1 and q2 in parallel for q1 binary_op q2

This should prevent from data races if the underlying functions modify EvalConfig contents.
This commit is contained in:
Aliaksandr Valialkin 2021-02-10 23:05:16 +02:00
parent 04faea8b45
commit 7a3a9421f3

View file

@ -279,7 +279,8 @@ func evalExpr(ec *EvalConfig, e metricsql.Expr) ([]*timeseries, error) {
wg.Add(1)
go func() {
defer wg.Done()
tss, err := evalExpr(ec, be.Left)
ecCopy := *ec
tss, err := evalExpr(&ecCopy, be.Left)
mu.Lock()
if err != nil {
if errGlobal == nil {
@ -292,7 +293,8 @@ func evalExpr(ec *EvalConfig, e metricsql.Expr) ([]*timeseries, error) {
wg.Add(1)
go func() {
defer wg.Done()
tss, err := evalExpr(ec, be.Right)
ecCopy := *ec
tss, err := evalExpr(&ecCopy, be.Right)
mu.Lock()
if err != nil {
if errGlobal == nil {