From 1a8f61e60699c16d1356431987c88c1eb4fc8e84 Mon Sep 17 00:00:00 2001 From: Neil Kandalgaonkar Date: Tue, 20 Dec 2011 23:02:42 +0000 Subject: [PATCH] fix race condition in UploadFromChunks, followup to r104687 --- includes/upload/UploadFromChunks.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 01bc111ee6..3a5f8099be 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -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', -- 2.20.1