From: Ramkumar Ramachandra <artagnon@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] gc: reject if another gc is running, unless --force is given
Date: Sat, 3 Aug 2013 13:22:25 +0530 [thread overview]
Message-ID: <CALkWK0k1vf_WE=pV5XTMAM6Ax6rL3sXu4qx_eyYwvWGsZjXgmA@mail.gmail.com> (raw)
In-Reply-To: <1375510890-4728-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy wrote:
> This may happen when `git gc --auto` is run automatically, then the
> user, to avoid wait time, switches to a new terminal, keeps working
> and `git gc --auto` is started again because the first gc instance has
> not clean up the repository.
>
> This patch tries to avoid multiple gc running, especially in --auto
> mode. In the worst case, gc may be delayed 12 hours if a daemon reuses
> the pid stored in gc-%s.pid.
Definitely looks like a good solution. Thanks for this.
I'm currently on vacation, so can't apply and test: sorry.
> + if (!force &&
> + (fp = fopen(git_path("gc-%s.pid", utsname.nodename), "r")) != NULL &&
> + !fstat(fileno(fp), &st) &&
It's open for a very short period of time, so lockfile (which we'd
normally use) would probably be an overkill.
> + time(NULL) - st.st_mtime <= 12 * 3600) {
Quick question: is this kind of file-lifetime used anywhere else in git.git?
> + if (auto_gc)
> + return 0; /* be quiet on --auto */
> + die(_("gc is already running"));
Nice.
next prev parent reply other threads:[~2013-08-03 7:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-03 4:20 [PATCH] gc: reject if another gc is running, unless --force is given Nguyễn Thái Ngọc Duy
2013-08-03 6:21 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2013-08-03 7:52 ` Ramkumar Ramachandra [this message]
2013-08-03 10:01 ` Duy Nguyen
2013-08-03 9:49 ` Johannes Sixt
2013-08-03 10:01 ` Duy Nguyen
2013-08-03 10:40 ` Johannes Sixt
2013-08-05 14:19 ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2013-08-05 18:17 ` Junio C Hamano
2013-08-05 18:37 ` Ramkumar Ramachandra
2013-08-06 6:43 ` Junio C Hamano
2013-08-06 6:45 ` Ramkumar Ramachandra
2013-08-08 11:05 ` [PATCH v4] " Nguyễn Thái Ngọc Duy
2013-08-08 18:12 ` Junio C Hamano
2013-08-09 12:52 ` Duy Nguyen
2013-08-09 16:00 ` Junio C Hamano
2013-08-09 16:29 ` Andres Perera
2013-08-09 17:41 ` Junio C Hamano
2013-08-10 0:45 ` Duy Nguyen
2013-08-10 7:11 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALkWK0k1vf_WE=pV5XTMAM6Ax6rL3sXu4qx_eyYwvWGsZjXgmA@mail.gmail.com' \
--to=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).