Optimized notification timestamp clearing
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 12 Aug 2015 22:37:57 +0000 (15:37 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 12 Aug 2015 22:37:57 +0000 (15:37 -0700)
* Hint that mariadb can avoid scanning already NULL rows since
  we want to set them all to NULL. This lets the index with the
  timestamp be used, which avoids logs of scanning for users with
  many rows. For non-parallel replication, this also avoids slave
  lag in particular.

Bug: T107923
Change-Id: I8cded5476ef6adb2f8fea57239afd6e9b2a49708

includes/User.php
includes/specials/SpecialEditWatchlist.php

index 665a689..9b958f4 100644 (file)
@@ -3459,7 +3459,7 @@ class User implements IDBAccessObject {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->update( 'watchlist',
                                array( /* SET */ 'wl_notificationtimestamp' => null ),
-                               array( /* WHERE */ 'wl_user' => $id ),
+                               array( /* WHERE */ 'wl_user' => $id, 'wl_notificationtimestamp IS NOT NULL' ),
                                __METHOD__
                        );
                        // We also need to clear here the "you have new message" notification for the own user_talk page;
index 910fe25..3d68813 100644 (file)
@@ -102,7 +102,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
 
                        case self::EDIT_NORMAL:
                        default:
-                       $this->executeViewEditWatchlist();
+                               $this->executeViewEditWatchlist();
                                break;
                }
        }