Update git submodules
* Update plugins/replication from branch 'master'
to 3ce09db0cae09038f2924f1ff8f097e6c91c7a1e
- Implement AdminApi using Gerrit's REST API
When a remote site is a Gerrit server, we can use its REST API to
perform admin operations: create missing projects, delete project,
update project's head.
Admin operations, when a remote site is a Gerrit server, were already
supported over SSH protocol. This change implements AdminApi using
Gerrit's REST API. This is useful when replicating to a remote Gerrit
server which doesn't run the SSH daemon.
Change-Id: I1fdb8f60b551651e3c4c402e021390a27d678896
- Execute all admin operations from the replication queue thread pool
Before this change, the delete-project and update-head operations were
executed from the calling Gerrit core thread while the create-project
was executed in the context of the PushOne operation which is run from
the replication queue.
Tasks executed from the replication queue are created from an additional
child injector which provides more bindings, among others the
RemoteConfig. Having access to RemoteConfig from an admin task may be
necessary in order to retrieve HTTP credentials, like the PushOne task
does. This will be necessary when we implement admin operations over
the HTTP/REST protocol.
Change-Id: Iae608aa98474d6405b26bbae2508183c2d0cb212
- Create missing repository only at the remote we are pushing to
When replication of a ref failed due to missing remote repository at one
remote site, we then initiated creation of the missing repository on all
remotes where this repository is replicated. The creation of the missing
repository is considered to be success if it succeeded for all remotes
and only in this case the ref replication was rescheduled. This logic
could cause a ref replication to not be rescheduled when creation of a
missing repository fails in a remote which is unrelated to the current
push operation. For example, if we replicate to two remote sites:
[remote "foo"]
url = https://foo.org/...
adminUrl = ssh://gerrit@foo.org/...
[remote "bar"]
url = https://bar.org/...
adminUrl = ssh://gerrit@bar.org/...
and if during a push to "foo" we find that the repository is missing
then we will try to create it on both "foo" and "bar". It could happen
that the creation of the missing repository succeeds on "foo" and then
fails on "bar" because "bar" is unreachable or down at that moment.
In this case the replication to "foo" will not be rescheduled but it
should be as we successfully created the missing repository in "foo".
Create missing repository only under the (admin) URL in the same remote.
Note that there will be one ref replication task for each remote which
ensures that the missing repository will be created in all remotes.
Change-Id: Idbc3f614df53bb3aabcc4cf6cb0d6540e7000e29
- Remove the NewProjectCreatedListener implementation
Initial version of this plugin implemented the NewProjectCreatedListener
in order to create missing repositories in the replication targets. This
was the only way how replication plugin created missing repositories.
Since I4e587cdfca09445c9b1c528b2f1edae0944aec68, if during the
replication of a ref it is found that the repository missing on the
remote site it will be automatically created. This means, that since
that change there are two ways a repository is created on the remote
site:
1: from the NewProjectCreatedListener.onNewProjectCreated
2: during ref replication when the repository is missing
There are two major differences in how cases 1 and 2 are invoked. In the
case 1 the remote repository creation is performed from the calling
thread, which means from the Gerrit core thread which invokes
NewProjectCreatedListener(s). In the case 2, the creation of the remote
repository is done from the replication queue thread which was
processing the ref replication. Note that replication tasks are created
with an additional child injector [1] which provides additional bindings
available for injection into the classes implementing the replication
and repository creation. These binding are, however, not available when
the repository creation is processed from the Gerrit core thread
invoking NewProjectCreatedListener(s).
Removing the NewProjectCreatedListener implementation removes this
asymmetry and makes sure that all replication relevant steps, including
repository creation, are processed from replication queue threads.
[1] https://gerrit.googlesource.com/plugins/replication/+/871da5aa023bdfd03a3b943f7f6b82c7e0f16341/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java#189
Change-Id: I32e7aa632ffe0e94eb525f7f2c007fbb88569004
- Consistently handle remote repository creation failures
Failure to create remote repository was handled inconsistently in the
three existing AdminApi implementations. This issue was present in the
code even before the refactoring done in
Ie760bf3e143b1d143b6e81ac6cfa816ef1f8d016. For example, creation of
remote repository over SSH [1] didn't return a status back to the
caller, while the Gerrit+SSH implementation [2] did return a boolean
flag which was afterwards ignored by the caller [3].
Not handling remote repository creation failures had an ugly effect:
we log the "Missing repository created; ..." [4], even if the repository
creation failed.
Let all three implementations of the AdminApi return a flag indicating
the success/failure and make sure to handle it properly.
Further, remove some redundant and potentially confusing parts of the
log messages as they assume that failure to create missing repository
can only be caused by using wrong protocol.
[1] https://gerrit.googlesource.com/plugins/replication/+/d557ccc642c59a55750f560ce0d98870e1550d65/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java#290
[2] https://gerrit.googlesource.com/plugins/replication/+/d557ccc642c59a55750f560ce0d98870e1550d65/src/main/java/com/googlesource/gerrit/plugins/replication/GerritSshApi.java#43
[3] https://gerrit.googlesource.com/plugins/replication/+/d557ccc642c59a55750f560ce0d98870e1550d65/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationQueue.java#259
[4] https://gerrit.googlesource.com/plugins/replication/+/092792edacf9c29732a560a30967b92664cd65f9/src/main/java/com/googlesource/gerrit/plugins/replication/PushOne.java#400
Change-Id: I6566f867138ab73c81ff7a67630772c3734e501b
- Fix creation of missing repository when replicating to a Gerrit server
When replicating to a Gerrit server over http, non-existence of a
repository is reported as:
<repo-name> unavailable
This message wasn't among expected messages and creation of the missing
repository wasn't executed.
Change-Id: I3d6c3e14573b638b17d54d1777a606b8f356f1f9
diff --git a/plugins/replication b/plugins/replication
index bc5efb5..3ce09db 160000
--- a/plugins/replication
+++ b/plugins/replication
@@ -1 +1 @@
-Subproject commit bc5efb5b60a5a93c25c075f3667841e02532a99c
+Subproject commit 3ce09db0cae09038f2924f1ff8f097e6c91c7a1e