| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - System Design |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 2 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 3 | == Objective |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 4 | |
| 5 | Gerrit is a web based code review system, facilitating online code |
| 6 | reviews for projects using the Git version control system. |
| 7 | |
| 8 | Gerrit makes reviews easier by showing changes in a side-by-side |
| Bruce Zu | 6b0fd76 | 2012-10-25 16:52:00 +0800 | [diff] [blame] | 9 | display, and allowing inline/file comments to be added by any reviewer. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 10 | |
| 11 | Gerrit simplifies Git based project maintainership by permitting |
| 12 | any authorized user to submit changes to the master Git repository, |
| 13 | rather than requiring all approved changes to be merged in by |
| 14 | hand by the project maintainer. This functionality enables a more |
| 15 | centralized usage of Git. |
| 16 | |
| 17 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 18 | == Background |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 19 | |
| 20 | Google developed Mondrian, a Perforce based code review tool to |
| 21 | facilitate peer-review of changes prior to submission to the central |
| 22 | code repository. Mondrian is not open source, as it is tied to the |
| 23 | use of Perforce and to many Google-only services, such as Bigtable. |
| 24 | Google employees have often described how useful Mondrian and its |
| 25 | peer-review process is to their day-to-day work. |
| 26 | |
| 27 | Guido van Rossum open sourced portions of Mondrian within Rietveld, |
| 28 | a similar code review tool running on Google App Engine, but for |
| 29 | use with Subversion rather than Perforce. Rietveld is in common |
| 30 | use by many open source projects, facilitating their peer reviews |
| 31 | much as Mondrian does for Google employees. Unlike Mondrian and |
| 32 | the Google Perforce triggers, Rietveld is strictly advisory and |
| 33 | does not enforce peer-review prior to submission. |
| 34 | |
| 35 | Git is a distributed version control system, wherein each repository |
| 36 | is assumed to be owned/maintained by a single user. There are no |
| David Pursehouse | 221d4f6 | 2012-06-08 17:38:08 +0900 | [diff] [blame] | 37 | inherent security controls built into Git, so the ability to read |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 38 | from or write to a repository is controlled entirely by the host's |
| 39 | filesystem access controls. When multiple maintainers collaborate |
| 40 | on a single shared repository a high degree of trust is required, |
| 41 | as any collaborator with write access can alter the repository. |
| 42 | |
| 43 | Gitosis provides tools to secure centralized Git repositories, |
| 44 | permitting multiple maintainers to manage the same project at once, |
| 45 | by restricting the access to only over a secure network protocol, |
| 46 | much like Perforce secures a repository by only permitting access |
| 47 | over its network port. |
| 48 | |
| 49 | The Android Open Source Project (AOSP) was founded by Google by the |
| 50 | open source releasing of the Android operating system. AOSP has |
| 51 | selected Git as its primary version control tool. As many of the |
| 52 | engineers have a background of working with Mondrian at Google, |
| 53 | there is a strong desire to have the same (or better) feature set |
| 54 | available for Git and AOSP. |
| 55 | |
| Shawn O. Pearce | 4a7f6fa | 2009-02-17 17:14:56 -0800 | [diff] [blame] | 56 | Gerrit Code Review started as a simple set of patches to Rietveld, |
| 57 | and was originally built to service AOSP. This quickly turned |
| 58 | into a fork as we added access control features that Guido van |
| 59 | Rossum did not want to see complicating the Rietveld code base. As |
| 60 | the functionality and code were starting to become drastically |
| 61 | different, a different name was needed. Gerrit calls back to the |
| 62 | original namesake of Rietveld, Gerrit Rietveld, a Dutch architect. |
| 63 | |
| Shawn O. Pearce | e31d02c | 2009-12-08 12:21:37 -0800 | [diff] [blame] | 64 | Gerrit 2.x is a complete rewrite of the Gerrit fork, completely |
| 65 | changing the implementation from Python on Google App Engine, to Java |
| David Pursehouse | 3be717b | 2013-05-13 13:56:11 +0900 | [diff] [blame] | 66 | on a J2EE servlet container and an SQL database. |
| Shawn O. Pearce | 4a7f6fa | 2009-02-17 17:14:56 -0800 | [diff] [blame] | 67 | |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 68 | * link:http://video.google.com/videoplay?docid=-8502904076440714866[Mondrian Code Review On The Web] |
| Shawn Pearce | 792b2c4 | 2015-06-12 17:25:40 -0700 | [diff] [blame] | 69 | * link:https://github.com/rietveld-codereview/rietveld[Rietveld - Code Review for Subversion] |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 70 | * link:http://eagain.net/gitweb/?p=gitosis.git;a=blob;f=README.rst;hb=HEAD[Gitosis README] |
| 71 | * link:http://source.android.com/[Android Open Source Project] |
| 72 | |
| 73 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 74 | == Overview |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 75 | |
| 76 | Developers create one or more changes on their local desktop system, |
| 77 | then upload them for review to Gerrit using the standard `git push` |
| 78 | command line program, or any GUI which can invoke `git push` on |
| 79 | behalf of the user. Authentication and data transfer are handled |
| 80 | through SSH. Users are authenticated by username and public/private |
| 81 | key pair, and all data transfer is protected by the SSH connection |
| 82 | and Git's own data integrity checks. |
| 83 | |
| 84 | Each Git commit created on the client desktop system is converted |
| 85 | into a unique change record which can be reviewed independently. |
| Chad Horohoe | e9855b8 | 2012-05-06 22:28:45 -0400 | [diff] [blame] | 86 | Change records are stored in a database: PostgreSQL, MySQL, or the |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 87 | built-in H2, where they can be queried to present customized user |
| 88 | dashboards, enumerating any pending changes. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 89 | |
| 90 | A summary of each newly uploaded change is automatically emailed |
| 91 | to reviewers, so they receive a direct hyperlink to review the |
| 92 | change on the web. Reviewer email addresses can be specified on the |
| 93 | `git push` command line, but typically reviewers are automatically |
| 94 | selected by Gerrit by identifying users who have change approval |
| 95 | permissions in the project. |
| 96 | |
| 97 | Reviewers use the web interface to read the side-by-side or unified |
| Bruce Zu | 6b0fd76 | 2012-10-25 16:52:00 +0800 | [diff] [blame] | 98 | diff of a change, and insert draft inline/file comments where |
| 99 | appropriate. A draft comment is visible only to the reviewer, until |
| 100 | they publish those comments. Published comments are automatically |
| 101 | emailed to the change author by Gerrit, and are CC'd to all other |
| 102 | reviewers who have already commented on the change. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 103 | |
| 104 | When publishing comments reviewers are also given the opportunity |
| 105 | to score the change, indicating whether they feel the change is |
| 106 | ready for inclusion in the project, needs more work, or should be |
| 107 | rejected outright. These scores provide direct feedback to Gerrit's |
| 108 | change submit function. |
| 109 | |
| 110 | After a change has been scored positively by reviewers, Gerrit |
| 111 | enables a submit button on the web interface. Authorized users |
| 112 | can push the submit button to have the change enter the project |
| Edwin Kempin | f1acbb8 | 2011-09-15 12:49:42 +0200 | [diff] [blame] | 113 | repository. The equivalent in Subversion or Perforce would be |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 114 | that Gerrit is invoking `svn commit` or `p4 submit` on behalf of |
| 115 | the web user pressing the button. Due to the way Git audit trails |
| 116 | are maintained, the user pressing the submit button does not need |
| 117 | to be the author of the change. |
| 118 | |
| 119 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 120 | == Infrastructure |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 121 | |
| 122 | End-user web browsers make HTTP requests directly to Gerrit's |
| 123 | HTTP server. As nearly all of the user interface is implemented |
| 124 | through Google Web Toolkit (GWT), the majority of these requests |
| 125 | are transmitting compressed JSON payloads, with all HTML being |
| 126 | generated within the browser. Most responses are under 1 KB. |
| 127 | |
| 128 | Gerrit's HTTP server side component is implemented as a standard |
| 129 | Java servlet, and thus runs within any J2EE servlet container. |
| 130 | Popular choices for deployments would be Tomcat or Jetty, as these |
| 131 | are high-quality open-source servlet containers that are readily |
| 132 | available for download. |
| 133 | |
| 134 | End-user uploads are performed over SSH, so Gerrit's servlets also |
| 135 | start up a background thread to receive SSH connections through |
| 136 | an independent SSH port. SSH clients communicate directly with |
| 137 | this port, bypassing the HTTP server used by browsers. |
| 138 | |
| 139 | Server side data storage for Gerrit is broken down into two different |
| 140 | categories: |
| 141 | |
| 142 | * Git repository data |
| 143 | * Gerrit metadata |
| 144 | |
| 145 | The Git repository data is the Git object database used to store |
| 146 | already submitted revisions, as well as all uploaded (proposed) |
| 147 | changes. Gerrit uses the standard Git repository format, and |
| 148 | therefore requires direct filesystem access to the repositories. |
| 149 | All repository data is stored in the filesystem and accessed through |
| 150 | the JGit library. Repository data can be stored on remote servers |
| 151 | accessible through NFS or SMB, but the remote directory must |
| 152 | be mounted on the Gerrit server as part of the local filesystem |
| 153 | namespace. Remote filesystems are likely to perform worse than |
| 154 | local ones, due to Git disk IO behavior not being optimized for |
| 155 | remote access. |
| 156 | |
| 157 | The Gerrit metadata contains a summary of the available changes, |
| 158 | all comments (published and drafts), and individual user account |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 159 | information. The metadata is mostly housed in the database (*1), |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 160 | which can be located either on the same server as Gerrit, or on |
| 161 | a different (but nearby) server. Most installations would opt to |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 162 | install both Gerrit and the metadata database on the same server, |
| 163 | to reduce administration overheads. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 164 | |
| 165 | User authentication is handled by OpenID, and therefore Gerrit |
| 166 | requires that the OpenID provider selected by a user must be |
| 167 | online and operating in order to authenticate that user. |
| 168 | |
| Shawn Pearce | 792b2c4 | 2015-06-12 17:25:40 -0700 | [diff] [blame] | 169 | * link:http://www.gwtproject.org/[Google Web Toolkit (GWT)] |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 170 | * link:http://www.kernel.org/pub/software/scm/git/docs/gitrepository-layout.html[Git Repository Format] |
| 171 | * link:http://www.postgresql.org/about/[About PostgreSQL] |
| 172 | * link:http://openid.net/developers/specs/[OpenID Specifications] |
| 173 | |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 174 | *1 Although an effort is underway to eliminate the use of the |
| 175 | database altogether, and to store all the metadata directly in |
| 176 | the git repositories themselves. So far, as of Gerrit 2.2.1, of |
| 177 | all Gerrit's metadata, only the project configuration metadata |
| 178 | has been migrated out of the database and into the git |
| 179 | repositories for each project. |
| 180 | |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 181 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 182 | == Project Information |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 183 | |
| 184 | Gerrit is developed as a self-hosting open source project: |
| 185 | |
| Shawn Pearce | 792b2c4 | 2015-06-12 17:25:40 -0700 | [diff] [blame] | 186 | * link:https://www.gerritcodereview.com/[Project Homepage] |
| Shawn Pearce | 6d7ebc6 | 2015-06-12 16:34:42 -0700 | [diff] [blame] | 187 | * link:https://www.gerritcodereview.com/download/index.html[Release Versions] |
| 188 | * link:https://gerrit.googlesource.com/gerrit[Source] |
| David Pursehouse | ff8982d | 2016-06-23 15:30:50 +0900 | [diff] [blame] | 189 | * link:https://bugs.chromium.org/p/gerrit/issues/list[Issue Tracking] |
| Shawn O. Pearce | aa5b83b | 2009-12-02 08:10:24 -0800 | [diff] [blame] | 190 | * link:https://review.source.android.com/[Change Review] |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 191 | |
| 192 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 193 | == Internationalization and Localization |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 194 | |
| 195 | As a source code review system for open source projects, where the |
| 196 | commonly preferred language for communication is typically English, |
| 197 | Gerrit does not make internationalization or localization a priority. |
| 198 | |
| 199 | The majority of Gerrit's users will be writing change descriptions |
| 200 | and comments in English, and therefore an English user interface |
| 201 | is usable by the target user base. |
| 202 | |
| 203 | Gerrit uses GWT's i18n support to externalize all constant strings |
| 204 | and messages shown to the user, so that in the future someone who |
| 205 | really needed a translated version of the UI could contribute new |
| 206 | string files for their locale(s). |
| 207 | |
| 208 | Right-to-left (RTL) support is only barely considered within the |
| 209 | Gerrit code base. Some portions of the code have tried to take |
| 210 | RTL into consideration, while others probably need to be modified |
| 211 | before translating the UI to an RTL language. |
| 212 | |
| 213 | * link:i18n-readme.html[Gerrit's i18n Support] |
| 214 | |
| 215 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 216 | == Accessibility Considerations |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 217 | |
| 218 | Whenever possible Gerrit displays raw text rather than image icons, |
| 219 | so screen readers should still be able to provide useful information |
| 220 | to blind persons accessing Gerrit sites. |
| 221 | |
| 222 | Standard HTML hyperlinks are used rather than HTML div or span tags |
| 223 | with click listeners. This provides two benefits to the end-user. |
| 224 | The first benefit is that screen readers are optimized to locating |
| 225 | standard hyperlink anchors and presenting them to the end-user as |
| 226 | a navigation action. The second benefit is that users can use |
| 227 | the 'open in new tab/window' feature of their browser whenever |
| 228 | they choose. |
| 229 | |
| 230 | When possible, Gerrit uses the ARIA properties on DOM widgets to |
| 231 | provide hints to screen readers. |
| 232 | |
| 233 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 234 | == Browser Compatibility |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 235 | |
| 236 | Supporting non-JavaScript enabled browsers is a non-goal for Gerrit. |
| 237 | |
| 238 | As Gerrit is a pure-GWT application with no server side rendering |
| 239 | fallbacks, the browser must support modern JavaScript semantics in |
| 240 | order to access the Gerrit web application. Dumb clients such as |
| 241 | `lynx`, `wget`, `curl`, or even many search engine spiders are not |
| 242 | able to access Gerrit content. |
| 243 | |
| 244 | As Google Web Toolkit (GWT) is used to generate the browser |
| 245 | specific versions of the client-side JavaScript code, Gerrit works |
| 246 | on any JavaScript enabled browser which GWT can produce code for. |
| 247 | This covers the majority of the popular browsers. |
| 248 | |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 249 | The Gerrit project does not have the development resources necessary |
| 250 | to support two parallel UI implementations (GWT based JavaScript |
| 251 | and server-side rendering). Consequently only one is implemented. |
| 252 | |
| 253 | There are number of web browsers available with full JavaScript |
| 254 | support, and nearly every operating system (including any PDA-like |
| 255 | mobile phone) comes with one standard. Users who are committed |
| 256 | to developing changes for a Gerrit managed project can be expected |
| 257 | to be able to run a JavaScript enabled browser, as they also would |
| 258 | need to be running Git in order to contribute. |
| 259 | |
| 260 | There are a number of open source browsers available, including |
| 261 | Firefox and Chromium. Users have some degree of choice in their |
| 262 | browser selection, including being able to build and audit their |
| 263 | browser from source. |
| 264 | |
| 265 | The majority of the content stored within Gerrit is also available |
| 266 | through other means, such as gitweb or the `git://` protocol. |
| 267 | Any existing search engine spider can crawl the server-side HTML |
| 268 | produced by gitweb, and thus can index the majority of the changes |
| 269 | which might appear in Gerrit. Some engines may even choose to |
| 270 | crawl the native version control database, such as ohloh.net does. |
| 271 | Therefore the lack of support for most search engine spiders is a |
| 272 | non-issue for most Gerrit deployments. |
| 273 | |
| 274 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 275 | == Product Integration |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 276 | |
| 277 | Gerrit integrates with an existing gitweb installation by optionally |
| 278 | creating hyperlinks to reference changes on the gitweb server. |
| 279 | |
| 280 | Gerrit integrates with an existing git-daemon installation by |
| 281 | optionally displaying `git://` URLs for users to download a |
| Shawn O. Pearce | d607846 | 2009-11-02 10:37:01 -0800 | [diff] [blame] | 282 | change through the native Git protocol. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 283 | |
| 284 | Gerrit integrates with any OpenID provider for user authentication, |
| 285 | making it easier for users to join a Gerrit site and manage their |
| 286 | authentication credentials to it. To make use of Google Accounts |
| 287 | as an OpenID provider easier, Gerrit has a shorthand "Sign in with |
| 288 | a Google Account" link on its sign-in screen. Gerrit also supports |
| 289 | a shorthand sign in link for Yahoo!. Other providers may also be |
| 290 | supported more directly in the future. |
| 291 | |
| Shawn O. Pearce | 142385d | 2009-03-01 11:09:05 -0800 | [diff] [blame] | 292 | Site administrators may limit the range of OpenID providers to |
| 293 | a subset of "reliable providers". Users may continue to use |
| 294 | any OpenID provider to publish comments, but granted privileges |
| 295 | are only available to a user if the only entry point to their |
| 296 | account is through the defined set of "reliable OpenID providers". |
| 297 | This permits site administrators to require HTTPS for OpenID, |
| 298 | and to use only large main-stream providers that are trustworthy, |
| 299 | or to require users to only use a custom OpenID provider installed |
| 300 | alongside Gerrit Code Review. |
| 301 | |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 302 | Gerrit integrates with some types of corporate single-sign-on (SSO) |
| 303 | solutions, typically by having the SSO authentication be performed |
| 304 | in a reverse proxy web server and then blindly trusting that all |
| 305 | incoming connections have been authenticated by that reverse proxy. |
| 306 | When configured to use this form of authentication, Gerrit does |
| 307 | not integrate with OpenID providers. |
| 308 | |
| 309 | When installing Gerrit, administrators may optionally include an |
| 310 | HTML header or footer snippet which may include user tracking code, |
| 311 | such as that used by Google Analytics. This is a per-instance |
| 312 | configuration that must be done by hand, and is not supported |
| 313 | out of the box. Other site trackers instead of Google Analytics |
| 314 | can be used, as the administrator can supply any HTML/JavaScript |
| 315 | they choose. |
| 316 | |
| 317 | Gerrit does not integrate with any Google service, or any other |
| 318 | services other than those listed above. |
| 319 | |
| 320 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 321 | == Standards / Developer APIs |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 322 | |
| 323 | Gerrit uses an XSRF protected variant of JSON-RPC 1.1 to communicate |
| 324 | between the browser client and the server. |
| 325 | |
| 326 | As the protocol is not the GWT-RPC protocol, but is instead a |
| 327 | self-describing standard JSON format it is easily implemented by |
| 328 | any 3rd party client application, provided the client has a JSON |
| 329 | parser and HTTP client library available. |
| 330 | |
| 331 | As the entire command set necessary for the standard web browser |
| 332 | based UI is exposed through JSON-RPC over HTTP, there are no other |
| 333 | data feeds or command interfaces to the server. |
| 334 | |
| 335 | Commands requiring user authentication may require the user agent to |
| 336 | complete a sign-in cycle through the user's OpenID provider in order |
| 337 | to establish the HTTP cookie Gerrit uses to track user identity. |
| 338 | Automating this sign-in process for non-web browser agents is |
| 339 | outside of the scope of Gerrit, as each OpenID provider uses its own |
| 340 | sign-in sequence. Use of OpenID providers which have difficult to |
| 341 | automate interfaces may make it impossible for non-browser agents |
| 342 | to be used with the JSON-RPC interface. |
| 343 | |
| 344 | * link:http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html[JSON-RPC 1.1] |
| David Pursehouse | 7845019 | 2018-02-02 10:13:45 +0900 | [diff] [blame] | 345 | * link:https://gerrit.googlesource.com/gwtjsonrpc/+/master/README[XSRF JSON-RPC] |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 346 | |
| 347 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 348 | == Privacy Considerations |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 349 | |
| 350 | Gerrit stores the following information per user account: |
| 351 | |
| 352 | * Full Name |
| 353 | * Preferred Email Address |
| Shawn O. Pearce | aa8b3d4 | 2009-03-01 11:10:55 -0800 | [diff] [blame] | 354 | * Mailing Address '(Optional, Encrypted)' |
| 355 | * Country '(Optional, Encrypted)' |
| 356 | * Phone Number '(Optional, Encrypted)' |
| 357 | * Fax Number '(Optional, Encrypted)' |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 358 | |
| 359 | The full name and preferred email address fields are shown to any |
| 360 | site visitor viewing a page containing a change uploaded by the |
| 361 | account owner, or containing a published comment written by the |
| 362 | account owner. |
| 363 | |
| 364 | Showing the full name and preferred email is approximately the same |
| 365 | risk as the `From` header of an email posted to a public mailing |
| 366 | list that maintains archives, and Gerrit treats these fields in |
| 367 | much the same way that a mailing list archive might handle them. |
| 368 | Users who don't want to expose this information should either not |
| 369 | participate in a Gerrit based online community, or open a new email |
| 370 | address dedicated for this use. |
| 371 | |
| 372 | As the Gerrit UI data is only available through XSRF protected |
| 373 | JSON-RPC calls, "screen-scraping" for email addresses is difficult, |
| 374 | but not impossible. It is unlikely a spammer will go through the |
| 375 | effort required to code a custom scraping application necessary |
| 376 | to cull email addresses from published Gerrit comments. In most |
| 377 | cases these same addresses would be more easily obtained from the |
| 378 | project's mailing list archives. |
| 379 | |
| Shawn O. Pearce | aa8b3d4 | 2009-03-01 11:10:55 -0800 | [diff] [blame] | 380 | The user's name and email address is stored unencrypted in the |
| 381 | Gerrit metadata store, typically a PostgreSQL database. |
| 382 | |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 383 | The snail-mail mailing address, country, and phone and fax numbers |
| 384 | are gathered to help project leads contact the user should there |
| 385 | be a legal question regarding any change they have uploaded. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 386 | |
| Shawn O. Pearce | aa8b3d4 | 2009-03-01 11:10:55 -0800 | [diff] [blame] | 387 | These sensitive fields are immediately encrypted upon receipt with |
| 388 | a GnuPG public key, and stored "off site" in another data store, |
| 389 | isolated from the main Gerrit change data. Gerrit does not have |
| 390 | access to the matching private key, and as such cannot decrypt the |
| 391 | information. Therefore these fields are write-once in Gerrit, as not |
| 392 | even the account owner can recover the values they previously stored. |
| 393 | |
| 394 | It is expected that the address information would only need to be |
| 395 | decrypted and revealed with a valid court subpoena, but this is |
| 396 | really left to the discretion of the Gerrit site administrator as |
| 397 | to when it is reasonable to reveal this information to a 3rd party. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 398 | |
| 399 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 400 | == Spam and Abuse Considerations |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 401 | |
| 402 | Gerrit makes no attempt to detect spam changes or comments. The |
| 403 | somewhat high barrier to entry makes it unlikely that a spammer |
| 404 | will target Gerrit. |
| 405 | |
| 406 | To upload a change, the client must speak the native Git protocol |
| 407 | embedded in SSH, with some custom Gerrit semantics added on top. |
| 408 | The client must have their public key already stored in the Gerrit |
| 409 | database, which can only be done through the XSRF protected |
| 410 | JSON-RPC interface. The level of effort required to construct |
| 411 | the necessary tools to upload a well-formatted change that isn't |
| 412 | rejected outright by the Git and Gerrit checksum validations is |
| 413 | too high to for a spammer to get any meaningful return. |
| 414 | |
| 415 | To post and publish a comment a client must sign in with an OpenID |
| 416 | provider and then use the XSRF protected JSON-RPC interface to |
| 417 | publish the draft on an existing change record. Again, the level of |
| 418 | effort required to implement the Gerrit specific XSRF protections |
| 419 | and the JSON-RPC payload format necessary to post a draft and then |
| 420 | publish that draft is simply too high for a spammer to bother with. |
| 421 | |
| 422 | Both of these assumptions are also based upon the idea that Gerrit |
| 423 | will be a lot less popular than blog software, and thus will be |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 424 | running on a lot fewer websites. Spammers therefore have very little |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 425 | returned benefit for getting over the protocol hurdles. |
| 426 | |
| 427 | These assumptions may need to be revisited in the future if any |
| 428 | public Gerrit site actually notices spam. |
| 429 | |
| 430 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 431 | == Latency |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 432 | |
| 433 | Gerrit targets for sub-250 ms per page request, mostly by using |
| David Pursehouse | 9246356 | 2013-06-24 10:16:28 +0900 | [diff] [blame] | 434 | very compact JSON payloads between client and server. However, as |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 435 | most of the serving stack (network, hardware, metadata |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 436 | database) is out of control of the Gerrit developers, no real |
| 437 | guarantees can be made about latency. |
| 438 | |
| 439 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 440 | == Scalability |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 441 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 442 | Gerrit is designed for a very large scale open source project, or |
| Matt Baker | a752b32 | 2013-11-27 19:19:31 -0700 | [diff] [blame] | 443 | large commercial development project. Roughly this amounts to |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 444 | parameters such as the following: |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 445 | |
| 446 | .Design Parameters |
| Karsten Dambekalns | a7f72a2 | 2011-03-25 14:21:59 +0100 | [diff] [blame] | 447 | [options="header"] |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 448 | |====================================================== |
| 449 | |Parameter | Default Maximum | Estimated Maximum |
| 450 | |Projects | 1,000 | 10,000 |
| 451 | |Contributors | 1,000 | 50,000 |
| 452 | |Changes/Day | 100 | 2,000 |
| 453 | |Revisions/Change | 20 | 20 |
| 454 | |Files/Change | 50 | 16,000 |
| 455 | |Comments/File | 100 | 100 |
| 456 | |Reviewers/Change | 8 | 8 |
| 457 | |====================================================== |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 458 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 459 | Out of the box, Gerrit will handle the "Default Maximum". Site |
| 460 | administrators may reconfigure their servers by editing gerrit.config |
| 461 | to run closer to the estimated maximum if sufficient memory is made |
| David Pursehouse | 9246356 | 2013-06-24 10:16:28 +0900 | [diff] [blame] | 462 | available to the JVM and the relevant cache.*.memoryLimit variables |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 463 | are increased from their defaults. |
| 464 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 465 | === Discussion |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 466 | |
| 467 | Very few, if any open source projects have more than a handful of |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 468 | Git repositories associated with them. Since Gerrit treats each |
| 469 | Git repository as a project, an upper limit of 10,000 projects |
| 470 | is reasonable. If a site has more than 1,000 projects, administrators |
| 471 | should increase |
| 472 | link:config-gerrit.html#cache.name.memoryLimit[`cache.projects.memoryLimit`] |
| 473 | to match. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 474 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 475 | Almost no open source project has 1,000 contributors over all time, |
| 476 | let alone on a daily basis. This default figure of 1,000 was WAG'd by |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 477 | looking at PR statements published by cell phone companies picking |
| 478 | up the Android operating system. If all of the stated employees in |
| 479 | those PR statements were working on *only* the open source Android |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 480 | repositories, we might reach the 1,000 estimate listed here. Knowing |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 481 | these companies as being very closed-source minded in the past, it |
| 482 | is very unlikely all of their Android engineers will be working on |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 483 | the open source repository, and thus 1,000 is a very high estimate. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 484 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 485 | The upper maximum of 50,000 contributors is based on existing |
| 486 | installations that are already handling quite a bit more than the |
| 487 | default maximum of 1,000 contributors. Given how the user data is |
| 488 | stored and indexed, supporting 50,000 contributor accounts (or more) |
| 489 | is easily possible for a server. If a server has more than 1,000 |
| 490 | *active* contributors, |
| 491 | link:config-gerrit.html#cache.name.memoryLimit[`cache.accounts.memoryLimit`] |
| 492 | should be increased by the site administrator, if sufficient RAM |
| 493 | is available to the host JVM. |
| 494 | |
| 495 | The estimate of 100 changes per day was WAG'd off some estimates |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 496 | originally obtained from Android's development history. Writing a |
| 497 | good change that will be accepted through a peer-review process |
| 498 | takes time. The average engineer may need 4-6 hours per change just |
| 499 | to write the code and unit tests. Proper design consideration and |
| 500 | additional but equally important tasks such as meetings, interviews, |
| 501 | training, and eating lunch will often pad the engineer's day out |
| 502 | such that suitable changes are only posted once a day, or once |
| 503 | every other day. For reference, the entire Linux kernel has an |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 504 | average of only 79 changes/day. If more than 100 changes are active |
| 505 | per day, site administrators should consider increasing the |
| 506 | link:config-gerrit.html#cache.name.memoryLimit[`cache.diff.memoryLimit`] |
| 507 | and `cache.diff_intraline.memoryLimit`. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 508 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 509 | On average any given change will need to be modified once to address |
| 510 | peer review comments before the final revision can be accepted by the |
| 511 | project. Executing these revisions also eats into the contributor's |
| 512 | time, and is another factor limiting the number of changes/day |
| 513 | accepted by the Gerrit instance. However, even though this implies |
| 514 | only 2 revisions/change, many existing Gerrit installations have seen |
| 515 | 20 or more revisions/change, when new contributors are learning the |
| 516 | project's style and conventions. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 517 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 518 | On average, each change will have 2 reviewers, a human and an |
| 519 | automated test bed system. Usually this would be the project lead, or |
| 520 | someone who is familiar with the code being modified. The time |
| 521 | required to comment further reduces the time available for writing |
| 522 | one's own changes. However, existing Gerrit installations have seen 8 |
| 523 | or more reviewers frequently show up on changes that impact many |
| 524 | functional areas, and therefore it is reasonable to expect 8 or more |
| 525 | reviewers to be able to work together on a single change. |
| 526 | |
| 527 | Existing installations have successfully processed change reviews with |
| 528 | more than 16,000 files per change. However, since 16,000 modified/new |
| 529 | files is a massive amount of code to review, it is more typical to see |
| 530 | less than 10 files modified in any single change. Changes larger than |
| 531 | 10 files are typically merges, for example integrating the latest |
| 532 | version of an upstream library, where the reviewer has little to do |
| 533 | beyond verifying the project compiles and passes a test suite. |
| 534 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 535 | === CPU Usage - Web UI |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 536 | |
| 537 | Gerrit's web UI would require on average `4+F+F*C` HTTP requests to |
| 538 | review a change and post comments. Here `F` is the number of files |
| Bruce Zu | 6b0fd76 | 2012-10-25 16:52:00 +0800 | [diff] [blame] | 539 | modified by the change, and `C` is the number of inline/file comments |
| 540 | left by the reviewer per file. The constant 4 accounts for the request |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 541 | to load the reviewer's dashboard, to load the change detail page, |
| 542 | to publish the review comments, and to reload the change detail |
| 543 | page after comments are published. |
| 544 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 545 | This WAG'd estimate boils down to 216,000 HTTP requests per day |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 546 | (QPD). Assuming these are evenly distributed over an 8 hour work day |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 547 | in a single time zone, we are looking at approximately 7.5 queries |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 548 | per second (QPS). |
| 549 | |
| 550 | ---- |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 551 | QPD = Changes_Day * Revisions_Change * Reviewers_Change * (4 + F + F * C) |
| 552 | = 2,000 * 2 * 1 * (4 + 10 + 10 * 4) |
| 553 | = 216,000 |
| Shawn O. Pearce | 57c4ba8 | 2009-12-22 08:10:50 -0800 | [diff] [blame] | 554 | QPS = QPD / 8_Hours / 60_Minutes / 60_Seconds |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 555 | = 7.5 |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 556 | ---- |
| 557 | |
| 558 | Gerrit serves most requests in under 60 ms when using the loopback |
| 559 | interface and a single processor. On a single CPU system there is |
| 560 | sufficient capacity for 16 QPS. A dual processor system should be |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 561 | more than sufficient for a site with the estimated load described above. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 562 | |
| 563 | Given a more realistic estimate of 79 changes per day (from the |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 564 | Linux kernel) suggests only 8,532 queries per day, and a much lower |
| 565 | 0.29 QPS when spread out over an 8 hour work day. |
| 566 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 567 | === CPU Usage - Git over SSH/HTTP |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 568 | |
| 569 | A 24 core server is able to handle ~25 concurrent `git fetch` |
| 570 | operations per second. The issue here is each concurrent operation |
| 571 | demands one full core, as the computation is almost entirely server |
| 572 | side CPU bound. 25 concurrent operations is known to be sufficient to |
| 573 | support hundreds of active developers and 50 automated build servers |
| 574 | polling for updates and building every change. (This data was derived |
| 575 | from an actual installation's performance.) |
| 576 | |
| 577 | Because of the distributed nature of Git, end-users don't need to |
| 578 | contact the central Gerrit Code Review server very often. For `git |
| 579 | fetch` traffic, link:pgm-daemon.html[slave mode] is known to be an |
| 580 | effective way to offload traffic from the main server, permitting it |
| 581 | to scale to a large user base without needing an excessive number of |
| 582 | cores in a single system. |
| 583 | |
| 584 | Clients on very slow network connections (for example home office |
| 585 | users on VPN over home DSL) may be network bound rather than server |
| 586 | side CPU bound, in which case a core may be effectively shared with |
| 587 | another user. Possible core sharing due to network bottlenecks |
| 588 | generally holds true for network connections running below 10 MiB/sec. |
| 589 | |
| 590 | If the server's own network interface is 1 Gib/sec (Gigabit Ethernet), |
| 591 | the system can really only serve about 10 concurrent clients at the |
| 592 | 10 MiB/sec speed, no matter how many cores it has. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 593 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 594 | === Disk Usage |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 595 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 596 | The average size of a revision in the Linux kernel once compressed by |
| 597 | Git is 2,327 bytes, or roughly 2 KiB. Over the course of a year a |
| Matt Baker | a752b32 | 2013-11-27 19:19:31 -0700 | [diff] [blame] | 598 | Gerrit server running with the estimated maximum parameters above might |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 599 | see an introduction of 1.4 GiB over the total set of 10,000 projects |
| 600 | hosted in that server. This figure assumes the majority of the content |
| 601 | is human written source code, and not large binary blobs such as disk |
| 602 | images or media files. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 603 | |
| Shawn O. Pearce | 0825581 | 2011-04-12 00:02:38 -0400 | [diff] [blame] | 604 | Production Gerrit installations have been tested, and are known to |
| 605 | handle Git repositories in the multigigabyte range, storing binary |
| 606 | files, ranging in size from a few kilobytes (for example compressed |
| 607 | icons) to 800+ megabytes (firmware images, large uncompressed original |
| 608 | artwork files). Best practices encourage breaking very large binary |
| 609 | files into their Git repositories based on access, to prevent desktop |
| 610 | clients from needing to clone unnecessary materials (for example a C |
| 611 | developer does not need every 800+ megabyte firmware image created by |
| 612 | the product's quality assurance team). |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 613 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 614 | == Redundancy & Reliability |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 615 | |
| 616 | Gerrit largely assumes that the local filesystem where Git repository |
| 617 | data is stored is always available. Important data written to disk |
| 618 | is also forced to the platter with an `fsync()` once it has been |
| 619 | fully written. If the local filesystem fails to respond to reads |
| 620 | or becomes corrupt, Gerrit has no provisions to fallback or retry |
| 621 | and errors will be returned to clients. |
| 622 | |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 623 | Gerrit largely assumes that the metadata database is online and |
| 624 | answering both read and write queries. Query failures immediately |
| 625 | result in the operation aborting and errors being returned to the |
| 626 | client, with no retry or fallback provisions. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 627 | |
| 628 | Due to the relatively small scale described above, it is very likely |
| Martin Fick | b026ca3 | 2011-07-27 18:23:20 -0600 | [diff] [blame] | 629 | that the Git filesystem and metadata database are all housed on the |
| 630 | same server that is running Gerrit. If any failure arises in one of |
| 631 | these components, it is likely to manifest in the others too. It is |
| 632 | also likely that the administrator cannot be bothered to deploy a |
| 633 | cluster of load-balanced server hardware, as the scale and expected |
| 634 | load does not justify the hardware or management costs. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 635 | |
| 636 | Most deployments caring about reliability will setup a warm-spare |
| 637 | standby system and use a manual fail-over process to switch from the |
| 638 | failed system to the warm-spare. |
| 639 | |
| 640 | As Git is a distributed version control system, and open source |
| 641 | projects tend to have contributors from all over the world, most |
| 642 | contributors will be able to tolerate a Gerrit down time of several |
| 643 | hours while the administrator is notified, signs on, and brings the |
| 644 | warm-spare up. Pending changes are likely to need at least 24 hours |
| 645 | of time on the Gerrit site anyway in order to ensure any interested |
| 646 | parties around the world have had a chance to comment. This expected |
| 647 | lag largely allows for some downtime in a disaster scenario. |
| 648 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 649 | === Backups |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 650 | |
| Chad Horohoe | e9855b8 | 2012-05-06 22:28:45 -0400 | [diff] [blame] | 651 | PostgreSQL and MySQL can be configured to replicate their data to |
| 652 | other systems, where they are applied to a warm-standby backup in |
| David Pursehouse | 9246356 | 2013-06-24 10:16:28 +0900 | [diff] [blame] | 653 | real time. Gerrit instances which care about redundancy will setup |
| Chad Horohoe | e9855b8 | 2012-05-06 22:28:45 -0400 | [diff] [blame] | 654 | this feature of PostgreSQL or MySQL to ensure the warm-standby is |
| 655 | reasonably current should the master go offline. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 656 | |
| Shawn O. Pearce | 7d2cb04 | 2012-05-10 19:12:09 -0700 | [diff] [blame] | 657 | Using the standard replication plugin, Gerrit can be configured |
| 658 | to replicate changes made to the local Git repositories over any |
| 659 | standard Git transports. After the plugin is installed, remote |
| 660 | destinations can be configured in `'$site_path'/etc/replication.conf` |
| 661 | to send copies of all changes over SSH to other servers, or to the |
| 662 | Amazon S3 blob storage service. |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 663 | |
| 664 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 665 | == Logging Plan |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 666 | |
| 667 | Gerrit does not maintain logs on its own. |
| 668 | |
| 669 | Published comments contain a publication date, so users can judge |
| 670 | when the comment was posted and decide if it was "recent" or not. |
| 671 | Only the timestamp is stored in the database, the IP address of |
| 672 | the comment author is not stored. |
| 673 | |
| 674 | Changes uploaded over the SSH daemon from `git push` have the |
| 675 | standard Git reflog updated with the date and time that the upload |
| 676 | occurred, and the Gerrit account identity of who did the upload. |
| 677 | Changes submitted and merged into a branch also update the |
| 678 | Git reflog. These logs are available only to the Gerrit site |
| 679 | administrator, and they are not replicated through the automatic |
| David Pursehouse | 9246356 | 2013-06-24 10:16:28 +0900 | [diff] [blame] | 680 | replication noted earlier. These logs are primarily recorded for an |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 681 | "oh s**t" moment where the administrator has to rewind data. In most |
| 682 | installations they are a waste of disk space. Future versions of |
| 683 | JGit may allow disabling these logs, and Gerrit may take advantage |
| 684 | of that feature to stop writing these logs. |
| 685 | |
| 686 | A web server positioned in front of Gerrit (such as a reverse proxy) |
| 687 | or the hosting servlet container may record access logs, and these |
| 688 | logs may be mined for usage information. This is outside of the |
| 689 | scope of Gerrit. |
| 690 | |
| 691 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 692 | == Testing Plan |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 693 | |
| 694 | Gerrit is currently manually tested through its web UI. |
| 695 | |
| 696 | JGit has a fairly extensive automated unit test suite. Most new |
| 697 | changes to JGit are rejected unless corresponding automated unit |
| 698 | tests are included. |
| 699 | |
| 700 | |
| Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 701 | == Caveats |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 702 | |
| David Pursehouse | 659860f | 2013-12-16 14:50:04 +0900 | [diff] [blame] | 703 | Rietveld can't be used as it does not provide the "submit over the |
| Shawn O. Pearce | c4bcc09 | 2009-02-06 12:32:57 -0800 | [diff] [blame] | 704 | web" feature that Gerrit provides for Git. |
| 705 | |
| 706 | Gitosis can't be used as it does not provide any code review |
| 707 | features, but it does provide basic access controls. |
| 708 | |
| 709 | Email based code review does not scale to a project as large and |
| 710 | complex as Android. Most contributors at least need some sort of |
| 711 | dashboard to keep track of any pending reviews, and some way to |
| 712 | correlate updated revisions back to the comments written on prior |
| 713 | revisions of the same logical change. |
| Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 714 | |
| 715 | GERRIT |
| 716 | ------ |
| 717 | Part of link:index.html[Gerrit Code Review] |
| Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 718 | |
| 719 | SEARCHBOX |
| 720 | --------- |