fix race condition in UploadFromChunks, followup to r104687
authorNeil Kandalgaonkar <neilk@users.mediawiki.org>
Tue, 20 Dec 2011 23:02:42 +0000 (23:02 +0000)
committerNeil Kandalgaonkar <neilk@users.mediawiki.org>
Tue, 20 Dec 2011 23:02:42 +0000 (23:02 +0000)
includes/upload/UploadFromChunks.php

index 01bc111..3a5f809 100644 (file)
@@ -187,8 +187,10 @@ class UploadFromChunks extends UploadFromFile {
         * Get the chunk db state and populate update relevant local values
         */
        private function getChunkStatus(){
-               $dbr = $this->repo->getSlaveDb();
-               $row = $dbr->selectRow(
+               // get Master db to avoid race conditions. 
+               // Otherwise, if chunk upload time < replag there will be spurious errors
+               $dbw = $this->repo->getMasterDb();
+               $row = $dbw->selectRow(
                        'uploadstash', 
                        array( 
                                'us_chunk_inx',