git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/7] rev-cache: add on-disk format for fast reachability lookup

From
Sam Vilain <sam@vilain.net>
Date
Jun 4, 2009, 14:05 UTC
Message-ID
<25e92985a657be1d7ea3dd8486cbe404b072a2a2.1244125127.git.sam@vilain.net>
In-Reply-To
<cover.1244125127.git.sam@vilain.net>

As well as storing the sorted list of objects, store a hash table for faster lookup.

Signed-off-by: Sam Vilain <sam@vilain.net>
---
 Documentation/technical/revision-cache.txt |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/Documentation/technical/revision-cache.txt b/Documentation/technical/revision-cache.txt
index cc18535..8349cfe 100644
--- a/Documentation/technical/revision-cache.txt
+++ b/Documentation/technical/revision-cache.txt
@@ -14,6 +14,9 @@ A revision cache contains;
 
     * object ID
 
+  - A hash table from an (abbreviated) object ID to a position into
+    the above list
+
 
 Start Object
 ------------
@@ -35,6 +38,18 @@ objects are sorted as if they were commit objects with a single
 parent, the object they tag.
 
 
+Included object hash table
+--------------------------
+
+This index is used to quickly determine if an object exists in the
+index without scanning the entire topological list.
+
+Entries in the object hash table can be shortened, eg to 3 or 4 bytes;
+basically they just need to be long enough to avoid collisions within
+the objects which exist in the list.  Any match must be confirmed by
+checking the full SHA1 in the topological list.
+
+
 Use Cases
 ---------
 In this section, the key functions and operations that this index is
@@ -131,7 +146,8 @@ passed, or any 'uninteresting' objects were passed.
 
 This function must revision walk the commit graph, sorting in
 --date-order along the way, and may emit revisions as they are
-discovered to the topological object list.
+discovered to the topological object list.  It must also build a hash
+table of object IDs and emit it at the end.
 
 
 receive-pack/pack-objects
@@ -186,9 +202,9 @@ emitted, the delta from the packfile is re-used.  If a loop is
 detected or the delta base is not in the returned set of objects, then
 the delta is first resolved.
 
-This implies that the list of objects is first loaded into a hash
-table prior to returning any objects; however this is probably
-acceptable as the entire list is in one stream and will load quickly.
+This implies that each delta base must be looked up in the on-disk
+hash table as they are written, which is both low impact and memory
+efficient.
 
 For later fetches, the revision cache is not appropriate as they will
 have 'uninteresting' objects set.
-- 
debian.1.5.6.1
Previous: Sam VilainNext: Sam Vilain
Message 2 of 14 in “[GSoC2009] Revision cache / git-daemon caching plan”
  1. 0/7 [GSoC2009] Revision cache / git-daemon caching planSam Vilain, Jun 4, 2009
  2. 2/7 rev-cache: add on-disk format for fast reachability lookupSam Vilain, Jun 4, 2009
  3. 5/7 revision cache: maps of 'new' objectsSam Vilain, Jun 4, 2009
  4. 4/7 rev-cache: allow multiple 'start' objects per indexSam Vilain, Jun 4, 2009
  5. 1/7 revision-cache: define revision cache as simple list of revisionsSam Vilain, Jun 4, 2009
  6. Nicolas PitreJun 5, 2009
  7. Sam VilainJun 7, 2009
  8. Nicolas PitreJun 7, 2009
  9. 3/7 rev-cache: add 'end' objects for caching 'uninteresting' lookupsSam Vilain, Jun 4, 2009
  10. 7/7 revision cache: be even stricter with sort orderSam Vilain, Jun 4, 2009
  11. 6/7 revision cache: allow foreign 'start' commitsSam Vilain, Jun 4, 2009
  12. Jakub NarebskiJun 5, 2009
  13. Nicolas PitreJun 5, 2009
  14. Sam VilainJun 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.