jenkins-bot has submitted this change and it was merged.

Change subject: Make chunked upload jobs robust in face of exceptions.
......................................................................


Make chunked upload jobs robust in face of exceptions.

If an exception occurs when creating the new image page during
PublishStashedFile (for example, if ExternalStorage servers
become overloaded), the job is aborted, but the current
transaction is not aborted. Then the next job comes along, does
$dbw->begin(), which implicitly commits the current open
transactions, causing database corruption (entries in page table
with page_latest = 0).

This patch ensures that if some unknown exception occurs during
the job, that the database gets rolled back to a known good state.

I also plan to make a separate patch to make the recordUpload
code handle exceptions properly. Nonetheless, I think its
important that the general job code be as robust as possible.

Bug: 32551
Change-Id: Icb5e06e81700e5dcf0d4e739c7b2bb3221e718b8
---
M includes/jobqueue/jobs/AssembleUploadChunksJob.php
M includes/jobqueue/jobs/PublishStashedFileJob.php
2 files changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/jobqueue/jobs/AssembleUploadChunksJob.php 
b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
index 19b0558..9e9bda6 100644
--- a/includes/jobqueue/jobs/AssembleUploadChunksJob.php
+++ b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
@@ -112,6 +112,8 @@
                                )
                        );
                        $this->setLastError( get_class( $e ) . ": " . 
$e->getText() );
+                       // To be extra robust.
+                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
 
                        return false;
                }
diff --git a/includes/jobqueue/jobs/PublishStashedFileJob.php 
b/includes/jobqueue/jobs/PublishStashedFileJob.php
index d7667f3..918a392 100644
--- a/includes/jobqueue/jobs/PublishStashedFileJob.php
+++ b/includes/jobqueue/jobs/PublishStashedFileJob.php
@@ -125,6 +125,9 @@
                                )
                        );
                        $this->setLastError( get_class( $e ) . ": " . 
$e->getText() );
+                       // To prevent potential database referential integrity 
issues.
+                       // See bug 32551.
+                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
 
                        return false;
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/124135
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icb5e06e81700e5dcf0d4e739c7b2bb3221e718b8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to