Hector Oswaldo Caballero | 28ed83b | 2018-08-06 07:40:18 -0400 | [diff] [blame] | 1 | |
Hector Oswaldo Caballero | 74a07ab | 2015-08-10 17:00:43 -0400 | [diff] [blame] | 2 | @PLUGIN@ Configuration |
| 3 | ========================= |
| 4 | |
Matthias Sohn | f707ea9 | 2019-05-02 23:21:32 +0200 | [diff] [blame] | 5 | The @PLUGIN@ plugin must be installed as a library module in the |
Luca Milanesio | 131888e | 2023-03-30 02:04:10 +0100 | [diff] [blame] | 6 | `$GERRIT_SITE/lib` folder of all the instances and linked to |
| 7 | `$GERRIT_SITE/plugins`, which enable to use it as both libModule |
| 8 | and plugin. |
| 9 | Configuration should be specified in the `$site_path/etc/@PLUGIN@.config` file. |
Luca Milanesio | 716282b | 2018-02-19 15:18:36 -0800 | [diff] [blame] | 10 | |
Luca Milanesio | e05bedb | 2019-02-22 10:20:29 +0000 | [diff] [blame] | 11 | ## Configuration parameters |
Hector Oswaldo Caballero | 74a07ab | 2015-08-10 17:00:43 -0400 | [diff] [blame] | 12 | |
Luca Milanesio | 22ffb22 | 2018-02-21 10:28:30 -0800 | [diff] [blame] | 13 | ```cache.synchronize``` |
Luca Milanesio | 55076f6 | 2023-03-30 01:36:42 +0100 | [diff] [blame] | 14 | : Whether to synchronize cache evictions. Set to false when relying on |
| 15 | low cache TTLs and therefore cache eviction is not strictly needed. |
Luca Milanesio | 9503981 | 2024-04-16 15:28:51 +0100 | [diff] [blame] | 16 | It requires disabling the background cache evictions notifications in |
| 17 | `gerrit.config` by setting `cache.threads = 0`. |
| 18 | |
Owen Li | 6682300 | 2017-05-31 15:44:11 -0400 | [diff] [blame] | 19 | Defaults to true. |
| 20 | |
Luca Milanesio | 22ffb22 | 2018-02-21 10:28:30 -0800 | [diff] [blame] | 21 | ```cache.threadPoolSize``` |
Luca Milanesio | 6b6c5a8 | 2019-03-23 19:46:03 -0700 | [diff] [blame] | 22 | : Maximum number of threads used to send cache evictions to the target |
| 23 | instance. |
| 24 | |
Hugo Arès | 02843f6 | 2018-04-20 08:57:25 +0200 | [diff] [blame] | 25 | Defaults to 4. |
Hugo Arès | a897ed8 | 2017-05-31 11:47:03 -0400 | [diff] [blame] | 26 | |
Luca Milanesio | 22ffb22 | 2018-02-21 10:28:30 -0800 | [diff] [blame] | 27 | ```cache.pattern``` |
David Pursehouse | affefd9 | 2017-08-03 17:18:30 +0200 | [diff] [blame] | 28 | : Pattern to match names of custom caches for which evictions should be |
| 29 | forwarded (in addition to the core caches that are always forwarded). May be |
| 30 | specified more than once to add multiple patterns. |
Luca Milanesio | 6b6c5a8 | 2019-03-23 19:46:03 -0700 | [diff] [blame] | 31 | |
David Pursehouse | affefd9 | 2017-08-03 17:18:30 +0200 | [diff] [blame] | 32 | Defaults to an empty list, meaning only evictions of the core caches are |
| 33 | forwarded. |
| 34 | |
Luca Milanesio | 22ffb22 | 2018-02-21 10:28:30 -0800 | [diff] [blame] | 35 | ```event.synchronize``` |
Luca Milanesio | 55076f6 | 2023-03-30 01:36:42 +0100 | [diff] [blame] | 36 | : Whether to synchronize stream events. Set to false when not using the SSH |
| 37 | stream events. |
Owen Li | 6682300 | 2017-05-31 15:44:11 -0400 | [diff] [blame] | 38 | Defaults to true. |
| 39 | |
Luca Milanesio | f51d7be | 2018-12-15 00:54:03 +0000 | [diff] [blame] | 40 | ```index.numStripedLocks``` |
Matthias Sohn | f707ea9 | 2019-05-02 23:21:32 +0200 | [diff] [blame] | 41 | : Number of striped locks to use during reindexing of secondary indexes. |
Luca Milanesio | f51d7be | 2018-12-15 00:54:03 +0000 | [diff] [blame] | 42 | Defaults to 10 |
| 43 | |
Luca Milanesio | 22ffb22 | 2018-02-21 10:28:30 -0800 | [diff] [blame] | 44 | ```index.synchronize``` |
Luca Milanesio | 55076f6 | 2023-03-30 01:36:42 +0100 | [diff] [blame] | 45 | : Whether to synchronize secondary indexes. Set to false when using multi-site |
| 46 | on Gerrit replicas that do not have an index, or when using an external |
| 47 | service such as ElasticSearch. |
Owen Li | 6682300 | 2017-05-31 15:44:11 -0400 | [diff] [blame] | 48 | Defaults to true. |
| 49 | |
Alvaro Vilaplana Garcia | 5e33558 | 2023-12-18 14:49:05 +0000 | [diff] [blame] | 50 | ```index.synchronizeForced``` |
| 51 | : Whether to synchronize forced index events. E.g. on-line reindex |
| 52 | automatically triggered upon version upgrades. |
| 53 | Defaults to true. |
| 54 | |
Luca Milanesio | 22ffb22 | 2018-02-21 10:28:30 -0800 | [diff] [blame] | 55 | ```index.threadPoolSize``` |
Hector Oswaldo Caballero | 74a07ab | 2015-08-10 17:00:43 -0400 | [diff] [blame] | 56 | : Maximum number of threads used to send index events to the target instance. |
Hugo Arès | 02843f6 | 2018-04-20 08:57:25 +0200 | [diff] [blame] | 57 | Defaults to 4. |
Hugo Arès | 7eeb21e | 2017-03-02 22:48:15 -0500 | [diff] [blame] | 58 | |
Luca Milanesio | 768a4ac | 2018-06-05 23:39:11 +0100 | [diff] [blame] | 59 | ```index.maxTries``` |
| 60 | : Maximum number of times the plugin should attempt to reindex changes. |
Luca Milanesio | 6b6c5a8 | 2019-03-23 19:46:03 -0700 | [diff] [blame] | 61 | Setting this value to 0 will disable retries. After this number of failed |
| 62 | tries, an error is logged and the local index should be considered stale and |
| 63 | needs to be investigated and manually reindexed. |
| 64 | |
Luca Milanesio | 768a4ac | 2018-06-05 23:39:11 +0100 | [diff] [blame] | 65 | Defaults to 2. |
| 66 | |
| 67 | ```index.retryInterval``` |
Matthias Sohn | f707ea9 | 2019-05-02 23:21:32 +0200 | [diff] [blame] | 68 | : The time interval in milliseconds between subsequent auto-retries. |
Luca Milanesio | 768a4ac | 2018-06-05 23:39:11 +0100 | [diff] [blame] | 69 | Defaults to 30000 (30 seconds). |
| 70 | |
Marcin Czech | 6a0bc68 | 2019-11-23 15:26:26 +0100 | [diff] [blame] | 71 | ```broker.indexEventTopic``` |
| 72 | : Name of the topic to use for publishing indexing events |
Luca Milanesio | 9cdf46a | 2019-02-16 00:56:01 +0000 | [diff] [blame] | 73 | Defaults to GERRIT.EVENT.INDEX |
| 74 | |
Marcin Czech | abe9c4c | 2021-08-13 13:05:58 +0200 | [diff] [blame] | 75 | `broker.streamEventTopic` |
Antonio Barone | fef8a61 | 2021-07-27 15:45:52 +0200 | [diff] [blame] | 76 | : Name of the topic to use for publishing all stream events. |
| 77 | Default: gerrit |
| 78 | |
Marcin Czech | 6a0bc68 | 2019-11-23 15:26:26 +0100 | [diff] [blame] | 79 | ```broker.cacheEventTopic``` |
| 80 | : Name of the topic to use for publishing cache eviction events |
David Ostrovsky | d3baad6 | 2019-02-15 14:55:37 +0100 | [diff] [blame] | 81 | Defaults to GERRIT.EVENT.CACHE |
| 82 | |
Marcin Czech | 6a0bc68 | 2019-11-23 15:26:26 +0100 | [diff] [blame] | 83 | ```broker.projectListEventTopic``` |
| 84 | : Name of the topic to use for publishing cache eviction events |
David Ostrovsky | d3baad6 | 2019-02-15 14:55:37 +0100 | [diff] [blame] | 85 | Defaults to GERRIT.EVENT.PROJECT.LIST |
David Ostrovsky | 4ee5947 | 2019-02-14 21:55:48 +0100 | [diff] [blame] | 86 | |
Marcin Czech | 757f005 | 2021-08-26 15:30:55 +0200 | [diff] [blame] | 87 | ```broker.streamEventPublishTimeoutMs``` |
| 88 | : The timeout in milliseconds for publishing stream events. |
| 89 | Defaults to 30000 (30 seconds). |
| 90 | |
Luca Milanesio | 55076f6 | 2023-03-30 01:36:42 +0100 | [diff] [blame] | 91 | **NOTE**: All broker settings are ignored when all of the `cache`, |
| 92 | `index` or `event` synchronization is disabled. |
| 93 | |
Luca Milanesio | 54a643c | 2019-04-24 16:43:23 +0100 | [diff] [blame] | 94 | ```ref-database.enabled``` |
| 95 | : Enable the use of a shared ref-database |
| 96 | Defaults: true |
| 97 | |
Luca Milanesio | ae86555 | 2025-03-13 20:59:35 +0000 | [diff] [blame^] | 98 | ```ref-database.pushReplicationFilterClassEnabled``` |
| 99 | : Enable the filtering of push replication events checking their |
| 100 | up-to-date status with the global-refdb. |
| 101 | Defaults: true |
| 102 | |
| 103 | ```ref-database.pullReplicationFilterClassEnabled``` |
| 104 | : Enable the filtering of pull replication events checking their |
| 105 | up-to-date status with the global-refdb. |
| 106 | Defaults: true |
| 107 | |
Luca Milanesio | 79eb98d | 2025-01-30 09:05:07 +0000 | [diff] [blame] | 108 | ```ref-database.replicationLagEnabled``` |
| 109 | : Enable the metrics to trace the auto-replication lag between sites |
| 110 | updating the `refs/multi-site/version/*` to the _epoch_ timestamp in |
| 111 | milliseconds. Please note that the `replication-lag` REST-API is also |
| 112 | disabled if this setting is false. |
| 113 | Defaults: true |
| 114 | |
Luca Milanesio | 2c3e0a2 | 2022-08-19 15:21:06 +0100 | [diff] [blame] | 115 | ```ref-database.replicationLagRefreshInterval``` |
| 116 | : Enable the auto-refresh of the metrics to trace the auto-replication |
| 117 | lag by polling on a regular basis. Set to zero for disabling the polling |
Luca Milanesio | 79eb98d | 2025-01-30 09:05:07 +0000 | [diff] [blame] | 118 | mechanism. Disabled automatically when `ref-database.replicationLagEnable` |
| 119 | is set to false. |
Luca Milanesio | 2c3e0a2 | 2022-08-19 15:21:06 +0100 | [diff] [blame] | 120 | Defaults: 60 min |
| 121 | |
Tiago Palma | 251f2ec | 2019-04-30 18:46:08 +0100 | [diff] [blame] | 122 | ```ref-database.enforcementRules.<policy>``` |
| 123 | : Level of consistency enforcement across sites on a project:refs basis. |
Antonio Barone | d13c2b7 | 2020-10-02 18:54:30 +0200 | [diff] [blame] | 124 | Supports two values for enforcing the policy on multiple projects or refs. |
Tiago Palma | 251f2ec | 2019-04-30 18:46:08 +0100 | [diff] [blame] | 125 | If the project or ref is omitted, apply the policy to all projects or all refs. |
| 126 | |
| 127 | The <policy> can be one of the following values: |
| 128 | |
| 129 | 1. REQUIRED - Throw an exception if a git ref-update is processed again |
| 130 | a local ref not yet in sync with the shared ref-database. |
| 131 | The user transaction is cancelled. The Gerrit GUI (or the Git client) |
| 132 | receives an HTTP 500 - Internal Server Error. |
| 133 | |
Antonio Barone | d13c2b7 | 2020-10-02 18:54:30 +0200 | [diff] [blame] | 134 | 2. IGNORED - Ignore any validation against the shared ref-database. |
Tiago Palma | 251f2ec | 2019-04-30 18:46:08 +0100 | [diff] [blame] | 135 | |
| 136 | *Example:* |
| 137 | ``` |
| 138 | [ref-database "enforcementRules"] |
Antonio Barone | d13c2b7 | 2020-10-02 18:54:30 +0200 | [diff] [blame] | 139 | IGNORED = AProject:/refs/heads/feature |
Tiago Palma | 251f2ec | 2019-04-30 18:46:08 +0100 | [diff] [blame] | 140 | ``` |
| 141 | |
Antonio Barone | d13c2b7 | 2020-10-02 18:54:30 +0200 | [diff] [blame] | 142 | Ignore the alignment with the shared ref-database for AProject on refs/heads/feature. |
Tiago Palma | 251f2ec | 2019-04-30 18:46:08 +0100 | [diff] [blame] | 143 | |
Marcin Czech | c793551 | 2020-08-21 16:59:34 +0200 | [diff] [blame] | 144 | Defaults: No rules = All projects are REQUIRED to be consistent on all refs. |
| 145 | |
| 146 | ```projects.pattern``` |
| 147 | : Specifies which projects events should be send via broker. It can be provided more |
| 148 | than once, and supports three formats: regular expressions, wildcard matching, and single |
| 149 | project matching. All three formats match case-sensitive. |
| 150 | |
| 151 | Values starting with a caret `^` are treated as regular |
| 152 | expressions. For the regular expressions details please follow |
| 153 | official [java documentation](https://docs.oracle.com/javase/tutorial/essential/regex/). |
| 154 | |
| 155 | Please note that regular expressions could also be used |
| 156 | with inverse match. |
| 157 | |
| 158 | Values that are not regular expressions and end in `*` are |
| 159 | treated as wildcard matches. Wildcards match projects whose |
| 160 | name agrees from the beginning until the trailing `*`. So |
| 161 | `foo/b*` would match the projects `foo/b`, `foo/bar`, and |
| 162 | `foo/baz`, but neither `foobar`, nor `bar/foo/baz`. |
| 163 | |
| 164 | Values that are neither regular expressions nor wildcards are |
| 165 | treated as single project matches. So `foo/bar` matches only |
| 166 | the project `foo/bar`, but no other project. |
| 167 | |
| 168 | By default, all projects are matched. |
Luca Milanesio | 131888e | 2023-03-30 02:04:10 +0100 | [diff] [blame] | 169 | |
Marcin Czech | 48520e7 | 2023-04-05 10:51:46 +0200 | [diff] [blame] | 170 | ```replication.push-filter.minWaitBeforeReloadLocalVersionMs``` |
| 171 | : Specifies the minimum amount of time in milliseconds replication plugin filter will |
| 172 | wait before retrying check for ref which is not up to date with global-refdb. |
| 173 | |
| 174 | By default: 1000 milliseconds |
| 175 | |
| 176 | ```replication.push-filter.maxRandomWaitBeforeReloadLocalVersionMs``` |
| 177 | : Specifies the additional amount of time in milliseconds replication filter will |
| 178 | wait before retrying check for ref which is not up to date with global-refdb. |
| 179 | |
| 180 | If maxRandomWaitBeforeReloadLocalVersionMs is set to zero random sleep for not in sync |
| 181 | refs is disabled. |
| 182 | |
| 183 | By default: 1000 milliseconds |
| 184 | |
| 185 | ```replication.fetch-filter.minWaitBeforeReloadLocalVersionMs``` |
| 186 | : Specifies the minimum amount of time in milliseconds pull-replication filter wait |
| 187 | before retrying check for ref which is not up to date with global-refdb. |
| 188 | |
| 189 | By default: 1000 milliseconds |
| 190 | |
| 191 | ```replication.fetch-filter.maxRandomWaitBeforeReloadLocalVersionMs``` |
| 192 | : Specifies the additional amount of time in milliseconds pull-replication filter will |
| 193 | wait before retrying check for ref which is not up to date with global-refdb. |
| 194 | |
| 195 | If maxRandomWaitBeforeReloadLocalVersionMs is set to zero random sleep for not in sync |
| 196 | refs is disabled. |
| 197 | |
| 198 | By default: 1000 milliseconds |
| 199 | |
Luca Milanesio | 131888e | 2023-03-30 02:04:10 +0100 | [diff] [blame] | 200 | ## Replication filters |
| 201 | |
| 202 | The @PLUGIN@ plugin is also responsible for filtering out replication events that may |
| 203 | risk to create a split-brain situation. |
| 204 | It integrates the push and pull replication filtering extension points for validating |
| 205 | the refs to be replicated and dropping some of them. |
| 206 | |
| 207 | **Replication plugin** |
| 208 | |
| 209 | When using the Gerrit core replication plugin, also known as push-replication, link the |
| 210 | `replication.jar` to the `$GERRIT_SITE/lib` directory and add the following libModule |
| 211 | to `gerrit.config`: |
| 212 | |
| 213 | ``` |
| 214 | [gerrit] |
| 215 | installModule = com.googlesource.gerrit.plugins.replication.ReplicationExtensionPointModule |
| 216 | ``` |
| 217 | |
| 218 | The above configuration would be automatically detected by the @PLUGIN@ plugin which would then |
| 219 | install the PushReplicationFilterModule for filtering outgoing replication refs based |
| 220 | on their global-refdb status: |
| 221 | |
| 222 | - Outgoing replication of refs that are NOT up-to-date with the global-refdb will be |
| 223 | discarded, because they may cause split-brain on the remote replication endpoints. |
| 224 | |
| 225 | - All other refs will be pushed as normal to the remote replication ends. |
| 226 | |
| 227 | **Pull-replication plugin** |
| 228 | |
| 229 | When using the [pull-replication](https://gerrit.googlesource.com/plugins/pull-replication) |
| 230 | plugin, link the `pull-replication.jar` to the `$GERRIT_SITE/lib` directory and add the following |
| 231 | two libModules to `gerrit.config`: |
| 232 | |
| 233 | ``` |
| 234 | [gerrit] |
| 235 | installModule = com.googlesource.gerrit.plugins.replication.pull.ReplicationExtensionPointModule |
| 236 | ``` |
| 237 | |
| 238 | The above configuration would be automatically detected by the @PLUGIN@ plugin which would then |
| 239 | install the PullReplicationFilterModule for filtering incoming fetch replication refs based |
| 240 | on their global-refdb status. |
| 241 | |
| 242 | - Incoming replication of refs that locally are already up-to-date with the global-refdb will be |
| 243 | discarded, because they would not add anything more to the current status of the local refs. |
| 244 | |
| 245 | - All other refs will be fetched as normal from the replication sources. |