Pass only Change.Id for async background indexing

The background worker thread creates its own database connection
to read the record. The change could have been modified between
the time it is enqueued, and the time the indexing is processed.
Always read from the database in the background thread to ensure
the index gets the most recent possible data.

This may fix some index state errors on gerrit-review (and friends).

Change-Id: Ifab8d0ba7c9dcac54b7e168b86e9a82a3c681ea5
This commit is contained in:
Shawn Pearce
2013-12-30 14:42:08 -08:00
parent b9e64c2704
commit 6f3453863a
9 changed files with 26 additions and 23 deletions

View File

@@ -228,7 +228,8 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
db.rollback();
}
CheckedFuture<?, IOException> indexFuture = indexer.indexAsync(rsrc.getChange());
CheckedFuture<?, IOException> indexFuture =
indexer.indexAsync(rsrc.getChange().getId());
result.reviewers = Lists.newArrayListWithCapacity(added.size());
for (PatchSetApproval psa : added) {
result.reviewers.add(json.format(