commit | ba22868bcf9c5802381d77f4f8a8e8f57049156f | [log] [tgz] |
---|---|---|
author | Dave Borowitz <dborowitz@google.com> | Wed Aug 03 12:54:38 2016 -0400 |
committer | Dave Borowitz <dborowitz@google.com> | Wed Aug 03 12:54:38 2016 -0400 |
tree | 32656213b8bda3d6c662cc8addc7df045c6f359c | |
parent | c66120af5aa776bf1cb4168dc0675e7351bbd90b [diff] |
Fix racy rebuilding when the winning writer fails Consider the following scenario: 1. Thread 1 rebuilds in-memory to state A, and successfully updates the state in ReviewDb to A. 2. Thread 1 attempts the ref update but fails. 3. Thread 2 rebuilds in-memory and gets A again, which throws AbortUpdateException because the state in ReviewDb is already A. Now we are in a state where step (3) repeats indefinitely until there is a write to the change that triggers a NoteDbChangeState update in ReviewDb. At that point it will skip the update of the NoteDb ref, since it's out of date, but the *next* read will go back to step (1) and have another shot at rebuilding it. Fix this by checking the actual state of the refs after an AbortUpdateException, and retrying the ref update if it doesn't match. This has the slight downside that if N threads are trying to rebuild the change at once, likely N-1 or N of them will still fail. However, there's not much we can do in this case: there is no way to tell it to rebuild only if we think there isn't going to be contention on the ref. Because we return the staged results and ignore errors coming from ChangeRebuilder#execute, this shouldn't affect correctness, just performance for the requests doing the rebuild. Change-Id: I6243f94d3e99535d1c1abbea0a1b3f075557d93a
Gerrit is a code review and project management tool for Git based projects.
Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.
Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.
For information about how to install and use Gerrit, refer to the documentation.
Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.
Please report bugs on the issue tracker.
Gerrit is the work of hundreds of contributors. We appreciate your help!
Please read the contribution guidelines.
Note that we do not accept Pull Requests via the Github mirror.
The IRC channel on freenode is #gerrit. An archive is available at: echelog.com.
The Developer Mailing list is repo-discuss on Google Groups.
Gerrit is provided under the Apache License 2.0.
Install Buck and run the following:
git clone --recursive https://gerrit.googlesource.com/gerrit cd gerrit && buck build release
The instruction how to configure GerritForge/BinTray repositories is here
On Debian/Ubuntu run:
apt-get update & apt-get install gerrit=<version>-<release>
NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.
On CentOS/RedHat run:
yum clean all && yum install gerrit-<version>[-<release>]
NOTE: release is optional. Last released package of the version is installed if the release number is omitted.