-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
WIP: Duplicate Issue.Index stress test #8005
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
Conversation
Example output expected from the test (PostgreSQL, FAIL):
|
Codecov Report
@@ Coverage Diff @@
## master #8005 +/- ##
=========================================
Coverage ? 41.59%
=========================================
Files ? 479
Lines ? 64106
Branches ? 0
=========================================
Hits ? 26668
Misses ? 33982
Partials ? 3456 Continue to review full report at Codecov.
|
Example output expected from the test (SQLite, only database engine to PASS):
|
Example output expected from the test (MSSQL, FAIL):
|
Example output expected from the test (MYSQL, FAIL):
|
All the tests again, but with useTransactions = falseSQLitePASS (same result) PostgreSQLFAIL (different error, more rows inserted)
MySQLFAIL (different error)
MSSQLFAIL (same error, more rows inserted)
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
This research is indeed stalled. It was partially fixed elsewhere, anyway. |
This is a stress test for the
models.newIssue()
function, which is expected to fail under big server loads. The problem is a duplicate key error due to the way the function calculates the value for theIndex
column. See #7887 and #7898.The test only compiles when the
stress
tag is specified because it always fails (as expected). EDIT: except for SQLite with sqlite_unlock_notify.Note: I know the code needs refactoring. I'd like some help with that, as I couldn't figure out the proper way to do it.
The code is meant to be run under
integrations/
so one day, when the duplicate key is resolved, the test can be run for every database in the CI (AFAIK the CI does not run tests in themodels
package for all databases; only for SQLite).What the test does
First the test creates a relatively large number of rows in the
Issues
table (default=1000) to make the table grow by at least two blocks.Then, the test spawns several goroutines (default=8) to simulate multiple users attempting to create issues on the server at the same time.
The goroutines keep calling
models.newIssue()
as quickly as they can, and stop when any of the following is true:So, the test should take at most ~60 seconds if successful, or less if it fails.
The reason the code attempts with 8 goroutines and not -say- 1000 is because it's not realistic to expect the database to have a connection pool that big. As long as the goroutines keep inserting continuously, this test is equivalent and gets the server to spend more time doing database stuff and less time doing process synchronization.