You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ted Gould <te...@gould.cx> on 2005/08/23 06:51:36 UTC

Subversion FSFS corruption

I sent this message the user list on Friday, but I believe that may have
been the wrong list.  Quick summary, I have a repository that appears to
have had a Delta put in incorrectly.  Now the repository is unworkable.
I'd like to be able to fix the repository, but in the case that
subversion has lost my data, I'd like to get the repository working
again.

		Thanks,
			Ted

-------- Forwarded Message --------
From: Ted Gould <te...@gould.cx>
To: users@subversion.tigris.org
Subject: Delta does not fill the target window
Date: Fri, 19 Aug 2005 13:44:18 -0700

Hello,

I seem to have a corrupt SVN repository.  I have checked several backups 
and I believe that there is not a disk error, but actually a subversion 
error has occurred.  Let me show you the simplest way to get this error 
in my repository:

$ svnadmin dump -r 671 --incremental /home/ted/.svn_data/PhotosFS/ > 
/dev/null
svn: Delta does not fill the target window

I'm using a filesystem backend and Ubuntu Linux.  The version was 
created in June, so I'm not entirely sure which version of subversion I 
was running at that time.  I believe it was in the 1.1.x series.  I 
found this as I now have a new hard drive, and I copied over the 
repository and I am trying to create a new working copy.  The checkout 
fails when trying to restore img_5633.jpg from version 671.  I don't 
have an original copy of img_5633.jpg to compare against, but I'm 
working on getting that.

I believe that there are no other versions that have this error in my 
repository.  Here is how I checked:

$ perl -e "for (\$i = 672; \$i < 725; \$i++) {system(\"svnadmin dump -r 
\$i --incremental /home/ted/.svn_data/PhotosFS/ > /dev/null\");}"

I'm not entirely able to make out the file format in the FSFS repository 
files, but I think this is the metadata for the file with the error:

PLAIN
K 13
svn:mime-type
V 24
application/octet-stream
END
ENDREP
id: 7ry.0.r671/469843979
type: file
count: 0
text: 671 125184612 3924753 3922699 9112d223ba3e88b19e846e429f0ef361
props: 671 469843913 53 0 113136892f2137aa0116093a524ade0b
cpath: /Unsorted/65_Alaska/03_DenaliToo/img_5633.jpg
copyroot: 0 /

I believe that one of the numbers on the 'text:' line is probably the 
diff size?  Which one?  I'd like to determine whether the diff is too 
small or if the number is.

Also, when I do "svn cat -r 671 img_5633.jpg > img_5633.jpg" besides 
getting the delta error, the file contains a JPEG with about 75% of the 
picture.  Should I assume that the diff is too small then?

I have put the version file on my website, but unfortunately it is 
450MB, so it is not easy to download.  It is located here for anyone who 
would be willing to help with this:

http://gould.cx/corrupt.671.bz2


After all that, I guess my questions are:

1) How do I determine whether the size listing or the size of the delta 
are correct?
2) Assuming I give up on ever seeing img_5633.jpg again, how do I get my 
repository back online?
3) Is this a bug?  Any other data that you need?

     Thanks in advance,
         Ted


Re: Subversion FSFS corruption

Posted by Jonathan Gilbert <o2...@sneakemail.com>.
At 01:55 AM 24/08/2005 -0400, Greg Hudson wrote:
>This is a self-compressed delta, so I think it should be the vdelta
>algorithm.  Since we're compressing already-compressed data, one
>wouldn't expect to be able to do any better than "insert the new data",
>which is one instructions.  But there seem to be scores of instructions,
>which is not what one would expect from vdelta since it shouldn't be
>finding four-byte matches within the target.

I'm not quite sure what "self-compressed" means, but I think you're
forgetting something quite important: JPEG files have header information,
and sometimes quite a lot of it (I have seen JPEG files with more than 30KB
of information preceding the SOI tag). It is binary, but it would tend to
change infrequently over the course of editing an image. Fields such as the
software used to produce the JPEG ("Adobe Photoshop v7.0"), the width,
height, colour space, gamma and other parameters, and any other comment
data would not change. Also, with traditional JFIF, thumbnail data is
stored uncompressed, and depending on how it is generated, it may share
some data with the previous revision of the file. With the new EXIF,
thumbnails are stored JPEG-compressed, but other information about the
image is stored uncompressed, in a TIFF dictionary embedded into the JPEG
APP1 tag. That data and the TIFF dictionary itself can remain unchanged.

Certainly, though, with a lossy format, it would be exceedingly rare to see
actual image data unchanged, even if the user had not edited those pixels;
the chance of the DCT & quantization phases finding exactly the same fit is
pretty low. :-)

Jonathan Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2005-08-23 at 20:24 -0400, Daniel Berlin wrote:
> >  That suggests an oddity in our delta algorithm and a
> > possible space performance issue on compressed files.
> 
> What do you mean, "oddity"?

This is a self-compressed delta, so I think it should be the vdelta
algorithm.  Since we're compressing already-compressed data, one
wouldn't expect to be able to do any better than "insert the new data",
which is one instructions.  But there seem to be scores of instructions,
which is not what one would expect from vdelta since it shouldn't be
finding four-byte matches within the target.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Daniel Berlin <db...@dberlin.org>.
On Tue, 2005-08-23 at 20:12 -0400, Greg Hudson wrote:
> On Tue, 2005-08-23 at 14:24 -0700, Ted Gould wrote:
> > This is odd to me, as I believe that this is a direct import of the 
> > picture.  I don't know anything about the Delta format, but it seems 
> > that there should be very few instructions at head of each chunk.  More 
> > of a "just use this data" type command.
> 
> One would imagine that would be the case for a jpeg file, but it looks
> to me like there are 310 bytes of instructions there.  The other chunks
> (which verify just fine) also contain substantial numbers of
> instructions. 
>  That suggests an oddity in our delta algorithm and a
> possible space performance issue on compressed files.

What do you mean, "oddity"?
We hold inserts for as long as possible before issuing them, in hopes of
extending a later match back into them.  We can't do much better than we
do.
If the matches are ending earlier than you think they should, then
either the rolling checksum isn't working quite right, or i screwed up
one of the loop conditions.

--Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2005-08-23 at 14:24 -0700, Ted Gould wrote:
> This is odd to me, as I believe that this is a direct import of the 
> picture.  I don't know anything about the Delta format, but it seems 
> that there should be very few instructions at head of each chunk.  More 
> of a "just use this data" type command.

One would imagine that would be the case for a jpeg file, but it looks
to me like there are 310 bytes of instructions there.  The other chunks
(which verify just fine) also contain substantial numbers of
instructions.  That suggests an oddity in our delta algorithm and a
possible space performance issue on compressed files.

>   Could this command be changed?

It's likely that the delta chunk could be fiddled into something which
verifies (but produces the wrong data) without changing its size, yes.

> Where is the documentation of the delta format?  I know it must exist, 
> but I can't seem to find it.  This is a WebDAV thing, right?

It's not a WebDAV thing.
http://svn.collab.net/repos/svn/trunk/notes/svndiff describes the
format.

There's code in subversion/tests/libsvn_delta to print a delta window,
although you'd have to adapt it for this purpose, and it probably prints
out the new data directly, which wouldn't be so great for binary data.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Ted Gould <te...@gould.cx>.
kfogel@collab.net wrote:
 >>I believe that one of the numbers on the 'text:' line is probably the
 >>diff size?  Which one?  I'd like to determine whether the diff is too
 >>small or if the number is.
 >
 > Well, the fact that it says "PLAIN" at the beginning makes me think
 > it's not a delta at all, but a fulltext representation.  I'm getting
 > this from reading

I wouldn't be surprised by this.  I believe that this is the original 
import of the picture -- so it wouldn't be a very significant delta if 
it is one at all.

 > Does any of this help you debug it further?  (I'm not saying we
 > shouldn't look at your repository too, of course, but if you can make
 > some progress on it, that's a valuable parallelization -- so please
 > understand that I'm not saying "talk to the hand"! :-).  I hope the
 > above link helps.

Yes, I'll try this stuff recommend by you and Greg tonight and see what 
I can come up with.  I realize that this will be hard to debug as I 
don't have the original file, and the revision files are so large.

 > How big is your total repository?

Approximately 12 GB.  If you're bored and want to read how I'm using 
subversion for my photos, I've written about my complete work flow here: 
http://gould.cx/ted/blog/Photography_Workflow.html  The larger revisions 
tend to be about 500 MB as I have a 512 MB flash card for my camera :)

Greg Hudson wrote:
> On Mon, 2005-08-22 at 23:51 -0700, Ted Gould wrote:
>>I sent this message the user list on Friday, but I believe that may
>>have been the wrong list.
> 
> That's the right list for this sort of problem, but your problem is deep
> enough that only a couple of people are qualified to look into it
> without studying up, and one of them (me) doesn't read the user list.

Okay.  If you want me to move this thread, just say so.

> The problem seems to be within the delta itself.  Chunk 30 or so, at
> offset 3073127 into the delta, contains instructions which produce
> 100675 bytes when they are supposed to produce 102400 bytes.

This is odd to me, as I believe that this is a direct import of the 
picture.  I don't know anything about the Delta format, but it seems 
that there should be very few instructions at head of each chunk.  More 
of a "just use this data" type command.  Could this command be changed? 
  Loosing one macroblock in the JPEG would be better than loosing the 
whole image.

>>2) Assuming I give up on ever seeing img_5633.jpg again, how do I get
>>my repository back online?
> 
> If there are no derivatives of img_5633.jpg, then you can resolve this
> problem through very delicate surgery.  The following seems to work:
> 
>   * At offset 125184612 in the file, change the word "DELTA" to "PLAIN".
> 
>   * In the metadata, where it says
> 
> text: 671 125184612 3924753 3922699 9112d223ba3e88b19e846e429f0ef361
> 
>     change that to:
> 
> text: 671 125184612 0 0             d41d8cd98f00b204e9800998ecf8427e
> 
>     where the spaces are important.  The length of the line cannot
> change, since FSFS relies heavily on offsets into files.
> 
> That will morph img_5633.jpg into an empty file.

I will definitely try this.  Loosing one picture is much better than 
having a non-working repository :)  I couldn't find any other references 
to this file in later revisions, so I think this will work out.

>>3) Is this a bug?  Any other data that you need?
> 
> Well, I can see two possibilities:
> 
>   * There is a bug in our binary delta code.  This would be pretty
> surprising, but it's a possibility.  Unfortunately, the way to look into
> this would be to take the original img_5633.jpg and see if the problem
> can be reproduced by checking it in.  If that file is gone, it's hard to
> see a way forward.

Unfortunately this seems to be the case.  I thought I might have the 
file somewhere, but it seems that I don't.  I'm worried though, that 
this might be the case of where the problem is coming from.

>   * The rev file was subtly corrupted during or after its creation by
> something other than Subversion.  Usually such corruption manifests
> itself as a large swath of 0 bytes, which is not the case here.

I don't believe this is the case as I have checked 3 backups that are 
identical.  Ofcourse, there is an amount of time where the file existed, 
but wasn't backed up, so I can't prove it.


Where is the documentation of the delta format?  I know it must exist, 
but I can't seem to find it.  This is a WebDAV thing, right?

	Thanks for all your help,
		Ted

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Ted Gould <te...@gould.cx>.
Greg Hudson wrote:
> On Tue, 2005-08-23 at 22:03 -0700, Ted Gould wrote:
> 
>>Hmm, that didn't seem to work.  I still get the "svn: Delta does not
>>fill the target window" error.  It seems that the error happens in
>>checking if the sizes are the same -- so do I need to know the 'actual'
>>size of the delta?  (i.e. 0 is not equal either)
> 
> 
> Did you forget to change the relevant "DELTA" to "PLAIN" as I mentioned
> in the first bullet point?  You didn't quote that part.

Yup.  Sorry about that.

		--Ted


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2005-08-23 at 22:03 -0700, Ted Gould wrote:
> Hmm, that didn't seem to work.  I still get the "svn: Delta does not
> fill the target window" error.  It seems that the error happens in
> checking if the sizes are the same -- so do I need to know the 'actual'
> size of the delta?  (i.e. 0 is not equal either)

Did you forget to change the relevant "DELTA" to "PLAIN" as I mentioned
in the first bullet point?  You didn't quote that part.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by Ted Gould <te...@gould.cx>.
On Tue, 2005-08-23 at 14:01 -0400, Greg Hudson wrote:
>   * In the metadata, where it says
> 
> text: 671 125184612 3924753 3922699 9112d223ba3e88b19e846e429f0ef361
> 
>     change that to:
> 
> text: 671 125184612 0 0             d41d8cd98f00b204e9800998ecf8427e
> 
>     where the spaces are important.  The length of the line cannot
> change, since FSFS relies heavily on offsets into files.
> 
> That will morph img_5633.jpg into an empty file.

Hmm, that didn't seem to work.  I still get the "svn: Delta does not
fill the target window" error.  It seems that the error happens in
checking if the sizes are the same -- so do I need to know the 'actual'
size of the delta?  (i.e. 0 is not equal either)

	Thanks,
		Ted


Re: Subversion FSFS corruption

Posted by Greg Hudson <gh...@MIT.EDU>.
On Mon, 2005-08-22 at 23:51 -0700, Ted Gould wrote:
> I sent this message the user list on Friday, but I believe that may
> have been the wrong list.

That's the right list for this sort of problem, but your problem is deep
enough that only a couple of people are qualified to look into it
without studying up, and one of them (me) doesn't read the user list.

> I'm not entirely able to make out the file format in the FSFS repository 
> files, but I think this is the metadata for the file with the error:

http://svn.collab.net/repos/svn/trunk/subversion/libsvn_fs_fs/structure
describes the format.

> text: 671 125184612 3924753 3922699 9112d223ba3e88b19e846e429f0ef361

The third number (3924753) is the length of the delta.  I downloaded the
file overnight and looked; the delta seems to be of the right length
(that is, 3924753 bytes after the beginning of the delta is an "ENDREP
\n").

> svn: Delta does not fill the target window

The problem seems to be within the delta itself.  Chunk 30 or so, at
offset 3073127 into the delta, contains instructions which produce
100675 bytes when they are supposed to produce 102400 bytes.

> 2) Assuming I give up on ever seeing img_5633.jpg again, how do I get
> my repository back online?

If there are no derivatives of img_5633.jpg, then you can resolve this
problem through very delicate surgery.  The following seems to work:

  * At offset 125184612 in the file, change the word "DELTA" to "PLAIN".

  * In the metadata, where it says

text: 671 125184612 3924753 3922699 9112d223ba3e88b19e846e429f0ef361

    change that to:

text: 671 125184612 0 0             d41d8cd98f00b204e9800998ecf8427e

    where the spaces are important.  The length of the line cannot
change, since FSFS relies heavily on offsets into files.

That will morph img_5633.jpg into an empty file.

> 3) Is this a bug?  Any other data that you need?

Well, I can see two possibilities:

  * There is a bug in our binary delta code.  This would be pretty
surprising, but it's a possibility.  Unfortunately, the way to look into
this would be to take the original img_5633.jpg and see if the problem
can be reproduced by checking it in.  If that file is gone, it's hard to
see a way forward.

  * The rev file was subtly corrupted during or after its creation by
something other than Subversion.  Usually such corruption manifests
itself as a large swath of 0 bytes, which is not the case here.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Subversion FSFS corruption

Posted by kf...@collab.net.
Ted Gould <te...@gould.cx> writes:
> I sent this message the user list on Friday, but I believe that may have
> been the wrong list.  Quick summary, I have a repository that appears to
> have had a Delta put in incorrectly.  Now the repository is unworkable.
> I'd like to be able to fix the repository, but in the case that
> subversion has lost my data, I'd like to get the repository working
> again.

Thanks for forwarding the message here...

> I seem to have a corrupt SVN repository.  I have checked several backups 
> and I believe that there is not a disk error, but actually a subversion 
> error has occurred.  Let me show you the simplest way to get this error 
> in my repository:
> 
> $ svnadmin dump -r 671 --incremental /home/ted/.svn_data/PhotosFS/ > 
> /dev/null
> svn: Delta does not fill the target window
> 
> I'm using a filesystem backend and Ubuntu Linux.  The version was 
> created in June, so I'm not entirely sure which version of subversion I 
> was running at that time.  I believe it was in the 1.1.x series.  I 
> found this as I now have a new hard drive, and I copied over the 
> repository and I am trying to create a new working copy.  The checkout 
> fails when trying to restore img_5633.jpg from version 671.  I don't 
> have an original copy of img_5633.jpg to compare against, but I'm 
> working on getting that.
> 
> I believe that there are no other versions that have this error in my 
> repository.  Here is how I checked:
> 
> $ perl -e "for (\$i = 672; \$i < 725; \$i++) {system(\"svnadmin dump -r 
> \$i --incremental /home/ted/.svn_data/PhotosFS/ > /dev/null\");}"
> 
> I'm not entirely able to make out the file format in the FSFS repository 
> files, but I think this is the metadata for the file with the error:
> 
> PLAIN
> K 13
> svn:mime-type
> V 24
> application/octet-stream
> END
> ENDREP
> id: 7ry.0.r671/469843979
> type: file
> count: 0
> text: 671 125184612 3924753 3922699 9112d223ba3e88b19e846e429f0ef361
> props: 671 469843913 53 0 113136892f2137aa0116093a524ade0b
> cpath: /Unsorted/65_Alaska/03_DenaliToo/img_5633.jpg
> copyroot: 0 /
> 
> I believe that one of the numbers on the 'text:' line is probably the 
> diff size?  Which one?  I'd like to determine whether the diff is too 
> small or if the number is.

Well, the fact that it says "PLAIN" at the beginning makes me think
it's not a delta at all, but a fulltext representation.  I'm getting
this from reading

   http://svn.collab.net/repos/svn/trunk/subversion/libsvn_fs_fs/structure

(Search for "Revision file format" to get to the relevant section.)

According to that document, the format of a "text:" line is:

  text      "<rev> <offset> <length> <size> <digest>" for text rep

Does any of this help you debug it further?  (I'm not saying we
shouldn't look at your repository too, of course, but if you can make
some progress on it, that's a valuable parallelization -- so please
understand that I'm not saying "talk to the hand"! :-).  I hope the
above link helps.

How big is your total repository?

-Karl


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org