<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/libgit2.git/src/pack.c, branch vmg/full-ref-iterator</title>
<subtitle>github.com: libgit2/libgit2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/'/>
<entry>
<title>Switch to index_version as "git_pack_file is ready" flag</title>
<updated>2013-05-02T16:27:02+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2013-05-02T16:06:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=0ddfcb40d5ddf2e6d74f061efcccd944d18460cc'/>
<id>0ddfcb40d5ddf2e6d74f061efcccd944d18460cc</id>
<content type='text'>
We use p-&gt;index_map.data to check whether the struct has been set up
and all the information about the index is stored there. This variable
gets set up halfway through the setup process, however, and a thread
can come along and use fields that haven't been written to yet.

Crucially, pack_entry_find_offset() needs to read the index version
(which is written after index_map) to know the offset and stride
length to pass to sha1_entry_pos(). If these values are wrong,
assertions in it will fail, as it will be reading bogus data.

Make index_version the last field to be written and switch from using
p-&gt;index_map.data to p-&gt;index_version as "git_pack_file is ready" flag
as we can use it to know if every field has been written.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We use p-&gt;index_map.data to check whether the struct has been set up
and all the information about the index is stored there. This variable
gets set up halfway through the setup process, however, and a thread
can come along and use fields that haven't been written to yet.

Crucially, pack_entry_find_offset() needs to read the index version
(which is written after index_map) to know the offset and stride
length to pass to sha1_entry_pos(). If these values are wrong,
assertions in it will fail, as it will be reading bogus data.

Make index_version the last field to be written and switch from using
p-&gt;index_map.data to p-&gt;index_version as "git_pack_file is ready" flag
as we can use it to know if every field has been written.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Protect sha1_entry_pos call with mutex"</title>
<updated>2013-05-02T15:14:05+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2013-05-02T15:14:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=34bd59992e9e11107d16837b671f867e2a5e77ef'/>
<id>34bd59992e9e11107d16837b671f867e2a5e77ef</id>
<content type='text'>
This reverts commit 8c535f3f6879c6796d8107d7eb80dd8b2105621b.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 8c535f3f6879c6796d8107d7eb80dd8b2105621b.
</pre>
</div>
</content>
</entry>
<entry>
<title>Protect sha1_entry_pos call with mutex</title>
<updated>2013-05-02T10:34:56+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-05-02T10:34:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=8c535f3f6879c6796d8107d7eb80dd8b2105621b'/>
<id>8c535f3f6879c6796d8107d7eb80dd8b2105621b</id>
<content type='text'>
There is an occasional assertion failure in sha1_entry_pos from
pack_entry_find_index when running threaded.  Holding the mutex
around the code that grabs the index_map data and processes it
makes this assertion failure go away.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is an occasional assertion failure in sha1_entry_pos from
pack_entry_find_index when running threaded.  Holding the mutex
around the code that grabs the index_map data and processes it
makes this assertion failure go away.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add extra locking around packfile open</title>
<updated>2013-05-02T10:03:54+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-05-02T10:03:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=9d2f841a5d39fc25ce722a3904f6ebc9aa112222'/>
<id>9d2f841a5d39fc25ce722a3904f6ebc9aa112222</id>
<content type='text'>
We were still seeing a few issues in threaded access to packs.
This adds extra locks around the opening of the mwindow to
avoid a different race.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We were still seeing a few issues in threaded access to packs.
This adds extra locks around the opening of the mwindow to
avoid a different race.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make git_oid_cmp public and add git_oid__cmp</title>
<updated>2013-04-29T20:52:12+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-04-29T20:52:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=b7f167da29effa125663b143d3daf79a6ad88d2e'/>
<id>b7f167da29effa125663b143d3daf79a6ad88d2e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Consolidate packfile allocation further</title>
<updated>2013-04-22T14:52:07+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-04-16T22:00:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=5d2d21e536b83ca2cbf8c026b3149fdf776c3f58'/>
<id>5d2d21e536b83ca2cbf8c026b3149fdf776c3f58</id>
<content type='text'>
Rename git_packfile_check to git_packfile_alloc since it is now
being used more in that capacity.  Fix the various places that use
it.  Consolidate some repeated code in odb_pack.c related to the
allocation of a new pack_backend.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename git_packfile_check to git_packfile_alloc since it is now
being used more in that capacity.  Fix the various places that use
it.  Consolidate some repeated code in odb_pack.c related to the
allocation of a new pack_backend.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make indexer use shared packfile open code</title>
<updated>2013-04-22T14:52:07+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-04-16T21:19:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=38eef6113d8523abfe6746bf727cee2651398ad3'/>
<id>38eef6113d8523abfe6746bf727cee2651398ad3</id>
<content type='text'>
The indexer was creating a packfile object separately from the
code in pack.c which was a problem since I put a call to
git_mutex_init into just pack.c.  This commit updates the pack
function for creating a new pack object (i.e. git_packfile_check())
so that it can be used in both places and then makes indexer.c
use the shared initialization routine.

There are also a few minor formatting and warning message fixes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The indexer was creating a packfile object separately from the
code in pack.c which was a problem since I put a call to
git_mutex_init into just pack.c.  This commit updates the pack
function for creating a new pack object (i.e. git_packfile_check())
so that it can be used in both places and then makes indexer.c
use the shared initialization routine.

There are also a few minor formatting and warning message fixes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Further threading fixes</title>
<updated>2013-04-22T14:52:07+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-04-15T07:09:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=536078688549ac3d50483eecdec5a8169d921927'/>
<id>536078688549ac3d50483eecdec5a8169d921927</id>
<content type='text'>
This builds on the earlier thread safety work to make it so that
setting the odb, index, refdb, or config for a repository is done
in a threadsafe manner with minimized locking time.  This is done
by adding a lock to the repository object and using it to guard
the assignment of the above listed pointers.  The lock is only
held to assign the pointer value.

This also contains some minor fixes to the other work with pack
files to reduce the time that locks are being held to and fix an
apparently memory leak.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This builds on the earlier thread safety work to make it so that
setting the odb, index, refdb, or config for a repository is done
in a threadsafe manner with minimized locking time.  This is done
by adding a lock to the repository object and using it to guard
the assignment of the above listed pointers.  The lock is only
held to assign the pointer value.

This also contains some minor fixes to the other work with pack
files to reduce the time that locks are being held to and fix an
apparently memory leak.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add mutex around mapping and unmapping pack files</title>
<updated>2013-04-22T14:50:51+00:00</updated>
<author>
<name>Russell Belfer</name>
<email>rb@github.com</email>
</author>
<published>2013-04-12T19:59:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=24c70804e87523df99f4740ed2829976ec1a9c1b'/>
<id>24c70804e87523df99f4740ed2829976ec1a9c1b</id>
<content type='text'>
When I was writing threading tests for the new cache, the main
error I kept running into was a pack file having it's content
unmapped underneath the running thread.  This adds a lock around
the routines that map and unmap the pack data so that threads can
effectively reload the data when they need it.

This also required reworking the error handling paths in a couple
places in the code which I tried to make consistent.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When I was writing threading tests for the new cache, the main
error I kept running into was a pack file having it's content
unmapped underneath the running thread.  This adds a lock around
the routines that map and unmap the pack data so that threads can
effectively reload the data when they need it.

This also required reworking the error handling paths in a couple
places in the code which I tried to make consistent.
</pre>
</div>
</content>
</entry>
<entry>
<title>indexer: use a hashtable for keeping track of offsets</title>
<updated>2013-03-03T22:18:29+00:00</updated>
<author>
<name>Carlos Martín Nieto</name>
<email>cmn@dwim.me</email>
</author>
<published>2013-03-03T13:50:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/libgit2.git/commit/?id=0e040c031edc6b61692e74a9b8ce0b0ff86d270a'/>
<id>0e040c031edc6b61692e74a9b8ce0b0ff86d270a</id>
<content type='text'>
These offsets are needed for REF_DELTA objects, which encode which
object they use as a base, but not where it lies in the packfile, so
we need a list.

These objects are mostly from older packfiles, before OFS_DELTA was
widely spread. The time spent in indexing these packfiles is greatly
reduced, though remains above what git is able to do.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These offsets are needed for REF_DELTA objects, which encode which
object they use as a base, but not where it lies in the packfile, so
we need a list.

These objects are mostly from older packfiles, before OFS_DELTA was
widely spread. The time spent in indexing these packfiles is greatly
reduced, though remains above what git is able to do.
</pre>
</div>
</content>
</entry>
</feed>
