SqlBagOStuff: fix percentage in deleteObjectsExpiringBefore()
authorSergio Santoro <santoro.srg@gmail.com>
Thu, 16 Oct 2014 18:43:38 +0000 (20:43 +0200)
committerSergio Santoro <santoro.srg@gmail.com>
Thu, 16 Oct 2014 18:43:38 +0000 (20:43 +0200)
Partial deletion percentage progess was computed using
$remainingSeconds. This is incorrect since $remainingSeconds
is going to *decrease* ( instead of increase ) while the
process continues.
The correct implementation uses 'processed seconds' instead.

Change-Id: Ic745f6e8375a85da543de36703fad6d31f62ea90

includes/objectcache/SqlBagOStuff.php

index 3b0f816..d8d86db 100644 (file)
@@ -621,7 +621,8 @@ class SqlBagOStuff extends BagOStuff {
                                                                if ( $remainingSeconds > $totalSeconds ) {
                                                                        $totalSeconds = $remainingSeconds;
                                                                }
-                                                               $percent = ( $i + $remainingSeconds / $totalSeconds )
+                                                               $processedSeconds = $totalSeconds - $remainingSeconds;
+                                                               $percent = ( $i + $processedSeconds / $totalSeconds )
                                                                        / $this->shards * 100;
                                                        }
                                                        $percent = ( $percent / $this->numServers )