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 985c3e301d
commit 5973fd4067

View file

@ -295,7 +295,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 {
@ -308,7 +309,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 {