-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
OCI8 transactions are not isolated #4417
Comments
I think this is by design from the OCI standpoint but Doctrine doesn't support this use case. From the documentation:
|
diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
index 8e043ff54..d64b73dc2 100644
--- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
+++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
@@ -62,7 +62,7 @@ class OCI8Connection implements ConnectionInterface, ServerInfoAwareConnection
) {
$dbh = $persistent
? @oci_pconnect($username, $password, $db, $charset, $sessionMode)
- : @oci_connect($username, $password, $db, $charset, $sessionMode);
+ : @oci_new_connect($username, $password, $db, $charset, $sessionMode);
if ($dbh === false) {
throw OCI8Exception::fromErrorInfo(oci_error());
diff --git a/tests/Doctrine/Tests/DBAL/Functional/LockMode/NoneTest.php b/tests/Doctrine/Tests/DBAL/Functional/LockMode/NoneTest.php
index e91dd2a82..39e5cf385 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/LockMode/NoneTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/LockMode/NoneTest.php
@@ -24,11 +24,6 @@ class NoneTest extends DbalFunctionalTestCase
{
parent::setUp();
- if ($this->connection->getDriver() instanceof OCI8\Driver) {
- // https://github.com/doctrine/dbal/issues/4417
- self::markTestSkipped('This test fails on OCI8 for a currently unknown reason');
- }
-
if ($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
// Use row versioning instead of locking on SQL Server (if we don't, the second connection will block when
// attempting to read the row created by the first connection, instead of reading the previous version);
|
Thanks, @morozov. Should |
I would think twice. It may cause a performance impact in terms of establishing a DB connection and, more importantly, using prepared statements. I'm open to adding another connection flag that would use |
TBH, I'd rather make that the default and add an option to use |
It can be done in the next major since it's a breaking change. |
It could be done with an opt-in flag passed as But I don't think this causes performance problems as it would require someone to use two Doctrine Connection objects or connect with exactly the same params outside of Doctrine, where not having isolation from might even be considered dangerous from Doctrine POV. |
Yes, my BC argument was about changing the default.
Not sure how this is relevant to Doctrine. AFAIK, Oracle Instant Client maintains the connections within itself. Hence, the same connection with the same credentials can be reused including all the prepared statements, etc. If they cannot be reused, it may have its side effects. I believe introducing a flag now and changing the default later is fine. |
Bug Report
While creating a failing test case for
LockMode::NONE
on SQL Server & SQL Anywhere in #4415, I noticed that OCI8 fails as well for an unknown reason:https://github.com/doctrine/dbal/pull/4415/checks?check_run_id=1371509666
The behaviour is the following, given two connections,
C1
andC2
:It looks the test works fine on PDO_OCI, so this may be a bug with OCI8.
Possible causes I can think of:
TestUtil::getConnection()
returns the same connection twice?The text was updated successfully, but these errors were encountered: