From 4b29fa376f8ee67fa29aa763de6a0af1ee47c59e Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 30 Aug 2012 12:17:28 -0700 Subject: [PATCH] [FileBackend] Improved getLocalCopy() performance for Swift. * This eliminates HEAD requests to speed up concatenate() operations (by ~9 seconds for 300 chunks for wmf). Change-Id: I43456bd59eeb7943e66cae9c1e42dc410c2a8daf --- includes/filebackend/SwiftFileBackend.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 6f078e8710..9081e82650 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -989,11 +989,8 @@ class SwiftFileBackend extends FileBackendStore { return null; } - # Check the recursion guard to avoid loops when filling metadata - if ( empty( $params['nostat'] ) && !$this->fileExists( $params ) ) { - return null; - } - + // Blindly create a tmp file and stream to it, catching any exception if the file does + // not exist. Also, doing a stat here will cause infinite loops when filling metadata. $tmpFile = null; try { $sContObj = $this->getContainer( $srcCont ); @@ -1013,6 +1010,8 @@ class SwiftFileBackend extends FileBackendStore { } } catch ( NoSuchContainerException $e ) { $tmpFile = null; + } catch ( NoSuchObjectException $e ) { + $tmpFile = null; } catch ( CloudFilesException $e ) { // some other exception? $tmpFile = null; $this->handleException( $e, null, __METHOD__, $params ); -- 2.20.1