Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/sql/logictest/tests/local/local_test: TestLogic_select_for_update_read_committed failed #112677

Closed
cockroach-teamcity opened this issue Oct 19, 2023 · 0 comments · Fixed by #112701
Assignees
Labels
branch-release-23.2 Used to mark GA and release blockers and technical advisories for 23.2 C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. T-sql-queries SQL Queries Team
Milestone

Comments

@cockroach-teamcity
Copy link
Member

cockroach-teamcity commented Oct 19, 2023

pkg/sql/logictest/tests/local/local_test.TestLogic_select_for_update_read_committed failed with artifacts on release-23.2 @ 3744e5655559d3350aedaf1fbbaecbf1e69c98d6:

[07:42:51] CREATE TABLE bcd (b INT PRIMARY KEY, c INT, d INT, INDEX (c), FAMILY (b, c, d));
[07:42:51] INSERT INTO bcd VALUES (20, 200, 2000), (30, 300, 3000), (40, 400, 4000);
[07:42:51] GRANT ALL on abc TO testuser;
[07:42:51] GRANT ALL on bcd TO testuser;
[07:42:51] BEGIN;
[07:42:51] SELECT * FROM abc WHERE a != 3 FOR UPDATE;
[07:42:51] 	-- OK;
[07:42:51] SELECT * FROM bcd ORDER BY c DESC LIMIT 2 FOR SHARE;
[07:42:51] 	-- OK;
[07:42:51] SELECT * FROM abc;
[07:42:51] 	-- OK;
[07:42:51] SELECT * FROM bcd;
[07:42:51] 	-- OK;
[07:42:51] SELECT * FROM abc FOR UPDATE SKIP LOCKED;
[07:42:51] 	-- OK;
[07:42:51] SELECT * FROM bcd FOR UPDATE SKIP LOCKED;
[07:42:51] 	-- OK;
[07:42:51] SELECT * FROM abc FOR SHARE;
[07:42:51] SELECT * FROM bcd FOR SHARE;
[07:42:52] 	-- OK;
[07:42:52] SELECT * FROM abc FOR UPDATE;
[07:42:52] SELECT * FROM bcd FOR UPDATE;
[07:42:52] SELECT a FROM abc WHERE a = 2 FOR UPDATE;
[07:42:52] SELECT b FROM abc WHERE a = 2 FOR UPDATE;
[07:42:52] SELECT c FROM abc WHERE a = 2 FOR UPDATE;
[07:42:52] SELECT c FROM abc ORDER BY a DESC LIMIT 2 FOR UPDATE;
[07:42:52] SELECT a + b + c FROM abc FOR UPDATE;
[07:42:52] SELECT * FROM abc JOIN bcd USING (b) FOR SHARE;
[07:42:52] SELECT * FROM abc JOIN bcd USING (c) FOR UPDATE;
[07:42:52] UPDATE abc SET b = b + 1, c = c + 1 WHERE a != 3;
[07:42:52] COMMIT;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- OK;
[07:42:52] 	-- FAIL
    logic.go:2606: 
         to prevent flakes in queries that return multiple rows, add the rowsort option, the valuesort option, the partialsort option, or an ORDER BY clause. If you are certain that your test will not flake due to a non-deterministic ordering of rows, you can add the nosort option to ignore this error
[07:42:52] --- done: /home/roach/.cache/bazel/_bazel_roach/c5a4e7d36696d9cd970af2045211a7df/sandbox/processwrapper-sandbox/4185/execroot/com_github_cockroachdb_cockroach/bazel-out/k8-fastbuild/bin/pkg/sql/logictest/tests/local/local_test_/local_test.runfiles/com_github_cockroachdb_cockroach/pkg/sql/logictest/testdata/logic_test/select_for_update_read_committed with config local: 37 tests, 1 failures

    logic.go:3998: 
        /home/roach/.cache/bazel/_bazel_roach/c5a4e7d36696d9cd970af2045211a7df/sandbox/processwrapper-sandbox/4185/execroot/com_github_cockroachdb_cockroach/bazel-out/k8-fastbuild/bin/pkg/sql/logictest/tests/local/local_test_/local_test.runfiles/com_github_cockroachdb_cockroach/pkg/sql/logictest/testdata/logic_test/select_for_update_read_committed:181: error while processing
    logic.go:3998: /home/roach/.cache/bazel/_bazel_roach/c5a4e7d36696d9cd970af2045211a7df/sandbox/processwrapper-sandbox/4185/execroot/com_github_cockroachdb_cockroach/bazel-out/k8-fastbuild/bin/pkg/sql/logictest/tests/local/local_test_/local_test.runfiles/com_github_cockroachdb_cockroach/pkg/sql/logictest/testdata/logic_test/select_for_update_read_committed:181: too many errors encountered, skipping the rest of the input
    panic.go:522: -- test log scope end --
test logs left over in: /artifacts/tmp/_tmp/9842ae56c415bac8da2062d2590d733b/logTestLogic_select_for_update_read_committed1621277230
--- FAIL: TestLogic_select_for_update_read_committed (8.38s)
Help

See also: How To Investigate a Go Test Failure (internal)

/cc @cockroachdb/sql-queries

This test on roachdash | Improve this report!

Jira issue: CRDB-32549

@cockroach-teamcity cockroach-teamcity added branch-release-23.2 Used to mark GA and release blockers and technical advisories for 23.2 C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. T-sql-queries SQL Queries Team labels Oct 19, 2023
@cockroach-teamcity cockroach-teamcity added this to the 23.2 milestone Oct 19, 2023
mgartner added a commit to mgartner/cockroach that referenced this issue Oct 19, 2023
The `select_for_update_read_committed` tests were flaking because not
all statements were being run under READ COMMITTED isolation. The logic
test infrastructure does not allow fine-grained control of sessions, and
setting the isolation level in one statement would only apply to a
single session. Subsequent statements are not guaranteed to run in the
same session because they could run in any session in the connection
pool. This commit wraps each statement in an explicitly transaction with
an explicit isolation level to ensure READ COMMITTED is used.

In the future, we should investigate allowing fine-grained and explicit
control of sessions in logic tests.

Fixes cockroachdb#112677

Release note: None
@mgartner mgartner self-assigned this Oct 19, 2023
craig bot pushed a commit that referenced this issue Oct 20, 2023
111713: sql: fix nil-pointer error in local retry r=DrewKimball a=DrewKimball

#### tree: return correct parse error for pg_lsn

This patch changes the error returned upon failing to parse a PG_LSN
value to match postgres. Previously, the error was an internal error.

Informs #111327

Release note: None

#### sql: fix nil-pointer error in local retry

In #105451, we added logic to locally retry a distributed query
after an error. However, the retry logic unconditionally updated a
field of `DistSQLReceiver` that may be nil, which could cause a
nil-pointer error in some code paths (e.g. apply-join). This patch
adds a check that the field is non-nil, as is done for other places
where it is updated.

There is no release note because the change has not yet made it into
a release.

Fixes #111327

Release note: None

112654: opt: fix inverted index constrained scans for equality filters r=mgartner a=mgartner

#### opt: fix inverted index constrained scans for equality filters

This commit fixes a bug introduced in #101178 that allows the optimizer
to generated inverted index scans on columns that are not filtered by
the query. For example, an inverted index over the column `j1` could be
scanned for a filter involving a different column, like `j2 = '5'`. The
bug is caused by a simple omission of code that must check that the
column in the filter is an indexed column.

Fixes #111963

There is no release note because this bug is not present in any
releases.

Release note: None

#### randgen: generate single-column indexes more often

This commit makes `randgen` more likely to generate single-column
indexes. It is motivated by the bug #111963, which surprisingly lived on
the master branch for sixth months without being detected. It's not
entirely clear why TLP or other randomized tests did not catch the bug,
which has such a simple reproduction.

One theory is that indexes tend to be multi-column and constrained scans
on multi-column inverted indexes are not commonly planned for randomly
generated queries because the set of requirements to generate the scan
are very specific: the query must hold each prefix column constant, e.g.
`a=1 AND b=2 AND j='5'::JSON`. The likelihood of randomly generating
such an expression may be so low that the bug was not caught.

By making 10% of indexes single-column, this bug may have been more
likely to be caught because only the inverted index column needs to be
constrained by an equality filter.

Release note: None


112690: sql: disallow invocation of procedures outside of CALL r=mgartner a=mgartner

#### sql: disallow invocation of procedures outside of CALL

This commit adds some missing checks to ensure that procedures cannot be
invoked in any context besides as the root expression in `CALL`
statements.

Epic: CRDB-25388

Release note: None

#### sql: add tests with function invocation in procedure argument

This commit adds a couple of tests that show that functions can be used
in procedure argument expressions.

Release note: None


112698: sql: clarify comments/naming of descriptorChanged flag r=rafiss a=rafiss

fixes #110727
Release note: None

112701: sql/logictest: fix flakes in select_for_update_read_committed r=mgartner a=mgartner

The `select_for_update_read_committed` tests were flaking because not
all statements were being run under READ COMMITTED isolation. The logic
test infrastructure does not allow fine-grained control of sessions, and
setting the isolation level in one statement would only apply to a
single session. Subsequent statements are not guaranteed to run in the
same session because they could run in any session in the connection
pool. This commit wraps each statement in an explicitly transaction with
an explicit isolation level to ensure READ COMMITTED is used.

In the future, we should investigate allowing fine-grained and explicit
control of sessions in logic tests.

Fixes #112677

Release note: None


112726: sql: make tests error if a leaf txn is not created when expected r=rharding6373 a=rharding6373

This adds a test-only error if a leaf transaction is expected to be used by a plan but a root transaction is used instead.

Epic: none
Informs: #111097

Release note: None

112767: log: fix stacktrace test goroutine counts r=rickystewart a=dhartunian

Previously, we would use the count of the string `goroutine ` as a proxy for the number of goroutines in the stacktrace. This stopped working in go 1.21 due to this change:
golang/go@51225f6

We should consider using a stacktrace parser in the future.

Supports #112088

Epic: None
Release note: None

Co-authored-by: Drew Kimball <drewk@cockroachlabs.com>
Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
Co-authored-by: rharding6373 <rharding6373@users.noreply.github.com>
Co-authored-by: David Hartunian <davidh@cockroachlabs.com>
@craig craig bot closed this as completed in 430cffc Oct 20, 2023
@craig craig bot closed this as completed in #112701 Oct 20, 2023
blathers-crl bot pushed a commit that referenced this issue Oct 20, 2023
The `select_for_update_read_committed` tests were flaking because not
all statements were being run under READ COMMITTED isolation. The logic
test infrastructure does not allow fine-grained control of sessions, and
setting the isolation level in one statement would only apply to a
single session. Subsequent statements are not guaranteed to run in the
same session because they could run in any session in the connection
pool. This commit wraps each statement in an explicitly transaction with
an explicit isolation level to ensure READ COMMITTED is used.

In the future, we should investigate allowing fine-grained and explicit
control of sessions in logic tests.

Fixes #112677

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-release-23.2 Used to mark GA and release blockers and technical advisories for 23.2 C-test-failure Broken test (automatically or manually discovered). O-robot Originated from a bot. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants