[JAVA-4240] Remove killAllSessions command execution before every test Created: 16/Jul/21  Updated: 22/Jun/22

Status: Blocked
Project: Java Driver
Component/s: Test Runner
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related

 Description   

The transaction test runner README states that:

Running killAllSessions cleans up any open transactions from a previously failed test to prevent the current test from blocking. It is sufficient to run this command once before starting the test suite and once after each failed test.

Currently the driver executes killAllSessions before every single test in the transaction (and others) test suite. This is unnecessary according to the spec, slows down the test runner a bit, and worse, is also implicated in occasional failed tests against 4.0 sharded clusters.

Let's take each of the requirements one by one:

It is sufficient to run this command once before starting the test suite

To implement this, it's sufficient to do this once at the start of the whole test suite, such as in the static initializer of ClusterFixture.

and once after each failed test.

I think we can eliminate this. The reason is because in the cleanup after every test, we close any ClientSession instances that were used by the test, and the close method already aborts any in-progress transactions.

One could argue that if the test cleanup already aborts all in-progress transactions, it's not necessary to do this at all even on startup. But there are a few cases where the per-test cleanup code does not run reliably:

  • when running tests in the debugger and you hit the stop button
  • when running gradle on the command line and you hit Ctrl-C


 Comments   
Comment by Jeffrey Yemin [ 16/Jul/21 ]

After talking to shane.harvey about this, I think we should wait until DRIVERS-1539 is completed before making this change. I observe that, without that change, whichever test runs after a test that intentionally leave a transaction open takes over a minute to complete.

Generated at Thu Feb 08 09:01:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.