git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Enable core.fsyncObjectFiles by default

From
Theodore Ts'o <tytso@mit.edu>
Date
Jun 23, 2015, 23:29 UTC
Message-ID
<20150623232921.GB14324@thunk.org>
In-Reply-To
<xmqqpp4maww7.fsf@gitster.dls.corp.google.com>

The main issue is that non-expert users might not realize that they really need to run "git fsck" after a crash; otherwise, what might happen is that although git is only appending, that you might have some zero-length (or partially written) git object or pack files, and while you might not notice at that moment, it might come and bite you later. If you do try to recover immediately after a crash, in the worst case you might have to do that "git am -s /tmp/mbox-filled-with patches" command, but otherwise you won't lose much data.

So perhaps one alternative strategy to calling fsync(2) after every single git object file write might be to have git create a zero-length ".git/in-progress-<pid>" file, which gets fsync'ed, and then it can do the "git am -s /tmp/akpm-big-bag-o-patches" processing nice and fast, and once git is done, then we call call sync(2) and then delete the in-progress file.

If there is an in-progress file in the .git directory, git would then automatically run git fsck to make sure the repository is consistent.

For people who care, maybe that's a good compromise. (Me, the way things are right now is just fine since I have a nice fast SSD, and so setting fsyncObjectfiles is a perfectly fine thing as far as I am concerned. :-)

		      		     	   - Ted
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 8 in “Enable core.fsyncObjectFiles by default”
  1. Enable core.fsyncObjectFiles by defaultStefan Beller, Jun 23, 2015
  2. Junio C HamanoJun 23, 2015
  3. Theodore Ts'oJun 23, 2015
  4. Junio C HamanoJun 24, 2015
  5. Theodore Ts'oJun 24, 2015
  6. Duy NguyenJun 24, 2015
  7. Jeff KingJun 24, 2015
  8. Junio C HamanoJun 24, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.