Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/246083

Change subject: Revert "Enforce lagged-slave read-only mode on the DB layer"
......................................................................

Revert "Enforce lagged-slave read-only mode on the DB layer"

This reverts commit db170ebe78a9888b4966cc934f9571ee22ad2821.

Change-Id: I5bce3b46ebcc1f6ec4149f7aff01f2ec47ecd820
---
M autoload.php
M includes/db/Database.php
M includes/db/DatabaseError.php
M includes/db/loadbalancer/LoadBalancer.php
4 files changed, 3 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/246083/1

diff --git a/autoload.php b/autoload.php
index 673072b..9208744 100644
--- a/autoload.php
+++ b/autoload.php
@@ -288,7 +288,6 @@
        'DBLockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/DBLockManager.php',
        'DBMasterPos' => __DIR__ . '/includes/db/DatabaseUtility.php',
        'DBQueryError' => __DIR__ . '/includes/db/DatabaseError.php',
-       'DBReadOnlyError' => __DIR__ . '/includes/db/DatabaseError.php',
        'DBSiteStore' => __DIR__ . '/includes/site/DBSiteStore.php',
        'DBUnexpectedError' => __DIR__ . '/includes/db/DatabaseError.php',
        'DataUpdate' => __DIR__ . '/includes/deferred/DataUpdate.php',
diff --git a/includes/db/Database.php b/includes/db/Database.php
index 811a4a7..70b6e60 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -927,9 +927,9 @@
 
                $isWriteQuery = $this->isWriteQuery( $sql );
                if ( $isWriteQuery ) {
-                       $reason = $this->getLBInfo( 'readOnlyReason' );
-                       if ( is_string( $reason ) ) {
-                               throw new DBReadOnlyError( $this, "Database is 
read-only: $reason" );
+                       if ( !$this->mDoneWrites ) {
+                               wfDebug( __METHOD__ . ': Writes done: ' .
+                                       DatabaseBase::generalizeSQL( $sql ) . 
"\n" );
                        }
                        # Set a flag indicating that writes have been done
                        $this->mDoneWrites = microtime( true );
diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php
index 6453854..928de61 100644
--- a/includes/db/DatabaseError.php
+++ b/includes/db/DatabaseError.php
@@ -451,9 +451,3 @@
  */
 class DBUnexpectedError extends DBError {
 }
-
-/**
- * @ingroup Database
- */
-class DBReadOnlyError extends DBError {
-}
diff --git a/includes/db/loadbalancer/LoadBalancer.php 
b/includes/db/loadbalancer/LoadBalancer.php
index fbc8c8c..903f208 100644
--- a/includes/db/loadbalancer/LoadBalancer.php
+++ b/includes/db/loadbalancer/LoadBalancer.php
@@ -548,14 +548,6 @@
                        $trxProf->recordConnection( $host, $dbname, $masterOnly 
);
                }
 
-               # Make master connections read only if in lagged slave mode
-               if ( $masterOnly && $this->getServerCount() > 1 && 
$this->getLaggedSlaveMode() ) {
-                       $conn->setLBInfo( 'readOnlyReason',
-                               'The database has been automatically locked ' .
-                               'while the slave database servers catch up to 
the master'
-                       );
-               }
-
                return $conn;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bce3b46ebcc1f6ec4149f7aff01f2ec47ecd820
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.3
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to