Hoo man has uploaded a new change for review.

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

Change subject: Add debug logging for the case that the API goes read only
......................................................................

Add debug logging for the case that the API goes read only

Useful for tasks like T123867.

Change-Id: I39a65047eac05b9e0268a9184b9fae4c48e66ce9
---
M includes/api/ApiMain.php
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/95/264595/1

diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 6ddc28a..7d1c241 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1183,14 +1183,23 @@
                        // Figure out how many servers have passed the lag 
threshold
                        $numLagged = 0;
                        $lagLimit = $this->getConfig()->get( 
'APIMaxLagThreshold' );
-                       foreach ( wfGetLB()->getLagTimes() as $lag ) {
+                       $laggedServers = array();
+                       foreach ( wfGetLB()->getLagTimes() as $serverIndex => 
$lag ) {
                                if ( $lag > $lagLimit ) {
                                        ++$numLagged;
+                                       $laggedServers[] = 
wfGetLB()->getServerName( $serverIndex );
                                }
                        }
+
                        // If a majority of slaves are too lagged then disallow 
writes
                        $slaveCount = wfGetLB()->getServerCount() - 1;
                        if ( $numLagged >= ceil( $slaveCount / 2 ) ) {
+                               $laggedServers = join( ', ', $laggedServers );
+                               wfDebugLog(
+                                       'api-readonly',
+                                       'The wiki went read only because the 
following DBs are lagged: ' . $laggedServers
+                               );
+
                                $parsed = $this->parseMsg( array( 
'readonlytext' ) );
                                $this->dieUsage(
                                        $parsed['info'],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I39a65047eac05b9e0268a9184b9fae4c48e66ce9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

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

Reply via email to