Unable to replicate NONFASTFORWARD commits (Replication Plugin)

707 views
Skip to first unread message

nicholas...@gmail.com

unread,
Jan 30, 2015, 9:28:16 AM1/30/15
to repo-d...@googlegroups.com, nsto...@cisco.com
We are getting this error during our replication process:

[2015-01-29 16:46:05,477] ERROR com.googlesource.gerrit.plugins.replication.ReplicationQueue : Failed replicate of refs/tags/V2_3_4 to gerrit2@backup-host:/git/backup-host/path/to/repo.git: status REJECTED_NONFASTFORWARD

It looks to me like the replication plugin is unable to sync repositories with non-fastforwarded commits. The plugin would need to run a "git push --force" to accomplish this. I looked at the code, and to my untrained java eyes I did not see the setForce(true) method call needed to enable this behavior:
http://download.eclipse.org/jgit/site/3.6.2.201501210735-r/apidocs/org/eclipse/jgit/api/PushCommand.html#setForce(boolean)

I did not see any configurable value for this either. Should this be enabled by default or be a configurable option?

Versions
Gerrit: 2.9
Replication Plugin: 2.9

Thanks,
Nick

Hugo Arès

unread,
Jan 30, 2015, 10:04:20 AM1/30/15
to repo-d...@googlegroups.com, nsto...@cisco.com
Hi,

Replication plugin was using force push by default before but that changed in 2.9.

Add this to the replication.config:

[gerrit]
        defaultForceUpdate = true


Hugo

nicholas...@gmail.com

unread,
Jan 30, 2015, 10:26:50 AM1/30/15
to repo-d...@googlegroups.com, nsto...@cisco.com
Thanks for the quick response Hugo!

Maybe I am missing the official documentation for this plugin somewhere:

Link not present concerning replication: https://gerrit-documentation.storage.googleapis.com/Documentation/2.9/index.html
This documentation does not mention this config setting: https://gerrit.libreoffice.org/plugins/replication/Documentation/config.html
This documentation does mention this config setting: https://review.typo3.org/plugins/replication/Documentation/config.html

Hugo Arès

unread,
Jan 30, 2015, 10:36:49 AM1/30/15
to repo-d...@googlegroups.com, nsto...@cisco.com
The best way to find the proper documentation is to get it on the server where you deployed the replication plugin to make sure you are reading the documentation that correspond to the plugin version you are using:

https://<your.server>/plugins/replication/Documentation/index.html

LibreOffice is using 2.8.6.1 so this is why the documentation does not mention that parameter, it did not exist in 2.8.

Hugo

nicholas...@gmail.com

unread,
Jan 30, 2015, 10:48:29 AM1/30/15
to repo-d...@googlegroups.com, nsto...@cisco.com
Much appreciated!

Jared Oberhaus

unread,
May 27, 2015, 2:11:31 PM5/27/15
to repo-d...@googlegroups.com, nsto...@cisco.com
Hi all,

It seems to me that sometimes you don't want to git push --force, but instead you want the Gerrit replication plugin to do a "git pull" and bring in the changes. I think you'd want to do this carefully, and only when really necessary. You want to do this when someone makes legitimate changes directly in the remote repo (even though they should have been made in Gerrit).

How can this be accomplished? Should I checkout the remote repo and push to the gerrit repo? What would the command-line syntax look like?

Jared Oberhaus

unread,
May 27, 2015, 3:52:39 PM5/27/15
to repo-d...@googlegroups.com, nsto...@cisco.com
OK, I think I figured it out.

Basically what I did is:
  • git clone from Github repo
  • git pull to be up-to-date, and make sure there aren't any local commits that aren't pushed.
  • git push ssh://user@gerritbox:29418/Organization/Repository master
  • ssh -p 29418 gerritbox replication start --wait Organization/Repository
That seems to work.
Reply all
Reply to author
Forward
0 new messages