Gerrit 3.6 is fully compatible with Java 17 LTS.
Gerrit deprecates the use of Prolog for definition of custom logic in the submit rules. From this version onwards the rules can be expressed using the new concept of Submit Requirements.
Submit Requirements have several advantages, compared to the legacy Prolog rules:
- Easier to understand, defined through simple boolean expressions using a higher-level change search predicates and common boolean operator.
- Lower footprint: they do not require backtracking in their evaluation, consuming less CPU cycles.
- Richer GUI: makes it easy for reviewers and change owners to identify and understand missing requirements.
Existing projects relying on Prolog will still work as expected, allowing a smoother project transition.
Submit requirements also introduce new handy functions that allow to achieve complex rules equivalent to the old Prolog rules but with an easier syntax:
- support checking on content modifications and file diffs with the
distinctvoterspredicate allows gating submission on N distinct voters across more than one label.
authoremailoperator similar to the older
messagepredicate to support regular expression on the commit message as a condition.
NOTE: With the new submit requirements, submit records are no longer emitted. This means that any queries with the label formats (
label:Code-Review=OK) will no longer match with changes. See more details in Change 330203.
Schema and index changes
This release doesn’t formally contain schema changes, however the NoteDb format has evolved and includes the following amendments:
Change 324937: The label in NoteDb has a UUID suffix
Change 323897: The review score is only read from the latest patch-set
NOTE: Because of the above incompatibilities, upgrade is supported only from Gerrit v3.5.2 onwards, because of the need of the extra
copy-approvalstool and the backward compatibility fix on UUID suffixed labels. Failing to run the
copy-approvalstool in v3.5.2 would leave the changes with a potentially stale approval score once the site is migrated to v3.6.
changes index version has been increased to version 77. By default the
index is automatically rebuilt upon the Gerrit startup after the
Upgrade to Gerrit v3.5.2 or later and make sure that the
site program has been run at least once.
java -jar gerrit.war copy-approvals -d site_path
Download the Gerrit v3.6.0 war and
java -jar gerrit-3.6.0.war init -d site_path
Run offline reindexing of the changes:
java -jar gerrit.war reindex --index changes -d site_path
Online upgrade with zero-downtime
Gerrit v3.6.x supports zero-downtime upgrade from Gerrit v3.5.2 or later when configured using a high-availability configuration, and the Git repositories are stored in a shared filesystem such as NFS or similar.
During the zero-downtime upgrade, Gerrit end-users would not notice any outage or service disruption. They will be able to perform any read/write Gerrit operation on the GUI or using using any API.
The zero-downtime upgrade consists of the following steps:
- Have Gerrit servers running v3.5.2 or later, in high-availability configuration, healthy and able to handle the incoming traffic properly.
- Run the
copy-approvalsSSH command against one of the Gerrit servers and wait for completion on all changes for all projects.
- Set the Gerrit server unhealthy.
- Shutdown the Gerrit server, update gerrit.war and plugins to v3.6.x and start Gerrit again.
- Verify that the Gerrit server is working properly (e.g. run automated smoke tests) and then make it healthy again.
- Wait for the Gerrit server to start serving traffic normally.
- Repeat steps 3. to 6. for all the other Gerrit servers.
The ignore feature is completely removed from Gerrit’s web app; the
unignoreactions and the associated
is:ignoredpredicate are not supported anymore.
Gerrit has the attention set feature since v3.4. If you want to ignore a change, then you can remove yourself from the attention set or the list of reviewers/ccs. That makes it also clearer to your collaborators that you don’t want to participate.
The legacy ignore feature did not have any effect on the user’s dashboard or attention set but was limited to the execution of the
is:ignoredpredicate. On Google hosted Gerrit the feature is used by about 5 users per week. 20% of ignore action clicks were accidental.
Change 321607: Assignee feature is completely removed from the Gerrit UI
The Attention Set feature has been launched in Gerrit v3.3, and assignee has been turned off by default for three releases. The feature is now completely removed and cannot be enabled anymore by config.
Before this release all Project Owners had implicit delete permission to all refs unless force-push was blocked for the user. Admins that are relying on previous behavior or wish to maintain it for their users can simply add the permission explicitly in All-Projects:
[access "refs/*"] delete = Project Owners
NOTE: If you choose to do so, blocking force-push no longer has any effect on permission to delete refs by means other than git (REST, UI).
Support for CentOS is dropped and the base image replaced by AlmaLinux
RedHat anticipated the EOL of CentOS to December 2021 making hard for the Gerrit community to continue to support existing Docker setups on CentOS. The default base image now uses AlmaLinux 8 which promises to have a much longer life as open-source OS and has an easy migration tool from CentOS 8 available.
Apache Commons Lang v2 is removed
Gerrit moved to Apache Commons Lang v3 replacing all legacy use of the older lang v2 from its dependencies. Existing plugins and scripts that are using Apache Commons Lang v2 must be rebuilt to use the new library or declare the older Apache Commons Lang v2 as an explicit dependency.
Change 331259: Deprecate the
registerStyleModule()JS plugin API
Change 330403: Support validation options for branch creation to be used in RefOperationValidationListener implemented in plugins.
Change 330200: Add support for specifying validation options in rebase and cherry-pick REST endpoint and implemented in plugins.
Upgrade to gitiles v1.0.0
Gerrit UI changes
Change 324242: Add syntax highlighting for Markdown
Reuse and enable highlight.js syntax highlighting of Markdown files.
Issue 15715: Fix the editing workflow in the web app
Change 330301: Adding tab navigation for hovercards
Change 330919: Show Change actions regardless if logged in or not, because the gr-change-actions correctly hides the actions that the current user cannot do.
Change 333299: Remove the front-end metric
diffViewDiplayedto represent highlighting a whole file.
Change 330204: Adds changes and dashboard link to account hovercard.
Change 330084: Status field renamed to About me and no icon is shown.
End-to-End tests changes
New test properties are available in the End-to-End tests:
Update jgit to v22.214.171.124203080745-r
most important changes since 5.13:
- [push] support the “matching” RefSpecs “:” and “+:”
- IndexDiff: use tree filter also for SubmoduleWalk
- Describe: add support for core.abbrev config option
- PersonIdent: Add ctors that accept Instant in addition to Date
- Cap describe abbrev option, minimum is 4, maximum is length of a full ObjectId
- DescribeCommand: Add support for –abbrev=0
- DescribeCommand: Support configuring the hash abbreviation
- PushCommand: determine remote from git config if not given
- PushCommand: consider push.default when no RefSpecs are given
- Support for git config push.default
- Support for “lfs.url” from “.lfsconfig”
- Support LFS Server URL without .git suffix
- [rebase] Enable users to have a Change-ID be generated when squashing or rewording commits.
- RepoCommand: Add API to set extra files in the destination repository
- RebaseCommand: better commit message rewording. Respect git config commit.cleanup for rewording.
- CommitCommand: implement git commit –cleanup.
- Provide git config commit.cleanup
- sshd: support the ConnectTimeout ssh config
- sshd: Skip unknown keys from the SSH agent
- sshd: support the AddKeysToAgent ssh config
- sshd: handle “IdentityAgent SSH_AUTH_SOCK” in ssh config
- sshd: Connector for the Win32-OpenSSH SSH agent
- sshd: handle IdentitiesOnly with an SSH agent
- shd: support IdentityAgent config
- Add config reader for user-defined difftools
- Add command line support for “git difftool”
- Transport: load all refs only if push refspecs have wildcards
- UploadPack v2 protocol: Stop negotiation for orphan refs
- PackBitmapIndexV1: support parallel loading of reverse index
- RefDirectory.scanRef: Re-use file existence check done in snapshot creation
- FileSnapshot: Lazy load file store attributes cache
- Support commit.template git config option
- ssh: Handle “ProxyJump none” from SSH config file
- OpenSshConfigFile: update handling of line comments and quoted strings following changes in OpenSSH
- OpenSshConfigFile: update token replacements. It appears that the OpenSSH documentation has changed; it now allows more flags for a number of keys.
- [sshd agent] Introduce ConnectorDescriptor
- sshd: add support for ssh-agent
- Binary and CR-LF detection: conclude file is binary if it contains a lone CR like C git
- Make the buffer size for text/binary detection configurable
- GarbageCollectCommand: add numberOfBitmaps to statistics
- Don’t block in GC#gc until garbage collection finished
- Let ObjectDatabase implement AutoClosable
- Optimize RevWalk.getMergedInto() to improve performance
- improve how git system config is found
- Bump minimum required Java version to 11
- [checkout] Use .gitattributes from the commit to be checked out
- [push] Call the pre-push hook later in the push process
- Prevent that an instance of PushCommand is reused
- Stop initCause throwing in readAdvertisedRefs
- Make sure to close Repository in tests
- Fix resource leak in CancellableDigestOutputStreamTest
- RebaseCommand: fix commit message in “fixup” case
- BinaryHunkInputStream: accept CR-LF
- Merge conflict messages: prefix conflict lines with a hash
- ObjectWalk: close ObjectReader on close() if needed
- LFS: Fix error occurring during delete branch
- sshd: backport upstream fix for SSHD-1231
- Use FileSnapshot without using configs for FileBasedConfig
- TreeRevFilter: fix wrong stop when the given path disappears
- storage: file: De-duplicate File.exists()+File.isFile()
- Fix checkout of files with mixed line endings on text=auto eol=crlf
- Fix missing peel-part in lsRefsV2 for loose annotated tags
- Fix RevWalk.getMergedInto() ignoring annotated tags
- Reftable: close old Db in FileRepository#convertToPackedRefs
- Reftable: Reload the stack before trying to delete the files. This ensures we don’t trip over our own open file handles when deleting compacted tables.
- Reftable: drop code for truncated reads
- Reftable: pass on invalid object ID in conversion
Other dependency changes
Update sshd to 2.8.0
The highlights of SSHD update from Gerrit’s perspective are:
SSHD-1216: Server-side implementation of the RFC 8332 server-sig-algs extension: the server announces that it prefers the SHA-2 signatures for RSA keys.
SSHD-1197: A race condition in key exchange fixed.
SSHD-1163: DH group exchange got a fix relating to RSA SHA-2 signatures.
Update codemirror-minified to 5.65.0
Update highlight.js to 11.5.0
Update rules_nodejs version to 5.1.0
Update rules_go version to 0.30
Update protobuf version to 3.19.4
Other core changes
Change 334747: Fixed missing return type in e2e-tests
Change 334557: Make the computing of the diff cache thread-safe.
The computation previously failed with a zlib exception that was logged as if the packfile was corrupt even though it wasn’t.
Change 333706: Added support for ‘is:
' in approval copy condition queries to make arbitrary voting values sticky
Change 332139: Stop adding project-owners to
To:of the emails for new changes.
Issue 16322: Limit the number of changes that can be submitted together
When chaining changes together, the sequence of commits to navigate was previously unbound, causing the potential operations explosion. The explosion could have also been accidental and caused by the push of a change with a non-existent branch, which would have resulted in the full scan of the repository for changes. Introduce a new Gerrit configuration
change.maxSubmittableAtOncewith a safe default of
1024, which would allow any use case that would have also worked before this change.
Change 347496: Enable project_list cache warmer when
Change 341454: GitwebServlet: Retrieve git path from FileRepository so that it can be used with multi-site and cached-refdb modules
Change 350577 copy-approvals: use multiple threads for copy-approvals, improve performance
Split the work into slices of changes and then utilize one thread per slice. Also skip unnecessary reindexing. On a large Gerrit site with 1.3 million changes, this reduced the time for copy-approvals from 5 hours to 15-20 minutes.
Change 350236 Optimized change visibilty checking when the project is hidden
Looping over every change when the whole project isn’t readable is a waste of CPU. It’s a bigger waste to fetch all the change data in the first place.
Issue 16379: Remove key locking for disabled caches
This change also makes the memoryLimit behaviour consistent with the diskLimit set to zero means disabling the implementation of the cache.
Change 349895: Add AndCardinalPredicate and OrCardinalPredicate
Before this change, IndexSource derived cardinality from predicate which implement
OrPredicatedoes not return cardinality, IndexSource defaults to 10 when query comprises more than one predicate. Due to this behavior,
AndSourcechooses IndexSource almost always when query contains more than one index predicate. This helps
AndSourceto choose the right source more often.
Change 347956: Introduce possibility to define the cardinality so that
AndSourcepredicate can work more efficiently
Before this change, cardinality of the IndexSource was always set to
- This makes
AndSourceto choose IndexSource over other sources most of the time. Add a
HasCardinalityinterface which can be used by all the predicates which implement IndexPredicate to set a cardinality. This helps AndSource to choose the right datasource.
- This makes
Change 349355: Cache repository locations in LocalDiskRepositoryManager
Obtaining the actual location of a repository using base-path and project name can be slow as it involves some guessing to locate the repository. Cache the locations once they are obtained to avoid repeated work, thereby improving performance when opening repositories.
Change 347955: Consider cardinality while choosing the data source for
Before this change,
AndSourceconsidered cost to choose a datasource. Ideally cost should be used to determine which predicate to run
#match()against first, so that queries are faster. Cardinality should be used to determine which datasource to be picked so that there are fewer changes to process. Consider cardinality of the datasource to choose the source and use cost when cardinality is same.
Change 350576 copy-approvals: continue when there are corrupt meta-refs in a project
If there was a corrupt meta-ref in a project, the copy-approvals failed for all changes in that project. Mitigates [Issue 16326].
Change 350575 copy-approvals: don’t stop when it fails on one project
When copying of approvals failed in one project it skipped copying of approvals for other projects where it would potentially finish successfully.
Change 350414 Fix index rewriter to rewrite all Or/AndPredicates. AndSource chooses right source more often
Change 349314 Fix reindex with label copyCondition containing group.
Change 77495: Fix for IllegalStateException during the Gerrit start when
cache.projects.refreshAfterWriteis set to true and prolog rules are used
Change 350014: Do not set cherryPickOf on RevertSubmission
The RevertSubmission internally uses CherryPickChange operation. It creates the ‘normal’ revert for the first change in the relation chain, for each subsequent change it creates a revert commit that is then cherry-picked. This cherry-pick is not a cherry-pick of the reverted change. This is a cherry-pick of the revert commit of the original change. This change fixes the bug in the logic that sets cherryPickOf to the original (reverted) change, using the CherryPickChange operation.
Change 349894: Don’t always rewrite And/OrPredicate to And/OrSource
Before this change OrPredicate was always rewritten to OrSource. This is not the right thing to do as
OrSource#read()will eventually fail when there is at least one non-datasource child. Since Change 347955,
AndSourcepicks a source which has the lowest cardinality which makes the
OrSource#read()failures more visible. Rewrite
OrSourceonly when all the children in the predicate are DataSources.
Change 348715; Clarify that a restart is needed before changes to email templates take effect
Issue 16182: Reintroduce the Change-Id footer in change screen
This change reintroduce the Change-Id footer below the commit message on the Gerrit UI.
Issue 10168: Fix HTTP 404 when browsing tags on Gitweb
The Gitweb links to tags have been broken in v2.14.10 onwards. Gitweb supports the ‘a=tags’ rendering action for annotated tags only, returning 404 for all lightweight tags. Use the generic ‘a=shortlog’ for Gitweb links to tags which would work for both annotated and lightweight ones.
Change 347495: Fix for IllegalStateException during the Gerrit start when
cache.projects.refreshAfterWriteis set to true and prolog rules are used
Issue 15997: Make DelegateRepository#delegate() method public to allow plugins/modules to access it
Issue 16054: Fix confidentiality leak by users with create ref permission using the create branch REST-API
Any user with create ref permission was able to gain access to any SHA1 or refs, including the ones that they would not have permission to see.
Issue 15941: Fix SSH queries to not show commit-message unless –commit-message is provided
This issue has existed for several years and should be considered breaking as users might expect commit message to be included by default in SSH query results. Obtaining the commit message is a costly operation as the commit data has to be loaded. So, showing it even when –commit-message is not provided degrades the performance of SSH queries.
Change 344300: Add missing return values in MetricMaker’s
When new callback and constant metrics were created the RegistrationHandle was not returned, making impossible to de-register them. The method signature is now aligned, however, all plugins, including the core ones, that were registering callback or constant metrics would need to be rebuilt from source or downloaded from the latest build on Gerrit-CI.
Change 343096: Introduce
index.paginationType=SEARCH_AFTERconfiguration for speeding up query pagination
Change 343798: Introduce
index.pageSizeMultiplierconfiguration to paginate index queries with increasing size
Change 344334: Implement
no-limitqueries with multiple pages, make them usable with Elasticsearch
Change 345017: Add public
EventTypes.getRegisteredEvents()for accessing all stream event types from plugins
Change 340714: Introduce metrics configuration for different data reservoirs
Change 347496: New configuration option to periodically warm the project_list cache
Reduce the likelihood of the project_list cache being evicted by providing an option to periodically warm it up. When this warmer is enabled, change detail page loads are consistently faster.
Change 338154: Lazy load change notes when submit by push Improves performance of change submit via push
Change 338614 Optimize SSH queries to avoid loading individual accounts This improves performance of SSH queries.
Change 338474: Allow async receive-commits to have a thread-local cache Improve caching when merging changes through git push
Change 338574: Cache ProjectControl instances in SSH queries A PerThreadCache is used to cache ProjectControl instances to improve SSH query performance.
Change 338834: Avoid creating an IdentifiedUser multiple times in a SSH query This improves performance of SSH queries.
Issue 16306: Fix Bazel build on Apple M2 ARM64 chip
Issue 16284: Fix performance issues with git-upload-pack on repositories with a large number of changes
Issue 16043: Fix reindexing for changes with a commit message longer than 32766 bytes
Change 347474: Fix DefaultMemoryCacheFactory to correctly set refreshAfterWrite Setting refreshAfterWrite in gerrit.config now works and does not mistakenly set expireAfterAccess
Change 340635: Fix CSS of the Contributor Agreement screen which was preventing to sign CLAs
Issue 15997: Make delegate() method public git-repo-metrics plugin now works with multi-site setup
Issue 16018 Don’t try to mark files as reviewed when not logged in Fix marking of reviewed flag when not logged in. “Log in is required to perform that action” popup is no longer seen when viewing file diffs unauthenticated.
Issue 16038: Fix “internal error” when pushing to refs/users/xx/xxxx Push over HTTP to refs/users/* branch now works and doesn’t fail with “error: internal error” / Not Signed In
Issue 16001: AsciiDoctor: skip attribute when looking for title Fix documentation search showing :linkattrs: instead of the document title
Issue 15134: Apply the match operator to filter projects Next-arrow is now not hidden when searching for repositories in the Repository section
Change 337474: Use sane value for QueryProcessor’s effective limit on “–no-limit” Fix errors seen when –no-limit query option is used with ES index backend
Change 339754: Fix gerrit review command with branch option
The gerrit review command was not able to find the commit with branch option; ensure “refs/heads/” prefix is present for branch option.
Issue 16106: Fix label operator to work with external groups, which never worked before since its addition in v2.10.
Change 331762: Cache permission filtering for All-Projects, allowing a faster ACL evaluation to any refs.
Change 343694: Improve performance of queries that check the visibility of changes wrt a non-current user
Change 346254: Fix change queries evaluation of
ANDterms to run match on predicate whose cost is least
Sort the change queries predicates in
ANDbased on cost and cardinality, which was broken since Change 79391.
WARNING: queries containing predicates with poorly defined costs or cardinalities could perform worse now.
Update JGit to d01376106af8800017ac3c08d7c7ac1fd5ccc9ee, including the following fixes and improvements:
- 011c26ff3 - Fix connection leak for smart http connections
- d67ac798f - Remove stray files (probes or lock files) created by background threads
- 035e0e23f - UploadPack: don’t prematurely terminate timer in case of error
- 66ace4b9a - UploadPack: do not check reachability of visible SHA1s
- 8984e1f66 - HTTP Smart: set correct HTTP status on error
Change 340534 Fix link to change.mergeabilityComputationBehavior in user-search.txt
Change 339235 Add copy-approvals SSH command link to the index page
Change 338949 Fix auto-generated documentation header for plugins
Change 337835 rest-api-projects: Fix documentation for #inherited-boolean-info
Change 340114 sshd config: Reference implementation sections upstream
Change 339819 Supplement key exchange supported by Apache MINA
Change 339818 Supplement ‘encrypt-then-MAC’ supported by Apache MINA
Change 339815 Supplement cipher algorithms in sshd.cipher section
Issue 15957: Fix loading ssh and gpg keys in Gerrit UI and make the text areas have a white background
The Gerrit UI did not display the list of the user’s SSH and GPG keys, even if they were present in the user’s profile and working as expected.
- Change 337014: Plugins named with hyphens can now define query operators