blob: 5636dfda3d7eceeaeacdb4ea1767fb793cb7fa7a [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= Gerrit Code Review - System Design
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -08003
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08004== Objective
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -08005
6Gerrit is a web based code review system, facilitating online code
7reviews for projects using the Git version control system.
8
9Gerrit makes reviews easier by showing changes in a side-by-side
Bruce Zu6b0fd762012-10-25 16:52:00 +080010display, and allowing inline/file comments to be added by any reviewer.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080011
12Gerrit simplifies Git based project maintainership by permitting
13any authorized user to submit changes to the master Git repository,
14rather than requiring all approved changes to be merged in by
15hand by the project maintainer. This functionality enables a more
16centralized usage of Git.
17
18
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080019== Background
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080020
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080021Git is a distributed version control system, wherein each repository
22is assumed to be owned/maintained by a single user. There are no
David Pursehouse221d4f62012-06-08 17:38:08 +090023inherent security controls built into Git, so the ability to read
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080024from or write to a repository is controlled entirely by the host's
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010025filesystem or network access controls.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080026
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010027The objective of Gerrit is to facilitate Git development by larger
28teams: it provides a means to enforce organizational policies around
29code submissions, eg. "all code must be reviewed by another
30developer", "all code shall pass tests". It achieves this by
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080031
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010032* providing fine-grained (per-branch, per-repository, inheriting)
33 access controls, which allow a Gerrit admin to delegate permissions
34 to different team(-lead)s.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080035
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010036* facilitate code review: Gerrit offers a web view of pending code
37 changes, that allows for easy reading and commenting by humans. The
38 web view can offer data coming out of automated QA processes (eg.
39 CI). The permission system also includes fine grained control of who
40 can approve pending changes for submission to further facilitate
41 delegation of code ownership.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080042
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080043== Overview
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080044
45Developers create one or more changes on their local desktop system,
46then upload them for review to Gerrit using the standard `git push`
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010047command line program, or any GUI which can invoke `git push` on behalf
48of the user. Authentication and data transfer are handled through SSH
49and HTTPS. Uploads are protected by the authentication,
50confidentiality and integrity offered by the transport (SSH, HTTPS).
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080051
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010052Each Git commit created on the client desktop system is converted into
53a unique change record which can be reviewed independently.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080054
55A summary of each newly uploaded change is automatically emailed
56to reviewers, so they receive a direct hyperlink to review the
57change on the web. Reviewer email addresses can be specified on the
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010058`git push` command line, but typically reviewers are added in the web
59interface.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080060
61Reviewers use the web interface to read the side-by-side or unified
Bruce Zu6b0fd762012-10-25 16:52:00 +080062diff of a change, and insert draft inline/file comments where
63appropriate. A draft comment is visible only to the reviewer, until
64they publish those comments. Published comments are automatically
65emailed to the change author by Gerrit, and are CC'd to all other
66reviewers who have already commented on the change.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080067
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010068Reviewers can score the change ("vote"), indicating whether they feel the
69change is ready for inclusion in the project, needs more work, or
70should be rejected outright. These scores provide direct feedback to
71Gerrit's change submit function.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080072
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010073After a change has been scored positively by reviewers, Gerrit enables
74a submit button on the web interface. Authorized users can push the
75submit button to have the change enter the project repository. The
76user pressing the submit button does not need to be the author of the
77change.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080078
79
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080080== Infrastructure
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080081
82End-user web browsers make HTTP requests directly to Gerrit's
Ben Rohlfsda0a62b2021-04-26 17:02:19 +020083HTTP server. As nearly all of the Gerrit user interface is implemented
84in a JavaScript based web app, the majority of these requests are
85transmitting compressed JSON payloads, with all HTML being generated
86within the browser.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080087
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010088Gerrit's HTTP server side component is implemented as a standard Java
89servlet, and thus runs within any link:install-j2ee.html[J2EE servlet
90container]. The standard install will run inside Jetty, which is
91included in the binary.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -080092
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +010093End-user uploads are performed over SSH or HTTP, so Gerrit's servlets
94also start up a background thread to receive SSH connections through
95an independent SSH port. SSH clients communicate directly with this
96port, bypassing the HTTP server used by browsers.
97
98User authentication is handled by identity realms. Gerrit supports the
99following types of authentication:
100
101* OpenId (see link:http://openid.net/developers/specs/[OpenID Specifications,role=external,window=_blank])
102* OAuth2
103* LDAP
104* Google accounts (on googlesource.com)
105* SAML
106* Kerberos
107* 3rd party SSO
108
109=== NoteDb
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800110
111Server side data storage for Gerrit is broken down into two different
112categories:
113
114* Git repository data
115* Gerrit metadata
116
117The Git repository data is the Git object database used to store
118already submitted revisions, as well as all uploaded (proposed)
119changes. Gerrit uses the standard Git repository format, and
120therefore requires direct filesystem access to the repositories.
121All repository data is stored in the filesystem and accessed through
122the JGit library. Repository data can be stored on remote servers
123accessible through NFS or SMB, but the remote directory must
124be mounted on the Gerrit server as part of the local filesystem
125namespace. Remote filesystems are likely to perform worse than
126local ones, due to Git disk IO behavior not being optimized for
127remote access.
128
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100129The Gerrit metadata contains a summary of the available changes, all
130comments (published and drafts), and individual user account
131information.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800132
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100133Gerrit metadata is also stored in Git, with the commits marking the
134historical state of metadata. Data is stored in the trees associated
135with the commits, typically using Git config file or JSON as the base
136format. For metadata, there are 3 types of data: changes, accounts and
137groups.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800138
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100139Accounts are stored in a special Git repository `All-Users`.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800140
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100141Accounts can be grouped in groups. Gerrit has a built-in group system,
142but can also interface to external group system (eg. Google groups,
143LDAP). The built-in groups are stored in `All-Users`.
Martin Fickb026ca32011-07-27 18:23:20 -0600144
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100145Draft comments are stored in `All-Users` too.
146
147Permissions are stored in Git, in a branch `refs/meta/config` for the
148repository. Repository configuration (including permissions) supports
149single inheritance, with the `All-Projects` repository containing
150site-wide defaults.
151
152Code review metadata is stored in Git, alongside the code under
153review. Metadata includes change status, votes, comments. This review
154metadata is stored in NoteDb along with the submitted code and code
155under review. Hence, the review history can be exported with `git
156clone --mirror` by anyone with sufficient permissions.
157
158== Permissions
159
160Permissions are specified on branch names, and given to groups. For
161example,
162
163```
164[access "refs/heads/stable/*"]
165 push = group Release-Engineers
166```
167
168this provides a rule, granting Release-Engineers push permission for
169stable branches.
170
171There are fundamentally two types of permissions:
172
173* Write permissions (who can vote, push, submit etc.)
174
175* Read permissions (who can see data)
176
177Read permissions need special treatment across Gerrit, because Gerrit
178should only surface data (including repository existence) if a user
179has read permission. This means that
180
181* The git wire protocol support must omit references from
182 advertisement if the user lacks read permissions
183
184* Uploads through the git wire protocol must refuse commits that are
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200185 based on SHA-1s for data that the user can't see.
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100186
187* Tags are only visible if their commits are visible to user through a
188 non-tag reference.
189
190Metadata (eg. OAuth credentials) is also stored in Git. Existing
191endpoints must refuse creating branches or changes that expose these
192metadata or allow changes to them.
193
194
195=== Indexing
196
197Almost all data is stored as Git, but Git only supports fast lookup by
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200198SHA-1 or by ref (branch) name. Therefore Gerrit also has an indexing
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100199system (powered by Lucene by default) for other types of queries.
200There are 4 indices:
201
202* Project index - find repositories by name, parent project, etc.
203* Account index - find accounts by name, email, etc.
204* Group index - find groups by name, owner, description etc.
205* Change index - find changes by file, status, modification date etc.
206
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200207The base entities are characterized by SHA-1s. Storing the
208characterizing SHA-1s allows detection of stale index entries.
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100209
210== Plug-in architecture
211
212Gerrit has a plug-in architecture. Plugins can be installed by
213dropping them into $site_directory/plugins, or at runtime through
214plugin SSH commands, or the plugin REST API.
215
216=== Backend plugins
217
218At runtime, code can be loaded from a `.jar` file. This code can hook
219into predefined extension points. A common use of plugins is to have
220Gerrit interoperate with site-specific tools, such as CI-systems or
221issue trackers.
222
223// list some notable extension points, and notable plugins
224// link to plugin development
225
226Some backend plugins expose the JVM for scripting use (eg. Groovy,
227Scala), so plugins can be written without having to setup a Java
228development environment.
229
230// Luca to expand: how do script plugins load their scripts?
231
232=== Frontend plugins
233
234The UI can be extended using Frontend plugins. This is useful for
235changing the look & feel of Gerrit, but it can also be used to surface
236data from systems that aren't integrated with the Gerrit backend, eg.
237CI systems or code coverage providers.
238
239// FE team to write a bit more:
240// * how to load ?
241// * XSRF, CORS ?
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800242
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800243== Internationalization and Localization
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800244
245As a source code review system for open source projects, where the
246commonly preferred language for communication is typically English,
247Gerrit does not make internationalization or localization a priority.
248
249The majority of Gerrit's users will be writing change descriptions
250and comments in English, and therefore an English user interface
251is usable by the target user base.
252
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800253
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800254== Accessibility Considerations
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800255
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100256// UI team to rewrite this.
257
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800258Whenever possible Gerrit displays raw text rather than image icons,
259so screen readers should still be able to provide useful information
260to blind persons accessing Gerrit sites.
261
262Standard HTML hyperlinks are used rather than HTML div or span tags
263with click listeners. This provides two benefits to the end-user.
264The first benefit is that screen readers are optimized to locating
265standard hyperlink anchors and presenting them to the end-user as
266a navigation action. The second benefit is that users can use
267the 'open in new tab/window' feature of their browser whenever
268they choose.
269
270When possible, Gerrit uses the ARIA properties on DOM widgets to
271provide hints to screen readers.
272
273
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800274== Browser Compatibility
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800275
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100276Gerrit requires a JavaScript enabled browser.
277
278// UI team to add section on minimum browser requirements.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800279
David Ostrovsky7163dac2017-07-29 06:49:38 +0200280As Gerrit is a pure JavaScript application on the client side, with
281no server side rendering fallbacks, the browser must support modern
282JavaScript semantics in order to access the Gerrit web application.
283Dumb clients such as `lynx`, `wget`, `curl`, or even many search engine
284spiders are not able to access Gerrit content.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800285
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100286All of the content stored within Gerrit is also available through
287other means, such as gitweb or the `git://` protocol. Any existing
288search engine crawlers can index the server-side HTML served by a code
289browser, and thus can index the majority of the changes which might
290appear in Gerrit. Therefore the lack of support for most search engine
291crawlers is a non-issue for most Gerrit deployments.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800292
293
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800294== Product Integration
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800295
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100296Gerrit optionally surfaces links to HTML pages in a code browser. The
297links are configurable, and Gerrit comes with a built-in code browser,
298called Gitiles.
Shawn O. Pearce142385d2009-03-01 11:09:05 -0800299
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800300Gerrit integrates with some types of corporate single-sign-on (SSO)
301solutions, typically by having the SSO authentication be performed
302in a reverse proxy web server and then blindly trusting that all
303incoming connections have been authenticated by that reverse proxy.
304When configured to use this form of authentication, Gerrit does
305not integrate with OpenID providers.
306
307When installing Gerrit, administrators may optionally include an
308HTML header or footer snippet which may include user tracking code,
309such as that used by Google Analytics. This is a per-instance
310configuration that must be done by hand, and is not supported
311out of the box. Other site trackers instead of Google Analytics
312can be used, as the administrator can supply any HTML/JavaScript
313they choose.
314
315Gerrit does not integrate with any Google service, or any other
316services other than those listed above.
317
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100318Plugins (see above) can be used to drive product integrations from the
319Gerrit side. Products that support Gerrit explicitly can use the REST
320API or the SSH API to contact Gerrit.
321
322
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800323== Privacy Considerations
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800324
325Gerrit stores the following information per user account:
326
327* Full Name
328* Preferred Email Address
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800329
330The full name and preferred email address fields are shown to any
331site visitor viewing a page containing a change uploaded by the
332account owner, or containing a published comment written by the
333account owner.
334
335Showing the full name and preferred email is approximately the same
336risk as the `From` header of an email posted to a public mailing
337list that maintains archives, and Gerrit treats these fields in
338much the same way that a mailing list archive might handle them.
339Users who don't want to expose this information should either not
340participate in a Gerrit based online community, or open a new email
341address dedicated for this use.
342
343As the Gerrit UI data is only available through XSRF protected
344JSON-RPC calls, "screen-scraping" for email addresses is difficult,
345but not impossible. It is unlikely a spammer will go through the
346effort required to code a custom scraping application necessary
347to cull email addresses from published Gerrit comments. In most
348cases these same addresses would be more easily obtained from the
349project's mailing list archives.
350
Shawn O. Pearceaa8b3d42009-03-01 11:10:55 -0800351The user's name and email address is stored unencrypted in the
Edwin Kempin4372f732018-12-11 10:35:23 +0100352link:config-accounts.html#all-users[All-Users] repository.
Shawn O. Pearceaa8b3d42009-03-01 11:10:55 -0800353
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800354== Spam and Abuse Considerations
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800355
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100356There is no spam protection for the Git protocol upload path.
357Uploading a change successfully requires a pre-existing account, and a
358lot of up-front effort.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800359
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100360Gerrit makes no attempt to detect spam changes or comments in the web
361UI. To post and publish a comment a client must sign in and then use
362the XSRF protected JSON-RPC interface to publish the draft on an
363existing change record.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800364
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100365Absence of SPAM handling is based upon the idea that Gerrit caters to
366a niche audience, and will therefore be unattractive to spammers. In
367addition, it is not a factor for corporate, on-premise deployments.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800368
369
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800370== Scalability
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800371
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100372Gerrit supports the Git wire protocol, and an API (one API for HTTP,
373and one for SSH).
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800374
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100375The git wire protocol does a client/server negotiation to avoid
376sending too much data. This negotation occupies a CPU, so the number
377of concurrent push/fetch operations should be capped by the number of
378CPUs.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800379
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100380Clients on slow network connections may be network bound rather than
381server side CPU bound, in which case a core may be effectively shared
382with another user. Possible core sharing due to network bottlenecks
Shawn O. Pearce08255812011-04-12 00:02:38 -0400383generally holds true for network connections running below 10 MiB/sec.
384
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100385Deployments for large, distributed companies can replicate Git data to
386read-only replicas to offload fetch traffic. The read-only replicas
387should also serve this data using Gerrit to ensure that permissions
388are obeyed.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800389
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100390The API serves requests of varying costs. Requests that originate in
391the UI can block productivity, so care has been taken to optimize
392these for latency, using the following techniques:
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800393
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100394* Async calls: the UI becomes responsive before some UI elements
395 finished loading
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800396
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100397* Caching: metadata is stored in Git, which is relatively expensive to
398 access. This is sped up by multiple caches. Metadata entities are
399 stored in Git, and can therefore be seen as immutable values keyed
Han-Wen Nienhuys37a1cab2021-04-01 12:46:00 +0200400 by SHA-1, which is very amenable to caching. All SHA-1 keyed caches
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100401 can be persisted on local disk.
402
403 The size (memory, disk) of these caches should be adapted to the
404 instance size (number of users, size and quantity of repositories)
405 for optimal performance.
406
407Git does not impose fundamental limits (eg. number of files per
408change) on data. To ensure stability, Gerrit configures a number of
409default limits for these.
410
411// add a link to the default settings.
412
413=== Scaling team size
414
415A team of size N has N^2 possible interactions. As a result, features
416that expose interactions with activities of other team members has a
417quadratic cost in aggregate. The following features scale poorly with
418large team sizes:
419
420* the change screen shows conflicting changes by default. This data is
421 cached, but updates to pending changes cause cache misses. For a
422 single change, the amount of work is proportional to the number of
423 pending changes, so in aggregate, the cost of this feature is
424 quadratic in the team size.
425
426* the change screen shows if a change is mergeable to the target
427 branch. If the target branch moves quickly (large developer team),
428 this causes cache misses. In aggregate, the cost of this feature is
429 also quadratic.
430
431Both features should be turned off for repositories that involve 1000s
432of developers.
433
434=== Browser performance
435
436// say something about browser performance tuning.
437
438=== Real life numbers
439
440
441Gerrit is designed for very large projects, both open source and
442proprietary commercial projects. For a single Gerrit process, the
443following limits are known to work:
444
445.Observed maximums
446[options="header"]
447|======================================================
448|Parameter | Maximum | Deployment
449|Projects | 50,000 | gerrithub.io
450|Contributors | 150,000 | eclipse.org
451|Bytes/repo | 100G | Qualcomm internal
452|Changes/repo | 300k | Qualcomm internal
453|Revisions/Change | 300 | Qualcomm internal
454|Reviewers/Change | 87 | Qualcomm internal
455|======================================================
456
457
458// find some numbers for these stats:
459// |Files/repo | ? |
460// |Files/Change | ? |
461// |Comments/Change | ? |
462// |max QPS/CPU | ? |
463
464
465Google runs a horizontally scaled deployment. We have seen the
466following per-JVM maximums:
467
468.Observed maximums (googlesource.com)
469[options="header"]
470|======================================================
471|Parameter | Maximum | Deployment
472|Files/repo | 500,000 | chromium-review
473|Bytes/repo | 12G | chromium-review
474|Changes/repo | 500k | chromium-review
475|Revisions/Change | 1900 | chromium-review
476|Files/Change | 10,000| android-review
477|Comments/Change | 1,200 | chromium-review
478|======================================================
479
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800480
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800481== Redundancy & Reliability
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800482
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100483Gerrit is structured as a single JVM process, reading and writing to a
484single file system. If there are hardware failures in the machine
485running the JVM, or the storage holding the repositories, there is no
486recourse; on failure, errors will be returned to the client.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800487
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100488Deployments needing more stringent uptime guarantees can use
489replication/multi-master setup, which ensures availability and
490geographical distribution, at the cost of slower write actions.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800491
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100492// TODO: link.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800493
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800494=== Backups
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800495
Shawn O. Pearce7d2cb042012-05-10 19:12:09 -0700496Using the standard replication plugin, Gerrit can be configured
497to replicate changes made to the local Git repositories over any
498standard Git transports. After the plugin is installed, remote
499destinations can be configured in `'$site_path'/etc/replication.conf`
500to send copies of all changes over SSH to other servers, or to the
501Amazon S3 blob storage service.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800502
503
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800504== Logging Plan
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800505
Han-Wen Nienhuysd7873e62021-02-24 18:41:00 +0100506Gerrit stores Apache style HTTPD logs, as well as ERROR/INFO messages
507from the Java logger, under `$site_dir/logs/`.
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800508
509Published comments contain a publication date, so users can judge
510when the comment was posted and decide if it was "recent" or not.
511Only the timestamp is stored in the database, the IP address of
512the comment author is not stored.
513
514Changes uploaded over the SSH daemon from `git push` have the
515standard Git reflog updated with the date and time that the upload
516occurred, and the Gerrit account identity of who did the upload.
517Changes submitted and merged into a branch also update the
518Git reflog. These logs are available only to the Gerrit site
519administrator, and they are not replicated through the automatic
David Pursehouse92463562013-06-24 10:16:28 +0900520replication noted earlier. These logs are primarily recorded for an
Shawn O. Pearcec4bcc092009-02-06 12:32:57 -0800521"oh s**t" moment where the administrator has to rewind data. In most
522installations they are a waste of disk space. Future versions of
523JGit may allow disabling these logs, and Gerrit may take advantage
524of that feature to stop writing these logs.
525
526A web server positioned in front of Gerrit (such as a reverse proxy)
527or the hosting servlet container may record access logs, and these
528logs may be mined for usage information. This is outside of the
529scope of Gerrit.
530
531
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700532GERRIT
533------
534Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700535
536SEARCHBOX
537---------