On Wed, Mar 30, 2022 at 10:17 AM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > "Neeraj Singh via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > > > From: Neeraj Singh <neerajsi@xxxxxxxxxxxxx> > > > > 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@xxxxxx/ showed a pretty nice and concise implementation for refs tied to the ref-transaction infrastructure. Thanks, Neeraj