questions with replicate All-Project.git

989 views
Skip to first unread message

ying...@gmail.com

unread,
May 15, 2015, 5:41:05 AM5/15/15
to repo-d...@googlegroups.com, sy99...@hotmail.com
Hi experts,

Two questions with replicate All-Project.git.

precondition:
two gerrit v2.11 with new created mysql database are installed into different pc.
Install replication plugin v2.11

1.failed to replicate meta/config for All-Projects.git according to replication.config as below.

[remote "mirror"]
  url = gerrit2@target_server:/home/gerrit2/review_site/git/${name}.git
  push = +refs/heads/*:refs/heads/*
  push = +refs/tags/*:refs/tags/*

replication.log as below:

[2015-05-14 12:15:08,941] [be4407c7] Replication to gerrit2@target_server:/home/gerrit2/review_site-t/git/All-Projects.git started...
[2015-05-14 12:15:11,399] [be4407c7] Push to gerrit2@target_server:/home/gerrit2/review_site-t/git/All-Projects.git references: [RemoteRefUpdate[remoteName=refs/meta/config, NOT_ATTEMPTED, (null)...38f9c564fe6a0ef1cdb5f2880b301c9ba2e65555, srcRef=refs/meta/config, message=null]]
[2015-05-14 12:15:11,992] [be4407c7] Failed replicate of refs/meta/config to gerrit2@target_server:/home/gerrit2/review_site-t/git/All-Projects.git: status REJECTED_NONFASTFORWARD

more info is that i'm one gerrit administrator and i use my account to reload replication.


2. if i modify replication.config as below. Then i reload replication, this time, meta/config to All-Projects.git can replicate, but meta/config for All-Projects.git is messed after this replication, because at least i found that i lost adminstrator prilvege even though i'm in administrator group. I only can fix it by reinstall new Gerrit. This is really strange.

[remote "mirror"]
  url = gerrit2@target_server:/home/gerrit2/review_site/git/${name}.git
  push = +refs/heads/*:refs/heads/*
  push = +refs/tags/*:refs/tags/*
[gerrit]
        defaultForceUpdate = true

Could you please help?

 

Edwin Kempin

unread,
May 19, 2015, 5:16:35 AM5/19/15
to ying...@gmail.com, Repo and Gerrit Discussion, sy99...@hotmail.com
2015-05-14 10:58 GMT+02:00 <ying...@gmail.com>:
Hi experts,

Two questions with replicate All-Project.git.

precondition:
two gerrit v2.11 with new created mysql database are installed into different pc.
The replication plugin cannot be used to replicate between two master Gerrit servers.
Multi-master is not supported yet.
 

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ying...@gmail.com

unread,
May 19, 2015, 10:05:14 PM5/19/15
to repo-d...@googlegroups.com, sy99...@hotmail.com, ying...@gmail.com
Got it. I'm sorry I didn't describe my issue clearly.

My questions is about "replicate All-Project.git from host to slave" instead of mult-masters. I want to emphasize that both host and slave are newly installed with Gerrit v2.11 plus mysql  on ubuntu OS. Then these two issues are easily reproduced. Could you please help?

在 2015年5月19日星期二 UTC+8下午5:16:35,Edwin Kempin写道:

Doug Kelly

unread,
May 19, 2015, 11:29:30 PM5/19/15
to repo-d...@googlegroups.com, sy99...@hotmail.com
It should work.  What I've noticed is when you set up the mirror site, obviously All-Projects is initialized, but at a different commit than the master, which is why you get the non-fast-forward error.  What I normally do to correct this is log into the master server, then force push the All-Projects project to the mirror, and let everything else follow normally (after the initial push, it should stay in sync).  Note that in 2.10+, you may also have the All-Users repository to follow the same basic procedure with.

--Doug

ying...@gmail.com

unread,
May 20, 2015, 12:17:55 AM5/20/15
to repo-d...@googlegroups.com, sy99...@hotmail.com
Thanks for your quick response and all necessary info.

I tried with force push and now I finally understand why force push All-Projects to mirror cause that I lost administrator privilege because the group's uuid is changed compared to mysql db's record.

I still have some questions about replications.
1. By default, replication plugin only replicate the projects who has newly changes instead of replicate all projects inside this gerrit server, right?
2. Seems that replication only push the originally created project in host to mirror. Is it true? Because if I copy a mirror git project from outside to host, then run replication and replication.log always said "Missing repository could not be created when replicating gerrit2@xxx:/home/gerrit2/review_site/git/*.git. You can only create missing repositories locally, over SSH or when using adminUrl in replication.config. See documentation for more information"
3. about Cache setting inside gerrit.config. Not sure if it is related with replication plugin.


在 2015年5月20日星期三 UTC+8上午11:29:30,Doug Kelly写道:

Edwin Kempin

unread,
May 20, 2015, 7:44:34 AM5/20/15
to ying...@gmail.com, Repo and Gerrit Discussion, sy99...@hotmail.com
2015-05-20 6:17 GMT+02:00 <ying...@gmail.com>:
Thanks for your quick response and all necessary info.

I tried with force push and now I finally understand why force push All-Projects to mirror cause that I lost administrator privilege because the group's uuid is changed compared to mysql db's record.

I still have some questions about replications.
1. By default, replication plugin only replicate the projects who has newly changes instead of replicate all projects inside this gerrit server, right?
Yes, but you may trigger the replication of all projects via SSH using --all option [1].

[1] https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation/cmd-start.md
 
2. Seems that replication only push the originally created project in host to mirror. Is it true? Because if I copy a mirror git project from outside to host, then run replication and replication.log always said "Missing repository could not be created when replicating gerrit2@xxx:/home/gerrit2/review_site/git/*.git. You can only create missing repositories locally, over SSH or when using adminUrl in replication.config. See documentation for more information"
Check the 'remote.NAME.createMissingRepositories' parameter in replication.config [2].

[2] https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation/config.md
 
3. about Cache setting inside gerrit.config. Not sure if it is related with replication plugin.
Cache settings shouldn't have an effect on replication.

Doug Kelly

unread,
May 20, 2015, 8:23:46 AM5/20/15
to repo-d...@googlegroups.com, sy99...@hotmail.com, ying...@gmail.com


On Wednesday, May 20, 2015 at 6:44:34 AM UTC-5, Edwin Kempin wrote:


2015-05-20 6:17 GMT+02:00 <ying...@gmail.com>:
Thanks for your quick response and all necessary info.

I tried with force push and now I finally understand why force push All-Projects to mirror cause that I lost administrator privilege because the group's uuid is changed compared to mysql db's record.

I still have some questions about replications.
1. By default, replication plugin only replicate the projects who has newly changes instead of replicate all projects inside this gerrit server, right?
Yes, but you may trigger the replication of all projects via SSH using --all option [1].

[1] https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation/cmd-start.md
 
2. Seems that replication only push the originally created project in host to mirror. Is it true? Because if I copy a mirror git project from outside to host, then run replication and replication.log always said "Missing repository could not be created when replicating gerrit2@xxx:/home/gerrit2/review_site/git/*.git. You can only create missing repositories locally, over SSH or when using adminUrl in replication.config. See documentation for more information"
Check the 'remote.NAME.createMissingRepositories' parameter in replication.config [2].

[2] https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation/config.md
 
I think you can also set gerrit.defaultForceUpdate to avoid the original problem.  But, this error would sound like you're using Git to replicate?  As the error says, if you set remote.NAME.adminUrl, it will log in over SSH to create the missing repository if it doesn't exist.
 
3. about Cache setting inside gerrit.config. Not sure if it is related with replication plugin.
Cache settings shouldn't have an effect on replication.
 
Agreed.  You *may* need to tune caches in your mirror slightly, as there's currently no way for the master to expire any caches on the mirror when data changes.  I think we set things to a 5 minute timeout, and that works okay. 

ying...@gmail.com

unread,
May 21, 2015, 1:59:18 AM5/21/15
to repo-d...@googlegroups.com, sy99...@hotmail.com, ying...@gmail.com


在 2015年5月20日星期三 UTC+8下午8:23:46,Doug Kelly写道:


On Wednesday, May 20, 2015 at 6:44:34 AM UTC-5, Edwin Kempin wrote:


2015-05-20 6:17 GMT+02:00 <ying...@gmail.com>:
Thanks for your quick response and all necessary info.

I tried with force push and now I finally understand why force push All-Projects to mirror cause that I lost administrator privilege because the group's uuid is changed compared to mysql db's record.

I still have some questions about replications.
1. By default, replication plugin only replicate the projects who has newly changes instead of replicate all projects inside this gerrit server, right?
Yes, but you may trigger the replication of all projects via SSH using --all option [1].

[1] https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation/cmd-start.md
     
        I'm clear on this. Thanks.
 
2. Seems that replication only push the originally created project in host to mirror. Is it true? Because if I copy a mirror git project from outside to host, then run replication and replication.log always said "Missing repository could not be created when replicating gerrit2@xxx:/home/gerrit2/review_site/git/*.git. You can only create missing repositories locally, over SSH or when using adminUrl in replication.config. See documentation for more information"
Check the 'remote.NAME.createMissingRepositories' parameter in replication.config [2].

[2] https://gerrit.googlesource.com/plugins/replication/+/refs/heads/master/src/main/resources/Documentation/config.md
 
I think you can also set gerrit.defaultForceUpdate to avoid the original problem.  But, this error would sound like you're using Git to replicate?  As the error says, if you set remote.NAME.adminUrl, it will log in over SSH to create the missing repository if it doesn't exist.

  Not works with my case with these methods.

  Here is my replication.config: 
  [remote "mirror"]
  url = gerrit2@target:/home/daniel/review_site/git/${name}.git

  push = +refs/heads/*:refs/heads/*
  push = +refs/tags/*:refs/tags/*
  adminUrl = ssh://gerrit2@target/home/daniel/review_site/git/${name}.git
  
   I got the same issue with before:  "[99e35af3] Missing repository could not be created when replicating gerrit2@target:/home/gerrit2/review_site/git/customizationweb.git. You can only create missing repositories locally, over SSH or when using adminUrl in replication.config. See documentation for more information."
   after replication, I can see customizationweb.git directory newly created in mirror but it only had error "fatal: bad default revision 'HEAD'" when i run "git log" for this customizationweb.git. And  customizationweb.git in mirror can't be used by user (for example, git clone).
   by the way, the same issue even though enable remote.NAME.createMissingRepositories in replication.config or set gerrit.defaultForceUpdate.

 
3. about Cache setting inside gerrit.config. Not sure if it is related with replication plugin.
Cache settings shouldn't have an effect on replication.
 
Agreed.  You *may* need to tune caches in your mirror slightly, as there's currently no way for the master to expire any caches on the mirror when data changes.  I think we set things to a 5 minute timeout, and that works okay. 

Thanks for your suggestion. .Could you please help to give more explanation about what will be record when cache setting enabled? If there is difference between host and mirror? 

Björn Pedersen

unread,
May 21, 2015, 3:49:14 AM5/21/15
to repo-d...@googlegroups.com, sy99...@hotmail.com
Hi,


Am Mittwoch, 20. Mai 2015 06:17:55 UTC+2 schrieb ying...@gmail.com:
2. Seems that replication only push the originally created project in host to mirror. Is it true? Because if I copy a mirror git project from outside to host, then run replication and replication.log always said "Missing repository could not be created when replicating gerrit2@xxx:/home/gerrit2/review_site/git/*.git. You can only create missing repositories locally, over SSH or when using adminUrl in replication.config. See documentation for more information"


 Yes, automatic project creation in a slave gerrit is not really implemented it seem.

See replication does the following for new project creation (on remote machines):
ssh to machine
  • mkdir -p " + quotedPath
  • + " && cd " + quotedPath
  • + " && git init --bare";


So it will only create the bare repos. To replicate there normally only ssh will work, unless a git dameon or gerrit is configured manually.

To do a full export you maybe should take a look at the importer plugin for 2.11+

Björn

Björn Pedersen

unread,
May 21, 2015, 7:08:20 AM5/21/15
to repo-d...@googlegroups.com, sy99...@hotmail.com
See https://gerrit-review.googlesource.com/#/c/65842/  as well.

Am Donnerstag, 21. Mai 2015 09:49:14 UTC+2 schrieb Björn Pedersen:
Hi,
Reply all
Reply to author
Forward
0 new messages