-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Long running operations causes SQL timeout #6688
Conversation
… the sql provider based on the db type
foreach (var lockId in lockIds) | ||
{ | ||
db.Execute(@"SET LOCK_TIMEOUT 1800;"); | ||
var i = db.Execute(@"UPDATE umbracoLock WITH (REPEATABLEREAD) SET value = value*-1 WHERE id=@id", new { id = lockId }); |
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.
if by accident the value has been set to zero this does not lock - hence the original CASE
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.
@zpqrtbnk, is there ways this can happen other than people manipulating the database them self? I wonder why we handle this special case?
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.
no, it was "assume garbage in" but not critical - you decide
Will this help for #6735 as well? |
@nul800sebastiaan probably not.. This fixes unintended locking.. Slow queries are still slow. |
…thing invalid directly in the database, and fixed tes
Moves read/write locking and isolation level to the responsibility of the sql provider based on the db type and changes Sql server to use
ReadCommitted
for normal SQL calls andRepeatableRead
for when working with distributed locks.This is a trimmed down version of this PR #6029
Changes
ReadCommitted
and then ensures we only useRepeatableRead
when creating/reading the distributed locks using the ReadLock/WriteLock methods. This means that long running operations/transactions are not going to block all reads from the database which have resulted in timeout errorsRepeatableRead
since it does not support isolation mode per queryTesting