Skip to content

tmp-objdir: fix regressions in core.fsyncobjectfiles=batch#1067

Closed
neerajsi-msft wants to merge 4 commits into
gitgitgadget:ns/tmp-objdirfrom
neerajsi-msft:ns/tmp-objdir-fixes
Closed

tmp-objdir: fix regressions in core.fsyncobjectfiles=batch#1067
neerajsi-msft wants to merge 4 commits into
gitgitgadget:ns/tmp-objdirfrom
neerajsi-msft:ns/tmp-objdir-fixes

Conversation

@neerajsi-msft

@neerajsi-msft neerajsi-msft commented Oct 26, 2021

Copy link
Copy Markdown
  • Fix prune code to be able to work against multiple cruft directories. I noticed this in self-review.

  • When dscho enabled core.fsyncobjectfiles=batch in git-for-windows we saw some test-failures in
    update-index tests. The root cause is that setup_work_tree does a chdir_notify, which erases the
    tmp-objdir state. I now unapply and reapply the tmp-objdir around setup_git_env.

This branch autosquashes cleanly and it needs to be merged with ns/batched-fsync, where
it currently merges cleanly.

CC:[email protected]
cc: Neeraj Singh [email protected]

The tmp_objdir API provides the ability to create temporary object
directories, but was designed with the goal of having subprocesses
access these object stores, followed by the main process migrating
objects from it to the main object store or just deleting it.  The
subprocesses would view it as their primary datastore and write to it.

Here we add the tmp_objdir_replace_primary_odb function that replaces
the current process's writable "main" object directory with the
specified one. The previous main object directory is restored in either
tmp_objdir_migrate or tmp_objdir_destroy.

For the --remerge-diff usecase, add a new `will_destroy` flag in `struct
object_database` to mark ephemeral object databases that do not require
fsync durability.

Add 'git prune' support for removing temporary object databases, and
make sure that they have a name starting with tmp_ and containing an
operation-specific name.

Based-on-patch-by: Elijah Newren <[email protected]>

Signed-off-by: Neeraj Singh <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
When creating a subprocess with a temporary ODB, we set the
GIT_QUARANTINE_ENVIRONMENT env var to tell child Git processes not
to update refs, since the tmp-objdir may go away.

Introduce a similar mechanism for in-process temporary ODBs when
we call tmp_objdir_replace_primary_odb. Now both mechanisms set
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
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.

Reported-by: Jeff King <[email protected]>

Signed-off-by: Neeraj Singh <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
@gitgitgadget

gitgitgadget Bot commented Oct 26, 2021

Copy link
Copy Markdown

There is an issue in commit 0c86c99:
Commit not signed off

@gitgitgadget

gitgitgadget Bot commented Oct 26, 2021

Copy link
Copy Markdown

There is an issue in commit 0c86c99:
Commit not signed off

Fix prune code to be able to delete multiple object directories. I
wasn't properly resetting the strbuf with the path.

Signed-off-by: Neeraj Singh <[email protected]>
When setup_work_tree executes, it redoes setup of the object database
path and various other aspects of the_repository.  This destroys the
temporary object database state.

This commit removes the temporary object database and reapplies it
around the operations in the chdir_notify callback.

Signed-off-by: Neeraj Singh <[email protected]>
@neerajsi-msft

Copy link
Copy Markdown
Author

/submit

@gitgitgadget

gitgitgadget Bot commented Oct 26, 2021

Copy link
Copy Markdown

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git pr-1067/neerajsi-msft/ns/tmp-objdir-fixes-v1

To fetch this version to local tag pr-1067/neerajsi-msft/ns/tmp-objdir-fixes-v1:

git fetch --no-tags https://github.com/gitgitgadget/git tag pr-1067/neerajsi-msft/ns/tmp-objdir-fixes-v1

@gitgitgadget

gitgitgadget Bot commented Oct 27, 2021

Copy link
Copy Markdown

On the Git mailing list, Johannes Schindelin wrote (reply to this):

Hi Neeraj,

On Tue, 26 Oct 2021, Neeraj K. Singh via GitGitGadget wrote:

>  * Fix prune code to be able to work against multiple cruft directories. I
>    noticed this in self-review.
>
>  * When dscho enabled core.fsyncobjectfiles=batch in git-for-windows we saw
>    some test-failures in update-index tests. The root cause is that
>    setup_work_tree does a chdir_notify, which erases the tmp-objdir state. I
>    now unapply and reapply the tmp-objdir around setup_git_env.
>
> This branch autosquashes cleanly and it needs to be merged with
> ns/batched-fsync, where it currently merges cleanly.
>
> Neeraj Singh (2):
>   fixup! tmp-objdir: new API for creating temporary writable databases
>   fixup! tmp-objdir: new API for creating temporary writable databases

Thank you for the fast work on the fixes!

I applied both patches to the PR branch and pushed; Let's see how the CI
over at https://github.com/git-for-windows/git/pull/3492 pans out.

Please note the original patch made it into `next` already (and is hence
subject to follow-up patches rather than being rewritten).

Therefore, you may need to reword the commit messages so that they stand
on their own, as follow-up commits.

And alternative would be to ask Junio to kick the topic out of `next` and
back to `seen`, in which case you will probably be asked to submit a new
iteration of the original patch.

Thank you again!
Dscho

>
>  builtin/prune.c |  1 +
>  environment.c   |  5 +++++
>  tmp-objdir.c    | 25 +++++++++++++++++++++++++
>  tmp-objdir.h    | 15 +++++++++++++++
>  4 files changed, 46 insertions(+)
>
>
> base-commit: 50741b157f2f90df76a60418e2781b2c1e6e3c78
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1067%2Fneerajsi-msft%2Fns%2Ftmp-objdir-fixes-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1067/neerajsi-msft/ns/tmp-objdir-fixes-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/1067
> --
> gitgitgadget
>
>

@gitgitgadget

gitgitgadget Bot commented Oct 27, 2021

Copy link
Copy Markdown

On the Git mailing list, Junio C Hamano wrote (reply to this):

Johannes Schindelin <[email protected]> writes:

>> Neeraj Singh (2):
>>   fixup! tmp-objdir: new API for creating temporary writable databases
>>   fixup! tmp-objdir: new API for creating temporary writable databases
>
> Thank you for the fast work on the fixes!
>
> I applied both patches to the PR branch and pushed; Let's see how the CI
> over at https://github.com/git-for-windows/git/pull/3492 pans out.
>
> Please note the original patch made it into `next` already (and is hence
> subject to follow-up patches rather than being rewritten).
>
> Therefore, you may need to reword the commit messages so that they stand
> on their own, as follow-up commits.
>
> And alternative would be to ask Junio to kick the topic out of `next` and
> back to `seen`, in which case you will probably be asked to submit a new
> iteration of the original patch.

Yeah, none of the above is attractive this late in the cycle X-<.

It probalby is best to queue the "fixup!" commits as they are on top
of ns/tmp-objdir, merge the result to two topics that depend on
ns/tmp-objdir, and keep them without merging them down, until the
release.  When it is time to rewind 'next' after the release, it
would be a good chance to get rid of these "oops, earlier we screwed
up" commits by redoing the tmp-objdir (and rebasing the other two
topics on top).

@gitgitgadget

gitgitgadget Bot commented Oct 27, 2021

Copy link
Copy Markdown

On the Git mailing list, Neeraj Singh wrote (reply to this):

On Wed, Oct 27, 2021 at 02:09:21PM -0700, Junio C Hamano wrote:
> Yeah, none of the above is attractive this late in the cycle X-<.
> 
> It probalby is best to queue the "fixup!" commits as they are on top
> of ns/tmp-objdir, merge the result to two topics that depend on
> ns/tmp-objdir, and keep them without merging them down, until the
> release.  When it is time to rewind 'next' after the release, it
> would be a good chance to get rid of these "oops, earlier we screwed
> up" commits by redoing the tmp-objdir (and rebasing the other two
> topics on top).
> 

Hi Junio,
Apologies for the breakage! I just want to be 100% clear here: is there
any action I should take with the patches, or will you handle the merge/rebase?

FYI for anyone trying this on git-for-windows, there's one additional patch at:
https://github.com/neerajsi-msft/git/commit/435e1d2e5e8fb422b0f08ff6a01a130584f7e249

That fixes a gfw-specific breakage that affects tmp_objdir_migrate and causes it to
infinitely create recursive directories until the disk fills up (surprisingly we don't
hit stack overflow first).

Thanks,
Neeraj

@gitgitgadget

gitgitgadget Bot commented Oct 27, 2021

Copy link
Copy Markdown

User Neeraj Singh <[email protected]> has been added to the cc: list.

@gitgitgadget

gitgitgadget Bot commented Oct 28, 2021

Copy link
Copy Markdown

On the Git mailing list, Junio C Hamano wrote (reply to this):

Neeraj Singh <[email protected]> writes:

> On Wed, Oct 27, 2021 at 02:09:21PM -0700, Junio C Hamano wrote:
>> Yeah, none of the above is attractive this late in the cycle X-<.
>> 
>> It probalby is best to queue the "fixup!" commits as they are on top
>> of ns/tmp-objdir, merge the result to two topics that depend on
>> ns/tmp-objdir, and keep them without merging them down, until the
>> release.  When it is time to rewind 'next' after the release, it
>> would be a good chance to get rid of these "oops, earlier we screwed
>> up" commits by redoing the tmp-objdir (and rebasing the other two
>> topics on top).
>> 
>
> Hi Junio,
> Apologies for the breakage! I just want to be 100% clear here: is there
> any action I should take with the patches, or will you handle the merge/rebase?

If we all agree on the above plan, then nothing for you for now, but
we'd ask you to send a cleaned-up patch after the upcoming release
when the 'next' branch gets rewound and rebuilt, at which time we
can get rid of the "oops, we screwed up" fixup patches.

Thanks for finding and sending in the fix.

@gitgitgadget

gitgitgadget Bot commented Oct 28, 2021

Copy link
Copy Markdown

This branch is now known as ns/tmp-objdir.

@gitgitgadget

gitgitgadget Bot commented Oct 28, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@6745aa6.

@gitgitgadget

gitgitgadget Bot commented Oct 28, 2021

Copy link
Copy Markdown

This patch series was integrated into next via git@001a18c.

@gitgitgadget

gitgitgadget Bot commented Oct 28, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@af7cb07.

@dscho

dscho commented Oct 28, 2021

Copy link
Copy Markdown
Member

This patch series was integrated into next via git@001a18c.

That's good news, as the breakage is fixed in next. When Git v2.34 comes around, and next is rewound, it is probably a good time to squash this into git#1076 and submit a new iteration of that PR.

@gitgitgadget

gitgitgadget Bot commented Oct 29, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@10b875b.

@gitgitgadget

gitgitgadget Bot commented Oct 29, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@a16745a.

@gitgitgadget

gitgitgadget Bot commented Oct 29, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@74afafe.

@gitgitgadget

gitgitgadget Bot commented Oct 30, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

On hold.
cf. <[email protected]>

@gitgitgadget

gitgitgadget Bot commented Nov 2, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@e2b96b9.

@gitgitgadget

gitgitgadget Bot commented Nov 2, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

On hold.
cf. <[email protected]>

@gitgitgadget

gitgitgadget Bot commented Nov 3, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@671cab4.

@gitgitgadget

gitgitgadget Bot commented Nov 10, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@62a9499.

@gitgitgadget

gitgitgadget Bot commented Nov 11, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@5a6656e.

@gitgitgadget

gitgitgadget Bot commented Nov 11, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@739ce11.

@gitgitgadget

gitgitgadget Bot commented Nov 12, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@5375511.

@gitgitgadget

gitgitgadget Bot commented Nov 12, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@69d5119.

@gitgitgadget

gitgitgadget Bot commented Nov 14, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@6cfd30d.

@gitgitgadget

gitgitgadget Bot commented Nov 15, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@69aafec.

@gitgitgadget

gitgitgadget Bot commented Nov 15, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

On hold.
cf. <[email protected]>

@gitgitgadget

gitgitgadget Bot commented Nov 20, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@41e1342.

@gitgitgadget

gitgitgadget Bot commented Nov 20, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

On hold.
cf. <[email protected]>

@gitgitgadget

gitgitgadget Bot commented Nov 22, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@1c958d7.

@gitgitgadget

gitgitgadget Bot commented Nov 22, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@a3ff8db.

@gitgitgadget

gitgitgadget Bot commented Nov 22, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@afed8ea.

@gitgitgadget

gitgitgadget Bot commented Nov 23, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@45b9a03.

@gitgitgadget

gitgitgadget Bot commented Nov 23, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@9c29f5e.

@gitgitgadget

gitgitgadget Bot commented Nov 24, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@a3c0865.

@gitgitgadget

gitgitgadget Bot commented Nov 25, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

On hold.
cf. <[email protected]>

@gitgitgadget

gitgitgadget Bot commented Nov 30, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@1833f4c.

@gitgitgadget

gitgitgadget Bot commented Nov 30, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

On hold.
cf. <[email protected]>

@gitgitgadget

gitgitgadget Bot commented Dec 2, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@f8d1005.

@gitgitgadget

gitgitgadget Bot commented Dec 2, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@1264f02.

@gitgitgadget

gitgitgadget Bot commented Dec 3, 2021

Copy link
Copy Markdown

This patch series was integrated into seen via git@1ee62e4.

@gitgitgadget

gitgitgadget Bot commented Dec 4, 2021

Copy link
Copy Markdown

There was a status update in the "Cooking" section about the branch ns/tmp-objdir on the Git mailing list:

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

Expecting a reroll.
cf. <CANQDOddCC7+gGUy1VBxxwvN7ieP+N8mQhbxK2xx6ySqZc6U7-g@mail.gmail.com>
cf. <CABPp-BHq4DnkCZZ+HcnGiZYKHpWJgzMBjMDuWbbTFYPesm2sXA@mail.gmail.com>
cf. <[email protected]>
cf. <ef5a087813b7dfd232a9366eee09774d197e2307.1635287730.git.gitgitgadge=
[email protected]>

@dscho
dscho force-pushed the ns/tmp-objdir branch 4 times, most recently from 34f333b to ecd81df Compare December 9, 2021 01:42
@gitgitgadget

gitgitgadget Bot commented Jan 4, 2022

Copy link
Copy Markdown

There was a status update in the "Graduated to 'master'" section about the branch ns/tmp-objdir on the Git mailing list:

New interface into the tmp-objdir API to help in-core use of the
quarantine feature.
source: <[email protected]>

@dscho

dscho commented Jan 4, 2022

Copy link
Copy Markdown
Member

@neerajsi-msft I guess this can be closed now? (Sorry, GitGitGadget's automatic checks seem to have been defeated by this PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants