-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
WIP: Remove CommitStatus.Index
field.
#14160
Conversation
I don't understand the mysql8 test failure? Did something timeout?
|
It seems it's timeout. unrelated with your PR. |
Codecov Report
@@ Coverage Diff @@
## master #14160 +/- ##
==========================================
- Coverage 42.01% 41.99% -0.02%
==========================================
Files 733 733
Lines 78704 78691 -13
==========================================
- Hits 33070 33050 -20
- Misses 40202 40208 +6
- Partials 5432 5433 +1
Continue to review full report at Codecov.
|
ID int64 `xorm:"pk autoincr"` | ||
Index int64 `xorm:"INDEX UNIQUE(repo_sha_index)"` | ||
RepoID int64 `xorm:"INDEX UNIQUE(repo_sha_index)"` | ||
ID int64 `xorm:"pk autoincr INDEX UNIQUE(repo_sha_id)"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no point in adding Id to unique index as all records will be unique anyway, PK already guarantees that. It needs to be rechecked why unique index was set. (Maybe context needs to be added to that uq?)
I figured the original usage was to aid the Although that said, the small amount or records for a specific SHA probably wont be that expensive to order without an index. If there is no other usage for that index, maybe it could be removed. From mysql docs:
|
Firstly, thanks for your work! |
I will continue the work based on #15599 |
The problem is if two
commit status
updates come in simultaneously, they get the sameIndex
value, and fail to insert into db, resulting in missing data. (described in and fixes #14059)As far as I can tell this field is only used to know the sequence for commit statuses of one commit. This can be calculated from the
ID
field, with no need for the additionalIndex
field.This PR removes the
Index
field and refactors the ordering to use theID
field.I see no other use of
CommitStatus.Index
, apart from the API exposes ID which used to map toIndex
and I've changed this to map toID
.TODO
Index
fieldID
instead ofIndex