Re: [JGIT PATCH 08/10] Scan for new packs if GIT_DIR/objects/pack has been modified

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

 



"Shawn O. Pearce" <spearce@xxxxxxxxxxx> wrote:
> If GIT_DIR/objects/pack directory has changed then one or more packs
...
> +	@Override
> +	protected boolean tryAgain1() {
> +		final PackFile[] old = packList.get();
> +		if (packDirectoryLastModified <= packDirectory.lastModified()) {

Sadly we needed to use <= here to avoid racy-git cases.  Worse,
unlike with the DirCache we don't have another file system inode
we can use to compare timestamps against.

Consequently, I just realized my commit message isn't entirely
accurate.  In reality we rescan the #F*@!*! directory every time
we have a miss, because the time stamp hasn't changed.

I can't think of another method to use here.  I'd love to avoid
the rescan on a miss if the aren't any new packs in the directory,
but I just don't see how we can do that and avoid the racy-git case
at the same time.

We could try to fudge it by saying < here, but the test cases in
9/10 would then require a Thread.sleep(2) or something to force
enough time to pass for the directory modification time to advance.

I think in real applications, its "good enough" to allow this amount
of fudging.  We shouldn't see more than one repack per repository
per FS clock tick.  And if we do, the admin should be shot on sight.

git-repack is careful to ensure the new pack is linked into the
directory before the old packs are unlinked, so we really shouldn't
ever scan and miss a pack.

-- 
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]