Thcipriani has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338016 )

Change subject: Add version to ChronologyProtector key
......................................................................

Add version to ChronologyProtector key

This handles incompatible non-namespaced DBMasterPos values
still in cache by ignoring them. The cache value validation
has also been improved.

Bug: T158217
Change-Id: I0e25cd1390e72d8ee0c31e6bb24e9184cbbcf49f
(cherry picked from commit 96f35d42d78e97bb620ec8b6134b427bd793ed2c)
---
M includes/libs/rdbms/ChronologyProtector.php
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/338016/1

diff --git a/includes/libs/rdbms/ChronologyProtector.php 
b/includes/libs/rdbms/ChronologyProtector.php
index 1c28188..8b1aabe 100644
--- a/includes/libs/rdbms/ChronologyProtector.php
+++ b/includes/libs/rdbms/ChronologyProtector.php
@@ -75,7 +75,7 @@
        public function __construct( BagOStuff $store, array $client, $posTime 
= null ) {
                $this->store = $store;
                $this->clientId = md5( $client['ip'] . "\n" . $client['agent'] 
);
-               $this->key = $store->makeGlobalKey( __CLASS__, $this->clientId 
);
+               $this->key = $store->makeGlobalKey( __CLASS__, $this->clientId, 
'v1' );
                $this->waitForPosTime = $posTime;
                $this->logger = new NullLogger();
        }
@@ -301,8 +301,9 @@
 
                $min = null;
                foreach ( $data['positions'] as $pos ) {
-                       /** @var DBMasterPos $pos */
-                       $min = $min ? min( $pos->asOfTime(), $min ) : 
$pos->asOfTime();
+                       if ( $pos instanceof DBMasterPos ) {
+                               $min = $min ? min( $pos->asOfTime(), $min ) : 
$pos->asOfTime();
+                       }
                }
 
                return $min;
@@ -321,8 +322,10 @@
                        $curPositions = $curValue['positions'];
                        // Use the newest positions for each DB master
                        foreach ( $shutdownPositions as $db => $pos ) {
-                               if ( !isset( $curPositions[$db] )
-                                       || $pos->asOfTime() > 
$curPositions[$db]->asOfTime()
+                               if (
+                                       !isset( $curPositions[$db] ) ||
+                                       !( $curPositions[$db] instanceof 
DBMasterPos ) ||
+                                       $pos->asOfTime() > 
$curPositions[$db]->asOfTime()
                                ) {
                                        $curPositions[$db] = $pos;
                                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e25cd1390e72d8ee0c31e6bb24e9184cbbcf49f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.29.0-wmf.12
Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to