jenkins-bot has submitted this change and it was merged.

Change subject: Oracle: DRCP and persistent connections support
......................................................................


Oracle: DRCP and persistent connections support

Adds $wgDBOracleDRCP, when set to true, enables persistent connection
with DRCP on Oracle.

Requires Oracle DB 11gR1 or above. More informations about DRCP can be
found at:
http://www.oracle-base.com/articles/11g/database-resident-connection-pool-11gr1.php

Change-Id: I2be7120a2ebec39d866b79be62ac715bbc3738a9
---
M RELEASE-NOTES-1.22
M includes/DefaultSettings.php
M includes/db/DatabaseOracle.php
3 files changed, 45 insertions(+), 1 deletion(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22
index a26c7d8..000f6b1 100644
--- a/RELEASE-NOTES-1.22
+++ b/RELEASE-NOTES-1.22
@@ -26,6 +26,7 @@
 * $wgHandheldStyle was removed.
 * $wgJsMimeType is no longer used by core. Most usage has been removed since
   HTML output is now exclusively HTML5.
+* $wgDBOracleDRCP added. True enables persistent connection with DRCP on 
Oracle.
 
 === New features in 1.22 ===
 * (bug 44525) mediawiki.jqueryMsg can now parse (whitelisted) HTML elements 
and attributes.
@@ -86,6 +87,12 @@
   HTTP caches when a page is changed.
 * Changed the patrolling system to always show the link for patrolling in case 
the
   current revision is patrollable. This also removed the usage of the rcid URI 
parameters.
+* Oracle DB backend now supports Database Resident Connection Pooling (DRCP).
+  Can be enabled by setting $wgDBOracleDRCP=true.
+  Requires Oracle DB 11gR1 or above, enabled DRCP inside the DB itself and a
+  propper connect string.
+  More about DRCP can be found at:
+  
http://www.oracle-base.com/articles/11g/database-resident-connection-pool-11gr1.php
 
 === Bug fixes in 1.22 ===
 * Disable Special:PasswordReset when $wgEnableEmail is false. Previously one
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 173605c..29d3127 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1590,6 +1590,35 @@
 $wgDBmysql5 = false;
 
 /**
+ * Set true to enable Oracle DCRP (supported from 11gR1 onward)
+ *
+ * To use this feature set to true and use a datasource defined as
+ * POOLED (i.e. in tnsnames definition set server=pooled in connect_data
+ * block).
+ *
+ * Starting from 11gR1 you can use DCRP (Database Resident Connection
+ * Pool) that maintains established sessions and reuses them on new
+ * connections.
+ *
+ * Not completely tested, but it should fall back on normal connection
+ * in case the pool is full or the datasource is not configured as
+ * pooled.
+ * And the other way around; using oci_pconnect on a non pooled
+ * datasource should produce a normal connection.
+ *
+ * When it comes to frequent shortlived DB connections like with MW
+ * Oracle tends to s***. The problem is the driver connects to the
+ * database reasonably fast, but establishing a session takes time and
+ * resources. MW does not rely on session state (as it does not use
+ * features such as package variables) so establishing a valid session
+ * is in this case an unwanted overhead that just slows things down.
+ *
+ * @warning EXPERIMENTAL!
+ *
+ */
+$wgDBOracleDRCP = false;
+
+/**
  * Other wikis on this site, can be administered from a single developer
  * account.
  * Array numeric key => database name
diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php
index 4fa2397..c0d3805 100644
--- a/includes/db/DatabaseOracle.php
+++ b/includes/db/DatabaseOracle.php
@@ -249,6 +249,7 @@
         * @return DatabaseBase|null
         */
        function open( $server, $user, $password, $dbName ) {
+               global $wgDBOracleDRCP;
                if ( !function_exists( 'oci_connect' ) ) {
                        throw new DBConnectionError( $this, "Oracle functions 
missing, have you compiled PHP with the --with-oci8 option?\n (Note: if you 
recently installed PHP, you may need to restart your webserver and database)\n" 
);
                }
@@ -276,9 +277,16 @@
                        return;
                }
 
+               if ( $wgDBOracleDRCP ) {
+                       $this->setFlag( DBO_PERSISTENT );
+               }
+
                $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : 
OCI_DEFAULT;
+
                wfSuppressWarnings();
-               if ( $this->mFlags & DBO_DEFAULT ) {
+               if ( $this->mFlags & DBO_PERSISTENT ) {
+                       $this->mConn = oci_pconnect( $this->mUser, 
$this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
+               } else if ( $this->mFlags & DBO_DEFAULT ) {
                        $this->mConn = oci_new_connect( $this->mUser, 
$this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
                } else {
                        $this->mConn = oci_connect( $this->mUser, 
$this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );

-- 
To view, visit https://gerrit.wikimedia.org/r/65279
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2be7120a2ebec39d866b79be62ac715bbc3738a9
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Freakolowsky <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Asher <[email protected]>
Gerrit-Reviewer: Freakolowsky <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to