Fix caching of /detail for modified reviewer lists

Rely only on ETag for change entity caching. The Last-Modified
value was derived from the lastUpdatedOn property, which is not
always modified when children are updated.

When adding or removing reviewers from a change perform a no-op
modification of the Change entity. This bumps its rowVersion as
a side-effect of the database mutation, causing the ETag to be
different on the next read.

Change-Id: If480f92b419041e7d62839ab12211058e78f828f
This commit is contained in:
Shawn Pearce
2013-07-23 14:23:55 -07:00
parent c541d31f1c
commit 5d182ddba9
4 changed files with 32 additions and 16 deletions

View File

@@ -25,6 +25,7 @@ import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.ChangeUtil;
import com.google.gerrit.server.change.DeleteReviewer.Input;
import com.google.gerrit.server.project.ChangeControl;
import com.google.gwtorm.server.OrmException;
@@ -63,6 +64,7 @@ public class DeleteReviewer implements RestModifyView<ReviewerResource, Input> {
if (del.isEmpty()) {
throw new ResourceNotFoundException();
}
ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db);
db.patchSetApprovals().delete(del);
db.commit();
} finally {