From a15cf051885b932bc8ad0a459a2ee3eda6190143 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 12 Aug 2015 15:37:57 -0700 Subject: [PATCH] Optimized notification timestamp clearing * 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 | 2 +- includes/specials/SpecialEditWatchlist.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/User.php b/includes/User.php index 665a68955c..9b958f42dd 100644 --- a/includes/User.php +++ b/includes/User.php @@ -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; diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 910fe259f1..3d688138af 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -102,7 +102,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { case self::EDIT_NORMAL: default: - $this->executeViewEditWatchlist(); + $this->executeViewEditWatchlist(); break; } } -- 2.20.1