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

Re: reftable: new ref storage format

From
Jeff King <peff@peff.net>
Date
Jul 16, 2017, 10:01 UTC
Message-ID
<20170716100141.h4skqqod6lq5s5cc@sigill.intra.peff.net>
In-Reply-To
<CAJo=hJtMo4OSxcYbq4oecTQYnwTR0zK8HgyqVEhOYZ-4eu4S9w@mail.gmail.com>
On Sat, Jul 15, 2017 at 11:01:47PM -0700, Shawn Pearce wrote:
Show 11 quoted lines
> > How deep would you anticipate stacks getting? Would it be feasible for
> > the tip to contain the names of the tables in the entire chain? If we're
> > talking about 20 (or even 32) bytes per name, you could still fit over a
> > hundred names in a 4K inode.
> 
> I think we'd want to keep the stacks under 32, which is a reasonable
> amount of space used in the header of each reftable. I don't have this
> yet in my updated document + implementation, but I'll look at trying
> to add it over the next couple of days. Your idea to hold the explicit
> list of the stack in each reftable makes for a very safe atomic reader
> view.

Great. I was thinking about this a bit and have one more possible tweak.

If you store the names of the dependent reftables in each table, then you end up using storage quadratic in the size of the stack. Because the bottom-most table has 0 pointers, then the next one has 1, and then next one has 2, and so on, until the nth one has n.

Now we're talking about n=32 here, so that's probably OK.
But one variant is that the reftables _don't_ know about their
ancestors. Instead, the list of reftables is kept in a top-level pointer
file, and it's that pointer file which is rewritten on update. I.e., a
write is something like:
 
   1. Take reftable.lock
   2. Write reftables/1234abcd to represent your update.
   3. Copy the old reftable to reftable.lock, then append "1234abcd".
   4. Atomic rename into place.
And the reader is just:
  1. Open reftable, read the list of tables.
  2. In parallel, open/fetch each of the tables and find your starting
     pointer for iteration/lookup.
  3. Do a list-merge on the open tables.

The one thing you lose is that "unreachable" reftables no longer form a meaningful hierarchy. With the pointers inside the reftables themselves, if your "reftable" file got corrupted, you could find the dangling table at the apex of the graph and have a good guess at the ref state. Without, you just have a jumble of states and you don't know which takes precedence (though you could probably make a good guess from mtimes).

> I added log support to the reftable format. I updated [1] to reflect
> log blocks at the end of the file. I ran a year's worth of log
> records, 149,932 log entries on 43,061 refs to test:

Cool. I'll be on vacation for the next week, so apologies if I don't keep the discussion going. But I'm very excited about the overall direction. :)

-Peff
Previous: Shawn PearceNext: Johannes Sixt
Message 13 of 25 in “reftable: new ref storage format”
  1. Shawn PearceJul 13, 2017
  2. Jeff KingJul 13, 2017
  3. Stefan BellerJul 13, 2017
  4. Jeff KingJul 13, 2017
  5. Eric WongJul 13, 2017
  6. Shawn PearceJul 14, 2017
  7. Jeff KingJul 14, 2017
  8. Shawn PearceJul 14, 2017
  9. Dave BorowitzJul 14, 2017
  10. Shawn PearceJul 14, 2017
  11. Jeff KingJul 14, 2017
  12. Shawn PearceJul 16, 2017
  13. Jeff KingJul 16, 2017
  14. Johannes SixtJul 16, 2017
  15. Jeff KingJul 16, 2017
  16. Johannes SixtJul 16, 2017
  17. Michael HaggertyJul 16, 2017
  18. Shawn PearceJul 16, 2017
  19. Shawn PearceJul 16, 2017
  20. Dave BorowitzJul 16, 2017
  21. Shawn PearceJul 16, 2017
  22. Michael HaggertyJul 18, 2017
  23. Junio C HamanoJul 18, 2017
  24. Shawn PearceJul 23, 2017
  25. Shawn PearceJul 23, 2017

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.