Re: [PATCH v5 02/14] bulk-checkin: rebrand plug/unplug APIs as 'odb transactions'
- From
- Neeraj Singh <nksingh85@gmail.com>
- Date
- Mar 31, 2022, 05:51 UTC
- Message-ID
- <CANQDOdex_84nhQu=86jrkyVfnRenRtxQ_8B-mmnXE-a1DfuUJg@mail.gmail.com>
- In-Reply-To
- <xmqqk0cb9x78.fsf@gitster.g>
On Wed, Mar 30, 2022 at 10:17 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
>
> "Neeraj Singh via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > From: Neeraj Singh <neerajsi@microsoft.com>
> >
> > Make it clearer in the naming and documentation of the plug_bulk_checkin
> > and unplug_bulk_checkin APIs that they can be thought of as
> > a "transaction" to optimize operations on the object database. These
> > transactions may be nested so that subsystems like the cache-tree
> > writing code can optimize their operations without caring whether the
> > top-level code has a transaction active.
>
> I can see that "checkin" part of the name is too limiting (you may
> want to do more than optimize checkin, e.g. fsync), and that you may
> prefer "begin/end" over "plug/unplug", but I am not sure if we want
> to limit ourselves to "odb". If we find our code doing things on
> many instances of something that are not objects (e.g. refs, config
> variables), don't we want to give them the same chance to be optimized
> by batching them?
>
> {begin,end}_bulk_transaction perhaps? I dunno.At least in the current code where the implementation of each 'database table' (odb, refs-db, config, index) is pretty separate, it seems better to keep bulk-checkin.c and its plugging scoped to the ODB. Patrick's (who I previously misnamed as 'Peter') older patch at https://lore.kernel.org/git/d9aa96913b1730f1d0c238d7d52e27c20bc55390.1636544377.git.ps@pks.im/ showed a pretty nice and concise implementation for refs tied to the ref-transaction infrastructure.
Thanks, Neeraj