"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: cache pack index file list when repository is opened
To:
Omar Polo <op@omarpolo.com>
Cc:
Stefan Sperling <stsp@stsp.name>, gameoftrees@openbsd.org
Date:
Mon, 14 Mar 2022 00:24:12 +0100

Download raw body.

Thread
Omar Polo <op@omarpolo.com> wrote:
> Stefan Sperling <stsp@stsp.name> wrote:
> > Profiling shows that many calls to readdir(3) of the objects/pack/
> > directory can cause significant overhead during 'gotadmin pack -a'
> > if the repository has many pack files that need to be searched.
> > 
> > This patch caches the list of known pack index files when the
> > repository is opened. This speeds up searches by skipping readdir(3)
> > if the pack index cache cannot prevent us from hitting the disk.
> > 
> > Pack files are not really expected to appear or disappear out
> > of the blue while the repository is in use, even though this
> > is possible. But even readdir(3) followed open(2) of an entry
> > could suffer from this. If this becomes a problem it was already
> > possible to hit with the old code, and could only be fixed by
> > catching relevant errors and retrying.
> > 
> > ok?
> 
> makes sense and the diff is almost straightforward.

I take back what I said, this broke at least the `send' command.

	% got send
	Connecting to "origin" git@omarpolo.com
	packing 1 reference; 3 objects
	Segmentation fault

without leaving any core file around, and also part of the regress
suite.

(don't have time to debug right now, sorry, it's pretty late, but wanted
to share this.)

excerpt from make regress

==== pack ====
./pack.sh -q -r "/tmp"
Segmentation fault
gotadmin pack failed unexpectedly
test failed; leaving test data in /tmp/got-test-pack_exclude-LZLDHD3x
got: worktree already locked
got: worktree already locked
Segmentation fault
gotadmin pack failed unexpectedly
test failed; leaving test data in /tmp/got-test-pack_loose_only-qIuogCep
Segmentation fault
gotadmin pack failed unexpectedly
test failed; leaving test data in /tmp/got-test-pack_all_objects-e9GbyUTB

==== cleanup ====
./cleanup.sh -q -r "/tmp"
Segmentation fault
unexpected number of loose objects:
test failed; leaving test data in /tmp/got-test-cleanup_redundant_loose_objects-9mA6Nhr3

  ---

% ./pack.sh -r /tmp
test_pack_all_loose_objects ok
test_pack_exclude Segmentation fault
gotadmin pack failed unexpectedly
test failed; leaving test data in /tmp/got-test-pack_exclude-Arbsz4XO
test_pack_include ok
test_pack_ambiguous_arg ok
test_pack_loose_only ok
test_pack_all_objects ok
test_pack_bad_ref ok