jenkins-bot has submitted this change and it was merged. Change subject: Add max retry for all updates ......................................................................
Add max retry for all updates Technically we could use elasticsearch's external versioning to catch update failures gracefully and decide that they aren't needed. That would require some careful thought so (at least for now) we're just adding a retry. This is safe (if not performance optimal) because every time we send an update to Elasticsearch we send the most recent version of the page. Noop unless I7e82ce6b64e8599ae004a6d41596e2138079f724 is also deployed. Change-Id: I7a7d20ae95ebd164bc39368ad34b2614d470b81b --- M CirrusSearch.php M includes/Updater.php 2 files changed, 12 insertions(+), 0 deletions(-) Approvals: Chad: Looks good to me, approved jenkins-bot: Verified diff --git a/CirrusSearch.php b/CirrusSearch.php index d278108..2f289e2 100644 --- a/CirrusSearch.php +++ b/CirrusSearch.php @@ -302,6 +302,15 @@ // friends. $wgCirrusSearchBannedPlugins = array(); +// Number of times to instruct Elasticsearch to retry updates that fail on +// version conflicts. While we do have a version for each page in mediawiki +// (the revision timestamp) using it for versioning is a bit tricky because +// Cirrus uses two pass indexing the first time and sometimes needs to force +// updates. This is simpler but theoretically will put more load on +// Elasticsearch. At this point, though, we believe the load not to be +// substantial. +$wgCirrusSearchUpdateConflictRetryCount = 5; + $includes = __DIR__ . "/includes/"; $buildDocument = $includes . 'BuildDocument/'; /** diff --git a/includes/Updater.php b/includes/Updater.php index 80c2bbd..f9cef39 100644 --- a/includes/Updater.php +++ b/includes/Updater.php @@ -241,6 +241,8 @@ } private function buildDocumentsForPages( $pages, $flags ) { + global $wgCirrusSearchUpdateConflictRetryCount; + $profiler = new ProfileSection( __METHOD__ ); $indexOnSkip = $flags & self::INDEX_ON_SKIP; @@ -276,6 +278,7 @@ // are objects in both doc and the indexed source. We're ok with this because all of our fields are either // regular types or lists of objects and lists are overwritten. $doc->setDocAsUpsert( $fullDocument || $indexOnSkip ); + $doc->setRetryOnConflict( $wgCirrusSearchUpdateConflictRetryCount ); $documents[] = $doc; wfProfileOut( __METHOD__ . '-basic' ); -- To view, visit https://gerrit.wikimedia.org/r/136746 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7a7d20ae95ebd164bc39368ad34b2614d470b81b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: Chad <ch...@wikimedia.org> Gerrit-Reviewer: Manybubbles <never...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits