From: Linus Torvalds <torvalds@linux-foundation.org>
To: Alexander Litvinov <litvinov2004@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: My git repo is broken, how to fix it ?
Date: Wed, 28 Feb 2007 08:19:50 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0702280802150.12485@woody.linux-foundation.org> (raw)
In-Reply-To: <200702281754.42383.litvinov2004@gmail.com>
On Wed, 28 Feb 2007, Alexander Litvinov wrote:
>
> > - replace any broken and/or missing objects
> >
> > This is the challenging part. Sometimes (hopefully often!) you can find
> > the missing objects in other copies of the repositories. At other
> > times, you may need to try to find the data some other way (for
> > example, maybe your checked-out copy contains the file content that
> > when hashed will be the missing object?).
>
> Thanks for answer. I have found this blob in cloned repo. I just copy it into
> objects subdir and repack repo again. fsck works without any errors.
Good to hear.
It would probably be good to
- try to figure out why things got corrupted in the first place.
In particular, we should probably check our (my) assumption that the
file rename on cygwin is atomic. Your comment that you use ^C a lot
makes me worry that something basically caused an incomplete write or
other thing to happen..
To be more precise, git will actually start off trying to do a "link +
unlink" pair, because that is the safest thing to do on a UNIX
filesystem: if the linked target already exists, we won't overwrite it
(and the git data consistency rules have always been: honor existing
data over new one, and *never* change anything that has already been
written).
But I would not be shocked to hear that the "link + unlink" sequence
ends up being emulated under cygwin as a "copy + delete" due to lack of
hardlinks or something.
Also, even if the link fails, and git then falls back to "rename()"
(since some filesystems don't do hardlinks at all, or limit them to one
particular directory), I would _still_ not be totally surprised if the
rename got emulated as a copy/delete for some strange Windows reason.
There are other possibilities for corruption, of course: just plain
disk corruption, or (again) some other subtle cygwin emulation or
Windows issue could bite us.
- Even under UNIX, I'm not entirely sure about http/ftp/rsync transfers.
rsync in particular doesn't check anything at all, but last I looked,
the http fetcher was also doing things like checking the integrity of
the object *after* it had already moved it to its final resting place
(which is again unsafe with ^C).
In general, I strongly suggest that people use the "native git"
pack-transfers. The "dumb protocol" transfers are called "dumb" for a
reason..
- It would probably be good to write up the "How to recover" thing,
regardless of why any corruption happens. It doesn't matter if you're
under UNIX and using native protocols, and just being careful as hell:
disks get corrupted, sh*t happens, alpha-particles in the wrong place
do bad things to memory cells. And bugs _are_ inevitable, even if
we've been pretty damn good about these things.
So it's important for people to know what the limits on corruption are,
and tell people that regardless of how stable the git data structures
are, if you care about your data, you need to have things in multiple
places (and no, RAID is _not_ the answer either, even if it can be a
small _part_ of doing things well).
Anybody?
Linus
next prev parent reply other threads:[~2007-02-28 16:19 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-28 4:36 My git repo is broken, how to fix it ? Alexander Litvinov
2007-02-28 4:57 ` Linus Torvalds
2007-02-28 11:54 ` Alexander Litvinov
2007-02-28 16:19 ` Linus Torvalds [this message]
2007-02-28 19:12 ` Alex Riesen
2007-03-19 13:32 ` Alexander Litvinov
2007-03-19 15:20 ` Linus Torvalds
[not found] ` <200703201013.39169.litvinov2004@gmail.com>
2007-03-20 5:34 ` Linus Torvalds
2007-03-20 6:55 ` Alexander Litvinov
2007-03-20 7:42 ` Junio C Hamano
2007-03-20 15:23 ` Nicolas Pitre
[not found] ` <Pine.LNX.4.64.0703200832150.6730@woody.linux-foundation.org>
[not found] ` <Pine.LNX.4.64.0703200836490.6730@woody.linux-foundation.org>
[not found] ` <200703210956.50018.litvinov2004@gmail.com>
2007-03-22 15:58 ` Linus Torvalds
2007-03-22 16:34 ` Nicolas Pitre
[not found] ` <200703211024.04740.litvinov2004@gmail.com>
2007-03-22 16:17 ` Linus Torvalds
2007-03-22 16:29 ` Linus Torvalds
2007-03-22 16:48 ` Linus Torvalds
2007-03-22 17:01 ` Nicolas Pitre
2007-03-22 17:10 ` Linus Torvalds
2007-03-22 17:28 ` Nicolas Pitre
2007-03-22 22:13 ` Jeff King
2007-03-23 0:25 ` Linus Torvalds
2007-03-23 0:42 ` Bill Lear
2007-03-23 0:51 ` Jeff King
2007-03-22 20:31 ` [PATCH] git-apply: Do not free the wrong buffer when we convert the data for writeout Junio C Hamano
2007-03-22 20:55 ` Linus Torvalds
2007-03-23 3:55 ` Alexander Litvinov
2007-03-23 3:40 ` My git repo is broken, how to fix it ? Alexander Litvinov
2007-03-22 17:12 ` Johannes Sixt
2021-06-06 17:27 B
2021-06-06 17:28 B
2021-12-25 8:30 Joseph Mitchell
2021-12-26 0:48 ` Lemuria
2023-05-29 18:57 ross thomas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0702280802150.12485@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=git@vger.kernel.org \
--cc=litvinov2004@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.
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 NNTP newsgroup(s).