Re: reftable [v4]: new ref storage format
From: Shawn Pearce <hidden>
Date: 2017-08-03 02:21:38
On Wed, Aug 2, 2017 at 6:50 PM, Junio C Hamano [off-list ref] wrote:
Junio C Hamano [off-list ref] writes:quoted
I like the general idea, what the file format can represent and how it does so, but I am a bit uneasy about how well this "stacked" part would work for desktop clients.Two more random things before I forget. * I understand that you would want to allow both a ref "ref/D" and "ref/D/F" to appear in the same reftable file. A refname is an uninterpreted sequence of bytes and refnames are sorted in the table. Would it benefit us if we define the sort order of bytes slightly different from the ASCII order, so that a slash '/' sorts between NUL '\000' and SOH '\001', which is the order we should have used when storing the entries in the index?
I'm not really with that. It complicates the compare routine, and makes the data in reftable sorted differently than we announce in the wire protocol. That cuts off any sort of optimizations we were considering at $DAY_JOB to plumb the wire protocol code in JGit closer to reftable code so that a large advertisement is more or less just dumped straight from reftable to the wire protocol with only minimal formatting changes.
* Even though readers can continue accessing, starting from the $GIT_DIR/refs, without locking and get consistent views, any transaction that groups one or more ref updates would need to take a global lock on $GIT_DIR/refs file. Would it become a problem in a busy repository?
Potentially yes. Writers may need to use a randomized exponential backoff while trying to acquire the lock. For big application servers, I recommended wrapping the file IO locking code with an application server managed lock + fair wait queue. This is fairly straightforward for JGit to implement within Gerrit Code Review. I'm not really sure how one could safely do the same thing with git-core. Its certainly not going to be portable or safe on NFS if we tried to do anything fancy with flock(2), fcntl(F_SETLKW), or semop(2).