From aa7b849e758caaefc59dfd59ff575e4886ba8e5e Mon Sep 17 00:00:00 2001 From: Ned Andreev Date: Wed, 11 Dec 2024 15:14:47 +0200 Subject: [PATCH] fix: data race in bloombuild tests (#15360) --- pkg/bloombuild/planner/planner_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/bloombuild/planner/planner_test.go b/pkg/bloombuild/planner/planner_test.go index 656a0b533c3c2..75d41027dd562 100644 --- a/pkg/bloombuild/planner/planner_test.go +++ b/pkg/bloombuild/planner/planner_test.go @@ -713,7 +713,10 @@ func (f *fakeBuilder) Send(req *protos.PlannerToBuilder) error { } func (f *fakeBuilder) Recv() (*protos.BuilderToPlanner, error) { - if len(f.tasks) == 0 { + f.mx.Lock() + tasksLen := len(f.tasks) + f.mx.Unlock() + if tasksLen == 0 { // First call to Recv answers with builderID return &protos.BuilderToPlanner{ BuilderID: f.id,