Is running 'git gc' regularly still recommended if 'gerrit gc' is used?

1,804 views
Skip to first unread message

Jyrki Puttonen

unread,
Jun 24, 2013, 11:20:01 PM6/24/13
to repo-d...@googlegroups.com
Hi

Wiki page about scaling [1] says following in section called Git GC:

    Running GC regularly is important, jgit does not have built in gc so unlike a regular git repo it will not auto run every now and then. Setting up a crontab is probably a good idea.

Is this valid when 'gerrit gc' [2] is used?


[1] http://code.google.com/p/gerrit/wiki/Scaling
[2] http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/cmd-gc.html

Edwin Kempin

unread,
Jun 25, 2013, 1:54:47 AM6/25/13
to Jyrki Puttonen, repo-d...@googlegroups.com
Yes, you should use 'gerrit gc' to do the garbage collection.
Running 'gerrit gc' also creates bitmaps for better clone and fetch performance.
However you still need a cronjob to run 'gerrit gc', AFAIK jgit still doesn't run gc automatically.

2013/6/25 Jyrki Puttonen <jyrk...@gmail.com>

--
--
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/groups/opt_out.
 
 

Shawn Pearce

unread,
Jun 25, 2013, 10:23:51 AM6/25/13
to Jyrki Puttonen, repo-discuss
On Mon, Jun 24, 2013 at 9:20 PM, Jyrki Puttonen <jyrk...@gmail.com> wrote:
Hi

Wiki page about scaling [1] says following in section called Git GC:

    Running GC regularly is important, jgit does not have built in gc so unlike a regular git repo it will not auto run every now and then. Setting up a crontab is probably a good idea.

Is this valid when 'gerrit gc' [2] is used?

No. JGit now has gc available, this is what gerrit gc calls. You can use either program to maintain the repositories.

Martin Fick

unread,
Jun 25, 2013, 10:36:25 AM6/25/13
to repo-d...@googlegroups.com, Shawn Pearce, Jyrki Puttonen
Although if you use gerrit gc, you should still run git pack-refs
regularly, gerrit (jgit) gc does not pack refs,

-Martin

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora
Forum, hosted by The Linux Foundation

Saša Živkov

unread,
Jun 25, 2013, 11:22:14 AM6/25/13
to Martin Fick, repo-d...@googlegroups.com, Shawn Pearce, Jyrki Puttonen
On Tue, Jun 25, 2013 at 4:36 PM, Martin Fick <mf...@codeaurora.org> wrote:
On Tuesday, June 25, 2013 07:23:51 am Shawn Pearce wrote:
> On Mon, Jun 24, 2013 at 9:20 PM, Jyrki Puttonen
<jyrk...@gmail.com> wrote:
> > Hi
> >
> > Wiki page about scaling [1] says following in section called
Git GC:
> >     Running GC regularly is important, jgit does not have
built in gc so
> >
> > unlike a regular git repo it will not auto run every now and
then.
> > Setting up a crontab is probably a good idea.
> >
> > Is this valid when 'gerrit gc' [2] is used?
>
> No. JGit now has gc available, this is what gerrit gc calls.
You can use
> either program to maintain the repositories.

Although if you use gerrit gc, you should still run git pack-refs
regularly, gerrit (jgit) gc does not pack refs,
 
Strange. I checked the JGit code and it does call packRefs method from
the gc method.


-Martin

--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora
Forum, hosted by The Linux Foundation

Martin Fick

unread,
Jun 25, 2013, 11:41:51 AM6/25/13
to Saša Živkov, repo-d...@googlegroups.com, Shawn Pearce, Jyrki Puttonen
My bad, I miss understood something,

Ishaaq Chandy

unread,
Jun 30, 2013, 7:26:04 PM6/30/13
to repo-d...@googlegroups.com
Hmmm. I had previously scheduled cron to run a weekly script that called "git gc" on all the projects on the server's local file system, but if "gerrit gc" is the recommended way to do it now, I need to work out how to call it from cron.

My problem is that cron doesn't have the ssh private key required to be able to call "gerrit gc" over ssh. So, is there any way to call it (or something else that does the equivalent) without using ssh?

Thanks,
Ishaaq


Dave Borowitz

unread,
Jun 30, 2013, 7:37:54 PM6/30/13
to Ishaaq Chandy, repo-d...@googlegroups.com
As Shawn mentioned, you can use JGit's gc directly. The easiest thing is probably to download the latest version of jgit.sh from Eclipse[1], which is new enough it should have gc. A more correct thing is probably to get the exact version of JGit used by your Gerrit version (check the top-level pom.xml in the source tree for the version). I don't think we build jgit.sh for each of those releases, so you might have to build it yourself in that case.

Shawn Pearce

unread,
Jun 30, 2013, 7:48:34 PM6/30/13
to Ishaaq Chandy, repo-d...@googlegroups.com
On Sun, Jun 30, 2013 at 4:26 PM, Ishaaq Chandy <ish...@gmail.com> wrote:
> My problem is that cron doesn't have the ssh private key required to be able
> to call "gerrit gc" over ssh. So, is there any way to call it (or something
> else that does the equivalent) without using ssh?

Isn't GC a global capability now?

Create a role account for cron, configure an SSH key that cron does
have access to, put the role account into a group, and grant the group
GC capability?
Reply all
Reply to author
Forward
0 new messages