All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org, fonseca@diku.dk
Subject: Re: [JGIT PATCH 0/4] RepositoryTestCase cleanups
Date: Thu, 27 Nov 2008 13:49:16 -0800	[thread overview]
Message-ID: <20081127214916.GD23984@spearce.org> (raw)
In-Reply-To: <1227820410-9621-1-git-send-email-robin.rosenberg@dewire.com>

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> Ok, so here is an attempt to improve the ability of the JGit's unit
> tests to delete temporary repositories. This has probably been seen
> by many, but Jonas Fonseca raised the issue.

Hmpph.  This takes 19 seconds to run the suite, where it used to be
only 2 seconds on the same system.  The slower run isn't something
I'm too happy about, actually I'd like to make the run even faster
than 2 seconds.
 
> The background is that on Windows you cannot delete files that are
> open and mmapped files are open until they get unmapped, which in
> Java is beyond explicit programmer control. You can only free the
> resources and pray that the GC does the work. Fortunately it usually
> does. It turned out our testcases weren't even trying to clean up
> properly. 

If the issue is mmap'd files, why don't we instead disable mmap
on Windows during JUnit tests, and use the non-mmap variant of
pack access?  At least do that for the bulk of the tests, and
then have a single test case which tests the mmap code path but
has careful System.gc calls in place to try and ensure we can
actually clean up the temporary files.

Another option is to refactor the Repository class a little so we
can replace local filesystem IO with something else, like say an
in-core repository.  E.g. a pack file and/or pack index stored in
a byte[], and refs stored in a HashMap.  We'd still need a couple
of tests to verify local disk IO, but many of the tests can be
validated against such a pure in-memory Repository concept.

I'd actually like to get that Repository refactoring done soon,
someone else was asking about it for the RefDatabase (to store the
refs in a SQL database so JGit ties into JTA) but I may also want
it for Gerrit 2 - I'm looking at doing something that would put
200,000 refs per year into a repository.  That's so large that
most operations can't afford to scan the entire ref database,
and it really cannot be loose.  ;-)


Refactoring repository is a fair chunk of work, disabling the mmap
feature under Windows in JUnit may be easier.  Hmm, according to
WindowCache's <clinit> its default by false.  Why is it enabling
on Windows?  The only code that calls WindowCache.reconfigure()
is in the Eclipse plugin, so pure JGit unit tests shouldn't be
turning on mmap code *at all*.

Which also points out a gap in our tests.  Nothing new, we have
lots of gaps.  *sigh*

-- 
Shawn.

  reply	other threads:[~2008-11-27 21:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27 21:13 [JGIT PATCH 0/4] RepositoryTestCase cleanups Robin Rosenberg
2008-11-27 21:49 ` Shawn O. Pearce [this message]
2008-11-29 12:01   ` Robin Rosenberg
2008-12-01 23:18     ` Johannes Schindelin
2008-11-30 14:18   ` Robin Rosenberg
2008-11-30 23:40   ` [JGIT PATCH v2 0/8] Unit test cleanups Robin Rosenberg
2008-11-30 23:40     ` [JGIT PATCH 1/8] Drop unneeded code in unit tests Robin Rosenberg
2008-11-30 23:40       ` [JGIT PATCH 2/8] Cleanup malformed test cases Robin Rosenberg
2008-11-30 23:40         ` [JGIT PATCH 3/8] Turn off memory mapping in JGit unit tests by default Robin Rosenberg
2008-11-30 23:40           ` [JGIT PATCH 4/8] Add a counter to make sure the test repo name is unique Robin Rosenberg
2008-11-30 23:40             ` [JGIT PATCH 5/8] Make the cleanup less verbose when it fails to delete temporary stuff Robin Rosenberg
2008-11-30 23:40               ` [JGIT PATCH 6/8] Cleanup after each test Robin Rosenberg
2008-11-30 23:40                 ` [JGIT PATCH 7/8] Close files opened by unit testing framework Robin Rosenberg
2008-11-30 23:40                   ` [JGIT PATCH 8/8] Hard failure on unit test cleanups if they fail Robin Rosenberg
2008-12-02 16:38     ` [JGIT PATCH v2 0/8] Unit test cleanups Shawn O. Pearce
  -- strict thread matches above, loose matches on Subject: below --
2008-11-27 21:15 [JGIT PATCH 0/4] RepositoryTestCase cleanups Robin Rosenberg

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081127214916.GD23984@spearce.org \
    --to=spearce@spearce.org \
    --cc=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.