summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'stable-2.14' into stable-2.15v2.15.1David Pursehouse2018-02-255-86/+90
|\ | | | | | | | | | | | | | | | | | | * stable-2.14: Fix creating missing repository Fix project deletion logs Use logger built-in formatter Fix project creation logs Change-Id: Idacfd3fa54d7ff5e974bc8dae41979d1f0d9b6b5
| * Fix creating missing repositoryv2.14.7Hector Oswaldo Caballero2018-02-222-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When replicating to a destination where the repository does not exist, updating the HEAD reference failed because the passed reference name was not absolute. When this happened, an unchecked exception was triggered but never showed in the logs. In fact, the replication logs were showing only the message announcing the replication started, but no additional information about the success or failure of the operation was displayed. Avoid this by resolving symbolic references and checking the reference is absolute before trying to update the HEAD in the new repository. Change-Id: I18295a37a04413ba64bf7e9ee31640ee23c4c1e0
| * Fix project deletion logsHector Oswaldo Caballero2018-02-211-2/+2
| | | | | | | | | | | | Log was showing project was deleted successfully even if it failed. Change-Id: I7be19991619ce1f205884a8b6658d9a7ed4109c7
| * Use logger built-in formatterHector Oswaldo Caballero2018-02-215-82/+78
| | | | | | | | Change-Id: I6b46309f07ca4c402ae7a51cfb462c1be6bec333
| * Fix project creation logsHector Oswaldo Caballero2018-02-211-2/+2
| | | | | | | | | | | | Log was showing project was created successfully even if it failed. Change-Id: Ie37e6f2f58e1c8b4e33f61bf2d81ee43698b8aa3
* | GerritSshApi: Use Logger's string formattingDavid Pursehouse2018-02-251-5/+8
| | | | | | | | Change-Id: Ie7fef1b311f6f7fe14aa79c6023b897d91127087
* | Revert "Use proper HEAD ref value when creating project"David Pursehouse2018-02-251-20/+0
| | | | | | | | | | | | | | | | | | | | The issue fixed by this commit was fixed in a different way on the stable-2.14 branch. Reverting this on stable-2.15 will make the merge from stable-2.14 easier. This reverts commit e145010de7911623c98e6111537ffa4997d1a82e. Change-Id: I7e44f62f119b7ed26c8d96bfe9ef8442ff687b29
* | Merge branch 'stable-2.14' into stable-2.15v2.15-rc4v2.15-rc3v2.15David Pursehouse2018-02-011-0/+4
|\| | | | | | | | | | | | | * stable-2.14: Document how to exclude projects from replication Change-Id: I2189f3aabcdc5ee3ca8204886a6c7686af626c04
| * Document how to exclude projects from replicationDavid Pursehouse2017-12-131-0/+4
| | | | | | | | Change-Id: I8a12011e28be44d600a3ed63eebe596560d73e5f
* | Document which branches must be replicated to replicate the account datav2.15-rc2v2.15-rc1Edwin Kempin2017-10-091-0/+12
| | | | | | | | | | | | Change-Id: I2c9dc06927cd8e9e541eb032829029bdfac8db6e Signed-off-by: Edwin Kempin <ekempin@google.com> (cherry picked from commit 93ab1609a4ba32e9466ff0649317b84a211285ad)
* | Merge branch 'stable-2.14'v2.15-rc0David Pursehouse2017-09-150-0/+0
|\| | | | | | | | | | | | | | | | | * stable-2.14: Fix minor nits in documentation of replication.maxRetries Fix replication retries when maxRetries is set to 0 Set max retries to avoid queue congestion Change-Id: I303d3b471bc98eaead33cfa49d614b176cf34f58
| * Merge branch 'stable-2.13' into stable-2.14v2.14.6v2.14.5.1v2.14.5v2.14.4Hugo Arès2017-09-140-0/+0
| |\ | | | | | | | | | | | | | | | | | | | | | | | | * stable-2.13: Fix minor nits in documentation of replication.maxRetries Fix replication retries when maxRetries is set to 0 Set max retries to avoid queue congestion Change-Id: Icf972f3df7d3d59925db670bc1f033028306d0c1
| | * Fix minor nits in documentation of replication.maxRetriesv2.13.14v2.13.13v2.13.12v2.13.11v2.13.10upstream/stable-2.13David Pursehouse2017-06-021-3/+3
| | | | | | | | | | | | Change-Id: I80e46269e12b9e7a429634dd90ce52e90cc6ad79
| | * Fix replication retries when maxRetries is set to 0Hugo Arès2017-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | maxRetries defaults to 0 which means retry indefinitely but it was not retrying. Change-Id: I6c8d8d6b1511d67b647f25193dcfe860687eea76
| | * Set max retries to avoid queue congestionLuca Milanesio2017-05-294-4/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When servers have *a lot* of remote slaves, some of them unstable and potentially offline, a maximum retry policy is needed to prevent push events to stay in the replication queue and getting rescheduled forever. Keep backward-compatible configuration by setting maxRetry by default to zero, which means disabled. Change-Id: I060cc7bc3a4d1089b0815db02d2e1430f83a2015
* | | Use proper HEAD ref value when creating projectDariusz Luksza2017-09-061-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | Wrong name of HEAD reference was used when repository was created after RepositoryNotFoundException. This results in HEAD pointing to HEAD. Change-Id: I647618fc6d35a5e2ff6bcfeda5084584e591ddda Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
* | | Merge "Merge branch 'stable-2.14'"David Pursehouse2017-09-065-6/+99
|\ \ \
| * | | Merge branch 'stable-2.14'David Pursehouse2017-08-235-6/+99
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-2.14: Fix minor nits in documentation of replication.maxRetries Use rescheduleDelay instead of replicationDelay when rescheduling Fix race condition when scheduling a replication Change-Id: I45c6f5a266709e2ce85d2140f13e4ece7da69341
| | * | Fix minor nits in documentation of replication.maxRetriesv2.14.3David Pursehouse2017-08-231-3/+3
| | | | | | | | | | | | | | | | Change-Id: I80e46269e12b9e7a429634dd90ce52e90cc6ad79
| | * | Use rescheduleDelay instead of replicationDelay when reschedulingv2.14.2Saša Živkov2017-07-125-2/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The replicationDelay was used for two purposes: a) initial delay to schedule a replication b) delay when rescheduling the replication due to an in-flight push The replicationDelay could be set to zero, which make sense for the case a) but doesn't make sense for the case b). Actually, when replicationDelay is set to zero, the case b) will cause an excessive number of retries (over 1K/second) and will also fire a replication failed event for each retry. The latter is yet another issue and will be addressed in another change. Introduce a new config parameter rescheduleDelay and use it for the case b). Make sure it cannot bet set to a value lower than 3 seconds to avoid the same issue. In order to keep backwards compabitility with using the replicationDelay as rescheduleDelay, a plugin init step is added. For each remote section which doesn't already define rescheduleDelay, it will set rescheduleDelay to the current value of the replicationDelay, unless replicationDelay is set to zero. In the latter case it will assume the default value for the rescheduleDelay. Change-Id: Ia78f46460b531b04ee36ec2d5ab4228dba5c0c50
| | * | Fix race condition when scheduling a replicationSaša Živkov2017-07-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The state of PushOne object was modified after the operation was scheduled. Depending on the delay parameter the PushOne.run() could be called before (when the delay is zero or close to zero) or after (longer delay) the current thread calls e.addState(ref, state). Thus, the thread executing PushOne.run() may or may not see the update of its stateMap. Further, the stateMap is a LinkedListMultimap which is not thread safe and the PushOne doesn't synchronize access to it. Change-Id: Ib26a5933a7993a6d2f0501e5daaf06a7892e597f
* | | | Bazel: User constants for plugins API dependenciesDavid Ostrovsky2017-08-251-7/+3
|/ / / | | | | | | | | | Change-Id: Ie7dc1b22f087ebb8f7aeb17def43a476745686c6
* | | Refactor callers of RefControl#isVisiblePatrick Hiesel2017-08-161-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | This commit refactors callers to use PermissionBackend instead of RefControl#isVisible and adds handling for PermissionBackendException on EventDispatcher#postEvent. Change-Id: Ic6378b0fd88cc770b061c551d0511d352a9f3d61
* | | Migrate calls to ChangeControl#isVisible to PermissionBackendPatrick Hiesel2017-08-072-4/+8
| | | | | | | | | | | | Change-Id: I740e70aa799b5cc5e74ed86054876d1baa753373
* | | Remove unused importEdwin Kempin2017-06-271-1/+0
| | | | | | | | | | | | | | | Change-Id: I5a8440372e10fcb7d0232aa3ede64f6eae43563b Signed-off-by: Edwin Kempin <ekempin@google.com>
* | | Avoid using ScheduledThreadPoolExecutor API surface.Han-Wen Nienhuys2017-06-221-4/+4
| | | | | | | | | | | | Change-Id: Iebed5fb06f45760ce73e47cc203e4bcd8634db8e
* | | Remove CapabilityControl.Factory from RemoteSiteUserShawn Pearce2017-06-161-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Core server has stopped including the CapabilityControl.Factory on every CurrentUser instance. It is no longer necessary to receive this in the constructor for the base class. Change-Id: Icd78338d484f57805ec59ea0f3e0770a1e948e4b
* | | Switch PushOne to VisibleRefFilter.FactoryShawn Pearce2017-06-141-29/+4
| | | | | | | | | | | | | | | | | | | | | The core server is now creating VisibleRefFilter with an assisted injection factory, reducing the arguments provided by callers. Change-Id: I5f230604b37c675b4751984c7af26d4701d6f8c4
* | | Remove 'final' from function signaturesHan-Wen Nienhuys2017-06-135-11/+11
| | | | | | | | | | | | Change-Id: I98f1ef7d4622bd0394437355e5f6d896d035d0a8
* | | Stop referring to WorkQueue.ExecutorHan-Wen Nienhuys2017-06-131-1/+2
| | | | | | | | | | | | Change-Id: Ic4b4003a78205f4e34d656f5462a529e536f0b5a
* | | Merge "Stop using WorkQueue#unregisterWorkQueue."Dave Borowitz2017-06-121-1/+0
|\ \ \
| * | | Stop using WorkQueue#unregisterWorkQueue.Han-Wen Nienhuys2017-06-121-1/+0
| | | | | | | | | | | | | | | | Change-Id: I7832acee3d901457330d240200212bef04da32ac
* | | | PushOne: Remove redundant string concatenationDavid Pursehouse2017-05-191-1/+1
|/ / / | | | | | | | | | Change-Id: Idfe060d260eb0343d0766f4c6d6cea6cfbf733bb
* | | Add support for direct replication to another Gerrit instanceDariusz Luksza2017-04-285-27/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when replicating to another Gerrit instance replication plugin requires also system SSH access in order to create, delete and update HEAD reference of replicated project. For those three operations plugin will execute system commands over SSH. When other site of replication is also a Gerrit server we can use its SSH API to perform operations mentioned above. Then we drop dependency on system SSH access. In order to set up a SSH connection between two Gerrit instances, one must generate ssh-key-pair with empty passphrase. Then this key-pair can be set to be used for connecting to explicitly configured destination host. TEST PLAN: To test this patch it is recommended to generate new ssh-key-pair and configure the ssh client like follows: * ssh-keygen -f ~/.ssh/empty-passphrase * echo "Host localhost\n\tPort 29419\n\tIdentityFile ~/.ssh/empty-passphrase" >> ~/.ssh/config Then set up a second Gerrit instance (set up sshd to listen on port 29419) which will be the replication destination and create replication user with public ssh-key from ~/.ssh/empty-passphrase.pub. On the replication master server etc/replication.config needs to be adjusted as well: [remote "other-gerrit"] url = ssh://$replication_user@localhost:29419/${name}.git adminUrl = gerrit+ssh://$replication_user@localhost:29419/ After starting both instances creating a project in the master will result in the same project created on the replication destination. Of course Gerrit access rights still apply, therefore $replication_user should have create project capability and push rights. Change-Id: I677f7bd1164be259916c8cebdd4ddeee469402a3 Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
* | | Extract ssh related code into SshHelper classDariusz Luksza2017-04-282-68/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move ssh related code out from ReplicationQueue into separate class SshHelper. Later on the same code could be used to interact with other git server that does not support shell access, but allow to execute build in commands (like eg. Gerrit does). Change-Id: I07c142a58571f71bf8765d956c6050b36d2e44fc
* | | Add notify replication failed for TRANSPORT_ERROR & REPOSITORY_MISSINGEryk Szymanski2017-04-281-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We send replication started notification for each attempt to push. If the push fails with a reason TRANSPORT_ERROR or REPOSITORY_MISSING, it will be retried until it succeed (endless loop in case TRANSPORT_ERROR that occurs forever). For each new re-try we will send another replication started notification for that branch, but we will miss the notification about failed attempt completed. This patch adds the missing notification. This fixes notification on push to replica that is down. Change-Id: I6d5d06fbc081df2d9a32973af73f6a2136d51731 Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
* | | Merge branch 'stable-2.14'Hugo Arès2017-04-281-1/+1
|\| | | | | | | | | | | | | | | | | | | | * stable-2.14: Fix replication retries when maxRetries is set to 0 Change-Id: I3d2986f1707bf1b60675ea28fe3dbcc8dfb04681
| * | Fix replication retries when maxRetries is set to 0v2.14.1Hugo Arès2017-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | maxRetries defaults to 0 which means retry indefinitely but it was not retrying. Change-Id: I6c8d8d6b1511d67b647f25193dcfe860687eea76
* | | Convert ProjectControl visibility checks to PermissionBackendShawn Pearce2017-04-223-10/+48
| | | | | | | | | | | | | | | | | | | | | | | | Gerrit core is hiding methods on ProjectControl to transition to PermissionBackend. Replace use of isReadable and allRefsAreVisible, checking ACCESS and READ permission instead. Change-Id: Ib426d14d6a535cbe2ebcfba456bc2cc094311ed7
* | | Add --now switch to start replication right awayMartin Fick2017-03-286-8/+30
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When starting replication from the command line, each replication task is scheduled with the per remote replicationDelay. This delay is considered a batching mechanism for user driven events. However, scripts may desire to trigger replication without caring about batching. In particular, a script may want to replicate a bunch of updates to many projects serially for throttling reasons using the --wait option. However, with a long list of projects to replicate the per project replication delay can quickly add up to a lot of wasted time (too much throttling). By adding a --now option which starts replicating without delay, it is possible for a script to control (generally along with the --wait option) replication throttling very accurately. Change-Id: I35b4386f53112ffa7c886ad345e5fabb97273aa9
* | Remove ops from pending when max retries reachedv2.14-rc1v2.14-rc0v2.14Luca Milanesio2017-03-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | When a push operation is not retried anymore, remove it from the pending queue as well and log the error on replication.log. Failing to do so, it would result in the destination to refrain from retrying again at then next Gerrit event. Change-Id: I1f3dd4011e2822a2e0b52037fcb130e820af156f Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
* | Set max retries to avoid queue congestionLuca Milanesio2017-03-184-4/+45
| | | | | | | | | | | | | | | | | | | | | | | | When servers have *a lot* of remote slaves, some of them unstable and potentially offline, a maximum retry policy is needed to prevent push events to stay in the replication queue and getting rescheduled forever. Keep backward-compatible configuration by setting maxRetry by default to zero, which means disabled. Change-Id: I060cc7bc3a4d1089b0815db02d2e1430f83a2015
* | Merge "Format all Java files with google-java-format"David Pursehouse2017-02-0733-674/+613
|\ \
| * | Format all Java files with google-java-formatDavid Pursehouse2017-02-0733-674/+613
| | | | | | | | | | | | Change-Id: I7884ab98ed1d2baa1776b2bb032ce338e8f88bc9
* | | Merge branch 'stable-2.13'David Pursehouse2017-02-031-3/+3
|\ \ \ | |/ / |/| / | |/ | | | | | | * stable-2.13: ReplicationMetrics: Make members private final Change-Id: Icf7dd3f5c9dd518c8984546aba9708525a428f79
| * ReplicationMetrics: Make members private finalv2.13.9v2.13.8v2.13.7v2.13.6David Pursehouse2017-02-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | These members should only be accessed through the public methods: - start(...), to create/start a new timer context - record(...), to record the retry/delay values Mark the members as private final to prevent unintended access. Change-Id: I69a7e3b13ba4c344f3176528306163ebef07653c
* | Remove Buck based buildDavid Ostrovsky2017-01-242-38/+0
| | | | | | | | Change-Id: I8d083b35dd00a27644c0415655ae87a24325e376
* | Prefer subtypes of MultimapDave Borowitz2017-01-131-4/+4
| | | | | | | | Change-Id: I071208a8106205402f63f8998ce1a02858067447
* | Bazel: Reformat BUILD file with buildifierDavid Pursehouse2016-12-071-34/+36
| | | | | | | | Change-Id: Idf31346cdba78e897ff8d6427a2b929eb890c7fe
* | Remove test prefix from test methods in replication pluginPatrick Hiesel2016-12-062-4/+4
| | | | | | | | | | | | | | We previously used 'test' to prefix tests but have decided to stop this. This change removes the prefix from all test code. Change-Id: I42e6191ece7872f4647e425e3ca0acf8c6452412