git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Neeraj K. Singh via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Neeraj Singh <nksingh85@gmail.com>,
	"Neeraj K. Singh" <neerajsi@microsoft.com>
Subject: [PATCH v3 0/2] ns/tmp-objdir: add support for temporary writable databases
Date: Mon, 06 Dec 2021 22:05:03 +0000	[thread overview]
Message-ID: <pull.1091.v3.git.1638828305.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1091.v2.git.1638750965.gitgitgadget@gmail.com>

V3 (hopefully final):

 * Fix the commit description for patch [2/2] to reflect the fact that
   disabling ref updates no longer depends on the_repository.
 * Add a link to Jeff King's test case in patch [2/2]. The test relies on
   remerge-diff, so it can't be directly included here.
 * Adjust line spacing in update_relative_gitdir (gitster)
 * Switch struct object_directory to use full-width integers rather than
   flags (gitster)
 * Fix typo s/protentially/potentially (neerajsi)

V2 changes: I lost a couple changes in the shuffle while splitting these
changes out

 * Make the will-destroy boolean a single bit field of type unsigned int so
   that it doesn't change twice in this small patch series.
 * Remove a the_repository reference in the disable ref updates code. Now
   the repository is taken from the ref_store.

New interface into the tmp-objdir API to help in-core use of the quarantine
feature.

This patch series was formerly part of the ns/batched-fsync topic [1]. It's
now split out into its own gitgitgadget PR and discussion thread since it is
the base for en/remerge-diff as well.

The most recent feedback was in [2]. I removed printing from prune_subdir
and simplified the strbuf handling in prune_tmp_file.

References: [1]
https://lore.kernel.org/git/pull.1076.v9.git.git.1637020263.gitgitgadget@gmail.com/
[2]
https://lore.kernel.org/git/CABPp-BH6m4q_EoX77bqLcpCN1HRfJ_XayeCV2O0sRybX53rPrw@mail.gmail.com/

Neeraj Singh (2):
  tmp-objdir: new API for creating temporary writable databases
  tmp-objdir: disable ref updates when replacing the primary odb

 builtin/prune.c        | 20 ++++++++++++---
 builtin/receive-pack.c |  2 +-
 environment.c          |  9 +++++++
 object-file.c          | 50 ++++++++++++++++++++++++++++++++++++--
 object-store.h         | 26 ++++++++++++++++++++
 object.c               |  2 +-
 refs.c                 |  2 +-
 repository.c           |  2 ++
 repository.h           |  1 +
 tmp-objdir.c           | 55 +++++++++++++++++++++++++++++++++++++++---
 tmp-objdir.h           | 29 +++++++++++++++++++---
 11 files changed, 183 insertions(+), 15 deletions(-)


base-commit: cd3e606211bb1cf8bc57f7d76bab98cc17a150bc
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1091%2Fneerajsi-msft%2Fns%2Ftmp-objdir-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1091/neerajsi-msft/ns/tmp-objdir-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/1091

Range-diff vs v2:

 1:  36c00613d9a ! 1:  cccb3888070 tmp-objdir: new API for creating temporary writable databases
     @@ environment.c: static void update_relative_gitdir(const char *name,
       {
       	char *path = reparent_relative_path(old_cwd, new_cwd, get_git_dir());
      +	struct tmp_objdir *tmp_objdir = tmp_objdir_unapply_primary_odb();
     ++
       	trace_printf_key(&trace_setup_key,
       			 "setup: move $GIT_DIR to '%s'",
       			 path);
     -+
       	set_git_dir_1(path);
      +	if (tmp_objdir)
      +		tmp_objdir_reapply_primary_odb(tmp_objdir, old_cwd, new_cwd);
     @@ object-store.h: struct object_directory {
      +	/*
      +	 * This object store is ephemeral, so there is no need to fsync.
      +	 */
     -+	unsigned int will_destroy : 1;
     ++	int will_destroy;
      +
       	/*
       	 * Path to the alternative object store. If this is a relative path,
     @@ tmp-objdir.h: int tmp_objdir_destroy(struct tmp_objdir *);
       void tmp_objdir_add_as_alternate(const struct tmp_objdir *);
       
      +/*
     -+ * Replaces the main object store in the current process with the temporary
     ++ * Replaces the writable object store in the current process with the temporary
      + * object directory and makes the former main object store an alternate.
      + * If will_destroy is nonzero, the object directory may not be migrated.
      + */
     @@ tmp-objdir.h: int tmp_objdir_destroy(struct tmp_objdir *);
      +struct tmp_objdir *tmp_objdir_unapply_primary_odb(void);
      +
      +/*
     -+ * Reapplies the former primary temporary object database, after protentially
     ++ * Reapplies the former primary temporary object database, after potentially
      + * changing its relative path.
      + */
      +void tmp_objdir_reapply_primary_odb(struct tmp_objdir *, const char *old_cwd,
 2:  f667cbcc47d ! 2:  4e44121c2d7 tmp-objdir: disable ref updates when replacing the primary odb
     @@ Commit message
          the disable_ref_updates flag on the odb, which is queried by
          the ref_transaction_prepare function.
      
     -    Note: This change adds an assumption that the state of
     -    the_repository is relevant for any ref transaction that might
     -    be initiated. Unwinding this assumption should be straightforward
     -    by saving the relevant repository to query in the transaction or
     -    the ref_store.
     -
     -    Peff's test case was invoking ref updates via the cachetextconv
     +    Peff's test case [1] was invoking ref updates via the cachetextconv
          setting. That particular code silently does nothing when a ref
          update is forbidden. See the call to notes_cache_put in
          fill_textconv where errors are ignored.
      
     +    [1] https://lore.kernel.org/git/YVOn3hDsb5pnxR53@coredump.intra.peff.net/
     +
          Reported-by: Jeff King <peff@peff.net>
      
          Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
     @@ object-store.h: struct object_directory {
      +	 * facility. Disable ref updates since the objects in the store
      +	 * might be discarded on rollback.
      +	 */
     -+	unsigned int disable_ref_updates : 1;
     ++	int disable_ref_updates;
      +
       	/*
       	 * This object store is ephemeral, so there is no need to fsync.

-- 
gitgitgadget

  parent reply	other threads:[~2021-12-06 22:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04  2:40 [PATCH 0/2] ns/tmp-objdir: add support for temporary writable databases Neeraj K. Singh via GitGitGadget
2021-12-04  2:40 ` [PATCH 1/2] tmp-objdir: new API for creating " Neeraj Singh via GitGitGadget
2021-12-04  2:40 ` [PATCH 2/2] tmp-objdir: disable ref updates when replacing the primary odb Neeraj Singh via GitGitGadget
2021-12-05 18:23   ` Junio C Hamano
2021-12-05 23:44     ` Neeraj Singh
2021-12-05 23:56       ` Junio C Hamano
2021-12-06  3:10         ` Neeraj Singh
2021-12-06  0:36 ` [PATCH v2 0/2] ns/tmp-objdir: add support for temporary writable databases Neeraj K. Singh via GitGitGadget
2021-12-06  0:36   ` [PATCH v2 1/2] tmp-objdir: new API for creating " Neeraj Singh via GitGitGadget
2021-12-06  7:43     ` Junio C Hamano
2021-12-06  8:53       ` Neeraj Singh
2021-12-06 17:39         ` Junio C Hamano
2021-12-06  0:36   ` [PATCH v2 2/2] tmp-objdir: disable ref updates when replacing the primary odb Neeraj Singh via GitGitGadget
2021-12-06  3:12     ` Neeraj Singh
2021-12-06 22:05   ` Neeraj K. Singh via GitGitGadget [this message]
2021-12-06 22:05     ` [PATCH v3 1/2] tmp-objdir: new API for creating temporary writable databases Neeraj Singh via GitGitGadget
2021-12-06 22:05     ` [PATCH v3 2/2] tmp-objdir: disable ref updates when replacing the primary odb Neeraj Singh via GitGitGadget
2021-12-08 16:41     ` [PATCH v3 0/2] ns/tmp-objdir: add support for temporary writable databases Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1091.v3.git.1638828305.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=neerajsi@microsoft.com \
    --cc=nksingh85@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).