-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Clarify LockMode::NONE #4391
Comments
I believe this is one of those DBAL features that were implemented w/o integration testing and as a result in a non-portable way, so I cannot answer your question. You are welcome to do the research and propose the changes that will make this API clearer and/or better portable between the DB platforms. |
I came across this issue when I explicitly used Now that SQLAnywhere is gone, we're only left with the special case of SQLServer. public function appendLockHint($fromClause, $lockMode)
{
switch (true) {
case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (UPDLOCK, ROWLOCK)';
default:
return $fromClause;
}
} All the other platforms only get a chance to set a hint via Here is a detailed comparison of the behaviour in the ORM:
So, SQL Server is the only platform to make the distinction between no lock mode ( Because Proposed resolution:
Proposed improvement:
|
Created #4400 which fixes the issue on Doc for SQLAnywhere: http://dcx.sap.com/1200/fr/dbreference/from-statement.html
Which is consistent with the behaviour on SQL Server. |
This fixes the issue detailed in doctrine#4391, with SQL Server and SQL Anywhere setting WITH (NOLOCK) for LockMode::NONE, which effectively means using a READ UNCOMMITTED isolation level at table level, which is not the contract of LockMode::NONE.
This fixes the issue detailed in doctrine#4391, with SQL Server and SQL Anywhere setting WITH (NOLOCK) for LockMode::NONE, which effectively means using a READ UNCOMMITTED isolation level at table level, which is not the contract of LockMode::NONE.
@BenMorel do you expect any more work done on this issue? Otherwise, it can be closed. |
Nope, we can continue the discussion in doctrine/orm#8341 now. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I feel like there is some confusion with
LockMode::NONE
.In all platforms but SQLServer and SQLAnywhere,
LockMode::NONE
is equivalent to not giving a lock hint.I these 2 platforms however,
LockMode::NONE
adds aWITH (NOLOCK)
hint, which as I understand it, allows dirty reads, effectively changing the isolation level to READ UNCOMMITTED for this table.Is this really what was intended?
In the ORM for example, using
null
as a lock mode inEntityManager::find()
is different from usingLockMode::NONE
, but only on these 2 platforms:null
LockMode::NONE
WITH(NOLOCK)
And the read semantics are therefore different across platforms for
LockMode::NONE
, which I believe is a bug.The text was updated successfully, but these errors were encountered: