On Thu, Dec 1, 2022 at 9:19 PM Derrick Stolee <derrickstolee@xxxxxxxxxx> wrote: > >> The reason to start with this step is that the benefits and risks are > >> clearly understood, which can motivate us to establish the mechanism for > >> changing the ref format by defining the extension. > > > > I believe that the v2 format is a safe change with performance > > improvements, but it's a backward incompatible format change with only > > modest payoff. I also don't understand how it will help you do a stack > > of tables, > > which you need for your primary goal (ie. transactions/deletions > > writing only the delta, rather than rewriting the whole file?). > > The v2 format doesn't help me on its own, but it has other benefits > in terms of size and speed, as well as the "ref count" functionality. > > The important thing is that the definition of extensions.refFormat > that I'm proposing in this RFC establishes a way to make incremental > progress on the ref format, allowing the stacked format to come in > later with less friction. I guess you want to move the read/write stack under the loose storage (packed backend), and introduce (read loose/packed + write packed only) mode that is transitional? Before you embark on this incremental route, I think it would be best to think through carefully how an online upgrade would work in detail (I think it's currently not specified?) If ultimately it's not feasible to do incrementally, then the added complexity of the incremental approach will be for naught. The incremental mode would only be of interest to hosting providers. It will only be used transitionally. It is inherently going to be complex, because it has to consider both storage modes at the same time, and because it is transitional, it will get less real life testing. At the same time, the ref database is comparatively small, so the availability blip that converting the storage offline will impair is going to be small. So, the incremental approach is rather expensive for a comparatively small benefit. I also thought a bit about how you could make the transition seamless, but I can't see a good way: you have to coordinate between tables.list (the list of reftables active or whatever file signals the presence of a stack) and files under refs/heads/. I don't know how to do transactions across multiple files without cooperative locking. If you assume you can use filesystem locks, then you could do something simpler: if a git repository is marked 'transitional', git processes take an FS read lock on .git/ . The process that converts the storage can take an exclusive (write) lock on .git/, so it knows nobody will interfere. I think this only works if the repo is on local disk rather than NFS, though. > * Step 1: replace packed-refs with reftable. > * Step 2: stop writing loose refs, only update reftable (but still read loose refs). Does that work? A long running process might not notice the switch in step 2, so it could still write a ref as loose, while another process racing might write a different value to the same ref through reftable. PS. I'll be away from work until Jan 9th. -- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Liana Sebastian