Skip to content

sql: deflake TestSavepoints#73388

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/deflakeTestSavepoints
Dec 6, 2021
Merged

sql: deflake TestSavepoints#73388
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/deflakeTestSavepoints

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Dec 2, 2021

Fixes #70220.
Fixes #72911.

This commit deflakes TestSavepoints by running the manipulation of the
progress table in a separate SQL connection. This connection is not
subject to the lock_timeout or any other session settings that may be
configured on the other SQL connections in the test.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten and @rytaft)


pkg/sql/conn_executor_savepoints_test.go, line 50 at r1 (raw file):

				return conn
			}
			conn = serverutils.OpenDBConn(

this is too heavy weight I think. You're creating a new connection pool when all you want is one connection. There's DB.Conn() instead, isn't there?

Copy link
Copy Markdown
Contributor Author

@nvb nvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei and @rytaft)


pkg/sql/conn_executor_savepoints_test.go, line 50 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

this is too heavy weight I think. You're creating a new connection pool when all you want is one connection. There's DB.Conn() instead, isn't there?

Is this creating a new connection pool? This is the same code that's in serverutils.StartServer (where origConn came from). And I don't see a DB.Conn().

Copy link
Copy Markdown
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten and @rytaft)


pkg/sql/conn_executor_savepoints_test.go, line 50 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Is this creating a new connection pool? This is the same code that's in serverutils.StartServer (where origConn came from). And I don't see a DB.Conn().

origConn is a conn pool (a sql.DB).
Here's the Conn.
https://pkg.go.dev/database/sql#DB.Conn

Copy link
Copy Markdown
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)

@nvb nvb force-pushed the nvanbenschoten/deflakeTestSavepoints branch from b8145c9 to 7856323 Compare December 2, 2021 19:23
Copy link
Copy Markdown
Contributor Author

@nvb nvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei)


pkg/sql/conn_executor_savepoints_test.go, line 50 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

origConn is a conn pool (a sql.DB).
Here's the Conn.
https://pkg.go.dev/database/sql#DB.Conn

Oh I see, you're completely right. Thanks for calling this out. Done.

Copy link
Copy Markdown
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale) (waiting on @andreimatei and @rytaft)

Fixes cockroachdb#70220.
Fixes cockroachdb#72911.

This commit deflakes `TestSavepoints` by running the manipulation of the
`progress` table in a separate SQL connection. This connection is not
subject to the lock_timeout or any other session settings that may be
configured on the other SQL connections in the test.
@nvb nvb force-pushed the nvanbenschoten/deflakeTestSavepoints branch from 7856323 to c312eb0 Compare December 6, 2021 00:34
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Dec 6, 2021

TFTRs!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 6, 2021

Build succeeded:

@craig craig bot merged commit 7d374fc into cockroachdb:master Dec 6, 2021
@nvb nvb deleted the nvanbenschoten/deflakeTestSavepoints branch December 6, 2021 03:58
craig bot pushed a commit that referenced this pull request Dec 6, 2021
73475: kvclient: cleanup legacy TxnHeartbeating field r=andreimatei a=andreimatei

This field indicates whether the txn heartbeat loop started. 21.2 is not
reading this field; it's only writing it for compatibility with 21.1.
So, it's no longer needed since we're working towards 22.1.

Release note: None

73478: rangecache: fix a span use-after-Finish r=andreimatei a=andreimatei

Lookups of range descriptors use a form of pretty unusual unstructured
concurrency: a request spawns a goroutine that might outlive it (in case
the request is canceled), but at the same time the goroutine wants to be
part of the same trace as the request. Before this patch, the goroutine
was responsible for forking the request's span asynchronously. This was
pretty broken because the request's span might be finished by the time
it's forked. This is a use-after-Finish, and I'm trying to stop
tolerating such uses. This patch fixes it by forking the span
synchronously.

Release note: None

73494: sql: actually deflake TestSavepoints r=nvanbenschoten a=nvanbenschoten

This PR rolls back #73388 and reworks the fix for #70220. #73388 was an incorrect fix because the test relies on the progress table being updated in the same transaction as the rest of the SQL logic. This ensures that progress updates are rolled back when the rest of the transaction is rolled back. I didn't catch this in the initial PR because I missed the fact that the test had been skipped on `master`, so the test appeared to be passing with the change. When I then tried to backport the change in #73492, CI caught the mistake.

The PR then deflakes `TestSavepoints` by increasing the lock timeout significantly (from 1ms to 100ms) in the `rollback_after_lock_timeout` subtest. The test was flaky because after the transaction hits a lock timeout error, it performs an async rollback. If this async rollback hasn't grabbed latches by the time the next txn retry (with a different txn ID) finishes waiting out the lock_timeout when attempting to write to its progress, a lock timeout error would be thrown. This commit makes this extremely unlikely by increasing the lock timeout from 1ms to 100ms. With this new timeout, I've never seen the test flake under stress.

73515: roachtest: fix pgjdbc unexpected pass for ArrayTest in 22.1 r=rafiss a=ZhouXing19

fixes #73298

Release note: None

73525: kv/kvnemesis: skip TestKVNemesisSingleNode r=irfansharif a=irfansharif

Refs: #73373

Reason: flaky test

Generated by bin/skip-test.

Release justification: non-production code changes

Release note: None

Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
Co-authored-by: Jane Xing <zhouxing@uchicago.edu>
Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: TestSavepoints failed sql: TestSavepoints failed

4 participants