cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

opt: remove TableMeta.IsSkipLocked

Open mgartner opened this issue 3 years ago • 1 comments

opt: fix duplicate join multiplicity test

Test case 9 in TestGetJoinMultiplicity was a duplicate of test case 2. It has been updated to be similar, but use an INNER JOIN instead of a LEFT JOIN, which I believe it was originally supposed to be - there is no similar existing test case.

Release note: None

opt: remove TableMeta.IsSkipLocked

TableMeta.IsSkipLocked was used by the multiplicity builder to determine whether a column was filtered or not by a SKIP LOCKED scan. However, this field was unnecessary. The deriveUnfilteredCols function in the multiplicity builder already traverses expressions all the way down to ScanExprs, only collecting unfiltered columns if they originate from a scan where ScanExpr.IsUnfiltered returns true. ScanExpr.IsUnfiltered returns false if the scan is a SKIP LOCKED scan. Therefore, no additional mechanism is required to detect columns filtered by SKIP LOCKED scans.

I noticed that TableMeta.IsSkipLocked was not needed because the multiplicity builder unit tests added in #85720 never set it, yet the tests passed.

This commit also adds more multiplicity builder unit tests for self-joins with SKIP LOCKED.

Release note: None

opt: ensure min cardinality of zero for expressions with SKIP LOCKED

This commit ensures that the minimum cardinality of a scan or lookup-join with SKIP LOCKED is zero. This shouldn't be needed because the logical to derive the cardinality for these expressions should never produce a non-zero minimum cardinality, but this provides extra safety.

Release note: None

mgartner avatar Aug 10 '22 23:08 mgartner

This change is Reviewable

cockroach-teamcity avatar Aug 10 '22 23:08 cockroach-teamcity

Yes! It was already added in #85720.

Ah, thanks.. I didn't see it. I was reviewing code in a branch that's a few days old.

msirek avatar Aug 11 '22 22:08 msirek

bors r+

mgartner avatar Aug 15 '22 01:08 mgartner

Build failed (retrying...):

craig[bot] avatar Aug 15 '22 02:08 craig[bot]

Build failed (retrying...):

craig[bot] avatar Aug 15 '22 04:08 craig[bot]

Build failed (retrying...):

craig[bot] avatar Aug 15 '22 07:08 craig[bot]

Build failed:

craig[bot] avatar Aug 15 '22 09:08 craig[bot]

bors r+

rytaft avatar Aug 15 '22 14:08 rytaft

Build succeeded:

craig[bot] avatar Aug 15 '22 16:08 craig[bot]