From d9469de240cb334c40adf8e67347026294a7691b Mon Sep 17 00:00:00 2001 From: Marcus Gartner Date: Fri, 29 Jul 2022 18:06:35 -0400 Subject: [PATCH] opt: revert data race fix This commit reverts #37972. We no longer lazily build filter props and share them across multiple threads. Release note: None --- pkg/sql/opt/memo/logical_props_builder.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/sql/opt/memo/logical_props_builder.go b/pkg/sql/opt/memo/logical_props_builder.go index 53092adc1cf4..ddb5888842f1 100644 --- a/pkg/sql/opt/memo/logical_props_builder.go +++ b/pkg/sql/opt/memo/logical_props_builder.go @@ -1497,13 +1497,9 @@ func (b *logicalPropsBuilder) buildFiltersItemProps(item *FiltersItem, scalar *p // Constraints // ----------- cb := constraintsBuilder{md: b.mem.Metadata(), evalCtx: b.evalCtx} - // TODO(rytaft): Using local variables here to avoid a data race. It would be - // better to avoid lazy building of props altogether. - constraints, tightConstraints := cb.buildConstraints(item.Condition) - if constraints.IsUnconstrained() { + scalar.Constraints, scalar.TightConstraints = cb.buildConstraints(item.Condition) + if scalar.Constraints.IsUnconstrained() { scalar.Constraints, scalar.TightConstraints = nil, false - } else { - scalar.Constraints, scalar.TightConstraints = constraints, tightConstraints } // Functional Dependencies