Fix SqlBagOStuff exptime uniqueness assumption
authorTim Starling <tstarling@wikimedia.org>
Sat, 10 Jun 2017 10:54:23 +0000 (20:54 +1000)
committerTim Starling <tstarling@wikimedia.org>
Sat, 10 Jun 2017 10:54:23 +0000 (20:54 +1000)
The WMF parser cache tables have some 30000 rows with an identical, old
expiry time. So each time deleteObjectsExpiringBefore() is run, the
first batch on each table is correct, but the keys for the second batch
are selected with exptime > X, where X is shared exptime of the many old
rows.

So, use exptime >= X instead.

Change-Id: I6853f64f88f65d4529be2a42c9ed70cfa62cf653

includes/objectcache/SqlBagOStuff.php

index a4a6ba8..6c10301 100644 (file)
@@ -588,7 +588,7 @@ class SqlBagOStuff extends BagOStuff {
                                        while ( true ) {
                                                $conds = $baseConds;
                                                if ( $maxExpTime !== false ) {
-                                                       $conds[] = 'exptime > ' . $db->addQuotes( $maxExpTime );
+                                                       $conds[] = 'exptime >= ' . $db->addQuotes( $maxExpTime );
                                                }
                                                $rows = $db->select(
                                                        $this->getTableNameByShard( $i ),