Re: [JGIT PATCH 0/4] RepositoryTestCase cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux