From 0da6eaea051953a03ad214475b14aba711cd0fdc Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 30 Aug 2012 10:10:50 -0700 Subject: [PATCH] [FileBackend] Reduce backend sync errors a bit by aborting operations more. Change-Id: Iedb8d7e1f95c971dbb9f9baed67de047753ab40d --- includes/filebackend/FileBackendMultiWrite.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/filebackend/FileBackendMultiWrite.php b/includes/filebackend/FileBackendMultiWrite.php index 59392f6162..9efa0dbbcf 100644 --- a/includes/filebackend/FileBackendMultiWrite.php +++ b/includes/filebackend/FileBackendMultiWrite.php @@ -160,11 +160,14 @@ class FileBackendMultiWrite extends FileBackend { // Actually attempt the operation batch on the master backend... $masterStatus = $mbe->doOperations( $realOps, $opts ); $status->merge( $masterStatus ); - // Propagate the operations to the clone backends... - foreach ( $this->backends as $index => $backend ) { - if ( $index !== $this->masterIndex ) { // not done already - $realOps = $this->substOpBatchPaths( $ops, $backend ); - $status->merge( $backend->doOperations( $realOps, $opts ) ); + // Propagate the operations to the clone backends if there were no fatal errors. + // If $ops only had one operation, this might avoid backend inconsistencies. + if ( !count( $masterStatus->getErrorsArray() ) ) { + foreach ( $this->backends as $index => $backend ) { + if ( $index !== $this->masterIndex ) { // not done already + $realOps = $this->substOpBatchPaths( $ops, $backend ); + $status->merge( $backend->doOperations( $realOps, $opts ) ); + } } } // Make 'success', 'successCount', and 'failCount' fields reflect -- 2.20.1