🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #63717

Re: xBin and PARity files

#63717
From: Curt Welch
Date: Fri, 31 Jan 2003 02:43
446 lines
23882 bytes
Once again, a reply to a very old article when I haven't read the 50 other
aritcles in this thread so ignore my comments if you have moved past these
issues already - I'll get caught up at some point.

Rene <invalid@email.addr> wrote:
> curt@kcwc.com (Curt Welch) wrote:
> > In your post here, you seem to assume that each PXX file will cover the
> > entire xBin file - i.e. all the virtual segments.  I suspect that
> > assumtion is not going to work.
>
> Yes this is my base assumption. Anything else makes it more complex and
> is not desireable, imho.

It's true that it makes to too complex for the user to undersant what the
par data is "for".  i.e., he is missing article 1453 out of 4324 so which
par file does he need to download?  In your system, _any_ complete par fill
will do it.  In my system, only some of the par files can be used to repare
that part of the post.

But the complexity for the user is not important because the user won't
have to understand any of this anymore.  The download tool figures out what
par files to use on it's own and tells the user that the following articles
can be downloaded to fill in this much of the data.  They user just says
"yes do it", or "no, don't bother".

> > For one, if the external tools are limited to 128 files which they can
> > protect, then you will have to create virtual segemnts, and PNN files
> > which are a min of the xBin file size / 128.  A 2GB xBin will will then
> > need each PXX file to be 16MB.   That ends up being posted as 32 some
> > odd articles, of which 3 get lost, so how to you repair the lost
> > articles from the par files?
>
> We cannot protect PAR files from forgery and we especially cannot protect
> them from getting dropped by any server. This is simply the risk of the
> PAR files.
>
> A PAR-file is quite "strong" in the sense that one single PAR file that
> makes it through, can repair a gap of its size anywhere in the file. All
> you do on the client side therefor is seeing how many PAR's you will need
> and then try to get them.

But, if you upload 10 super-par files, each which must be broken into 32
articles (so you upload 320 par articles total), and some guy is on a
server which is missing 25% of the articles (which is very common), then
the odds of any of those 32-article par sets showing up complete is very
low (.75^32 or less than 1 out of 10,000).  So the guy ends up with 240 par
articles, all of which are useless to him.

With my way, he ends up with 240 par articles, all of which can be used by
him if they help complete a section of the file he has problems with.  And
with a 75% loss rate, he's probably going to be able to use all those par
articles.

> > data has to scan the entire 2GB file.  And depending on how clever to
> > tool is, it will probably end up scaning the entire 2GB file for every
> > virtual segment it has to recreate.
>
> Well when you attemp to repair a file using the PAR-system, you have to
> touch every single byte in the file anyhow. (The existing ones will be
> read, the missing ones will be read out of the PAR-file and written to -
> of course there's calculation too)

With the system I propose, that's just not true.  I'm talking about being
able to send a PAR file which just covers article 100 to 200 in a 5000
article set.  If you are missing article 128, then all you need to fix it
is one of the 100-200 range PAR articles, and to fix it, you only need to
read all the data in the range from article 100 to article 200.  You don't
need to read the entire file.

However, in your system, that's kinda the same as well.  If you "virtual
segments" spanned 100 articles in this example, then your par files would
take 100 articles to post.  If I was missing only one article (say 128),
then to repaire that, I could download an entire 100 article super-PAR
file, but I would not need to use all of it.  I would onlu need to use
article 128 out of the PAR file, and it would cover bytes in article 128,
228, 328, 428, etc.  So those articles are also the only articles I would
need to read to reconstruct my missing article.

My main point is that it's stupid to make someone download a 100 article
super-PAR, when all they need was one article out of that super-set.  We
need to create a par system to they can identify that one article (or two
if it's not aligned correctly), to download instead of having the download
the entire super-PAR set.

I really wish I was standing in front of a white-board so I could draw
pictures here....

> > > +-----+-----+-----+-----+-----+-----+-----+
> > > | A1  |  A2 |  A3 |  A4 |  A5 |  A6 |  A7 |    articles
> > >  o o o x x x x x x x x x o o o o o o o o o   <--- xBin blocks
> > > �      f1     �       f2    �      f3     �    virtual segments
> > > +-------------+-------------+-------------+
> >
> > This can work.  But it means you end up having to download a lot of
> > extra par data and do a lot of extra par calculations.  If you above
> > example, if articles are 500KB each, the your virtial segments, and
> > each par file is 1.1MB each.
>
> Well, you can't get a half PAR-file. Either you get a full one or you
> don't have it. The problem is, yes at the edges there is some loss. It's
> still better than full-reposts or many reposts. But it is compatible to
> reposts. A newsreader can get reposts first, if it sees some, filling
> some more gaps and then starts to cry for PAR-data.

The big problem is not the edge-loss, but if the virual segments span a lot
of aritcles (say 10), then why make them download 10 articles to fix just
one missing article?  That is where the real waste comes in.

If you allow the poster to specify the PAR virtual segment lay-out in the
meta-data, then they can fit it to the post they are trying to help someone
repair and everyone will then be able to download the same amount of PAR
data as the data they are missing.  None of this 10 to one problem.  i.e.
downloading 10MB to repain a 1MB gap.

> > If the guy happens to be missing articles A3, and A10, both which span
> > virtial segments, he will need to "fix" 4 virtial segments, so he will
> > need 4 PAR files of 1.1MB each. So in order to fix 2 missing 500KB
> > articles, you are asking him to dowlonad 4.4MB of par data.  No one is
> > going to like that.
>
> Yes, it would be clever if virtual segments span complete article
> boundaries. But that's not going to be. Article size will be arbitrary
> and can change. Actually with the algorithm posted for article-size
> levelling, we are even doing this for one single poster. But xBin is
> designed for and works with several posters, all sending the file with
> different article size.
>
> Look at PAR-files for "bulk-repair". Fine fixes can be done easier with
> reposts. But reposts are place-specific whereas PAR-data is not.
>
> > And, because your par files are split across multiple articles, you
> > risk losing one of those articles and having once again wated usenet
> > bandwidth for some sites who have unuseable segements from another
> > multipart post.
>
> Yes. That's the risk. But the number of PAR files is usually quite lower
> than the number of reposts. Combining both methods should get the best
> out of this, that's why I propose inclusion of PAR-technology into the
> xBin standard.
>
> > I would propose always using "virtual" segments that can fit in a
> > single arictle.  This way, the PAR files will always be posted as a
> > single article, and if some are lost, no harm is done.  You just have a
> > few less par files to work with.  Each par article will still remain
> > useful.
>
> That will limit the size of PAR-files downto 1MB max, preferably
> something in the range of 300KB. This then increases the number of
> virtual-segments over 256 for any file > 75MB.
>
> Doable if we can increase the wordsize of the RS-algorithms to 16.
> However the assumption of PAR-data being as big as an article max means
> that usenet is very bad with completion. But its not really THAT bad, is
> it?
>
> I look at PAR-data as "bonus"-data. Fetch some if you can and need some.
>
> > And, because I think forcing the PAR repair tool to scan the entire
> > 10GB file to replace a few missing 500KB sections is going to be
> > unreasonable, (even more so when you find out the PAR was forged and
> > has given you crap after all that work downloading it and wiating 20
> > minites for the repair tool to do number crunching over 10GB of data),
> > I think we are going to
>
> If you do a repair attempt, you must go through the whole file, no matter
> how small the gap(s) is. That's why I say for small filesizes/gaps,
> reposts are better.
>
> > have to limit the range of virtial segments each PAR article will
> > cover. So you might divide the huge xBin file into virtual segments
> > which each cover N hash blocks (virtial segements should align with
> > hash blocks I think).  If the hash block size is 22500 like we have
> > talked about, and you wanted to post 400Kish par files, then you could
> > use a virtial segment size of 18 hash blocks.  You could them post a
> > set of par articles, P01, P02, P03 etc which cover the first 100
> > virtial segments in the file (40MB of data), and another set of hash
> > files for the next 100 virtual segments, etc. as required, for the
> > entire file.
>
> Uh this adds a layer of complexity without giving much in return. The
> power of the PAR-data comes from the fact that they fix any segment
> anywhere in the file. Now this power is lessened if they are
> "range-locked". Additionally we need to clearly define which range which
> PAR-file is for and a newsreader needs to do the same for its gaps.
>
> Also when the PAR data spans the full file, then after a repair attempt,
> you can scan the file, calculate the hashes and then you know instantly
> if everything went right, because if so, you can recalculate the
> hash-tree and you will land at the root. When this falls away because
> PAR-files are range-locked, then you end up with having not all data to
> recalculate only these ranges. It is still an all or nothing thing: You
> need to have all the PAR-data for all the ranges with gaps until you can
> start the fixing AND verifiy it.
>
> > > To distinguish such a parity file from a normal part of an xBin file
> > > however, there must be some change. One way to do that is to
> > > "overflow" the offset variable in the message-id of an xBin posting.
> >
> > Bizzare and not needed.
>
> Its just my first thought. I don't know the exact alphabet of identifiers
> you were already using so I didn't want to introduce my own which would
> might have caused collisions.
>
> > > What's also important is to give the sequence number of the parity
> > > data.
> >
> > Just add $P1$ in the xBin ID.  That not only gives you the needed
> > parity file sequence number, the presence of tthe $P field tells you
> > that this is parity data and not normal data.
>
> Yes, that's one way it could be easily done.
>
> > The segment size should be used as it normally is - it tells you how
> > much data is in the current article.  This however, for parity files,
> > becomes your "virtial" segment size because each parity article will
> > span multiple virtual segments of this size.
>
> Exactly.
>
> >    $H hash
> >    $S file size
> >    $o segment offset in hash blocks
> >    $s segment size in hash blocks
> >    $P parity sequence number
> >    $N number of segments spanned by parity data (100 in my example
> >    above)
> >
> > So, the data out of the full xBin file spanned by this parity data
> > would start at the $o offset, and would continue for $N blocks of size
> > $s. THis means the Message-ID for a PAR file will only have a few more
> > characters than a normal xBin articles.
>
> Should the message-id not contain only the hash ? This additional
> information is only relevant to xBin-compliant software which can get
> that out of the xBin-Signature header.
>
> I thought the data in the message-id is only there to make xBin posts
> easily findable. I wouldn't put more than the hash into the message-id.

The point is to put _everyhing_ in the Message-Id that the download tool
needs to decide if it wants the article.  That's what the above does.  Once
you do that, the ONLY thing a download tool needs to do is XHDR Message-Id
of all the articles in a group to decide what articles it needs.

If you don't put the other meta data into the Message-ID, what happens when
I'm missing 1 article of a 10,000 article post and someone reposts the
entire things?  My newsreader is going to have to a "HEAD" on 10,000
articles to figure out which of all those articles is the one I need.

By adding in the segment offset and size (and for PAR files the par
sequence number) the download tool _never_ had to do anything else besides
look at the message-id to figure out what it has to download to complete
the files it's looking for.  It can of course do a head or XOVER on the
article before downloading it to check thikngs like the size to make sure
it's valid and to make sure headers like X-Bin-Signature are there before
wasting the time downlaodting the full article.

> > Since we are re-using the $o and $s values, it would be very important
> > for all xBin applications to understand that the meaning of $P and $N
> > (even if they didn't support parity files) so they didn't mistake this
> > as a data segment).
>
> Yes. That's what I meant by having a xBin-compliant newsreader understand
> what a parity file is and what not.
>
> > But, then again, I guess that isn't as important because this data
> > won't pass the hash test so it would be rejected if the program was too
> > stupid to understand it wasn't meant to be file data.
>
> But shouldn't be downloaded if the software can't do anything with it
> anyways...
>
> > But here's the rub.  Articles get lost, not virtual segments.  And
> > though it's not all that hard for software to map the two, and figure
> > out which par files on the server are useful and which not, it means to
> > fill in holes, you end up haiving to downloading more par data than the
> > amount of "holes" you actually need to fill.  People having to download
> > will prefer reposts instead of par because the par system makes them
> > download more.
>
> Depends. At the end of the day, it's a social issue over which we have no
> influence. We can only make it as easy as possible. If I can get a Parity
> file now, which is larger but fixes my problem or wait for a smaller
> repost, I take the larger parity file. But then again I'm a low-volume
> downloader at your site, where your volume-limit for me simply means
> "infinite"... others may have to be more conservative.

Sure, and even in my system, if the par files were created to fix a
different post than the one I downloaded most my data from, then I will
have the same problem of par files which do not align with my gaps so I'll
be forced to decide if I want to download 2X more than I need to fill in my
gaps.  But, the more important question is why not allow the PAR files to
at least match the last post so you do get a 1-1 download issue instead of
a 10-to-1 question.

> > For the above example, you post one set of par files, which span only
> > the first 20 articles - because they are all the same size.  Then you
> > post other par files which span the last 14 articles, because they are
> > the same size, and then you just repost the last fill if needed and
> > don't try to cover it with par data.
>
> So effectively you are saying we should split the one xBin file into
> files depending on the different article sizes and then treat it as three
> files (from your example?) If so, we would then get three different "P01"
> parity files for the same xBin file (ie we'd get three parity-sequences).
> This could all be hidden from the user, but its a complexity-increase
> that must be handled at the newsreader software.

Right.  It would make it far too complex for the user to figure out which
par files he needed.  It would have to be automated.  But that's the entire
goal of this in the first place.  The tool just tells the user "if you
download this N GB of data in Y articles, it will compelete the file you
are trying to get, should I do it?".

> > So, if you post a set of articles each with this number of hash blocks
> > each:
> >
> >    20 20 20 20 20 19 19 19 19 19 19 19 19
> >
> > You can then post par files of size 20 for the first 5 articles, and
> > par files of size 19, which cover the last files.  And then the par
> > files exactly match the data they are replacing, and if you are missing
> > 19 blocks of data, you only need to download 19 blocks of par file to
> > replace it.
>
> Yes. But what happens if a xBin posting is expiring and someone other
> fills in with a different article size? Oh the mess ! Fixing the Par-size
> on article size is no solution in my eyes.

Then it reverts to your problem which as you point out, is not a problem.
The software just have to figure out what it needs to download and do it.

> > If you have N files missing, then you need N par files to replace them.
> > But, to generate even one missing file, you will need to use all N of
> > your par files. If you have 5 files missing, one par file alone is
> > useless and tells you nothing.  Once you collect 5 par files, then you
> > can try to generate the data.  As you generate each missing file, you
> > can attempt to check it aginst the parts of the has tree you happen to
> > already know.  But, depending on alighment with other missing blocks,
> > you
>
> No that's not possible. You can't use 3 out of 5 PAR-files to repair "a
> bit".

That what I just said above.  You need all 5 par files before you can
repair anything.  I understand that.

> It is really an all or nothing thing. You can repair, or you can't.
> But you cannot repair a bit. Or repair only the first gap.
>
> Look at it as the virtual segments taking up space as columns. If you
> repair you don't repair "from left to right", ie a vertical line starts
> to grow from left to right. But you repair with a "horizontal line" which
> slowly grows from top to bottom.
>
> Or to put it another way: If you have 4 gaps and four parity files and
> you'd stop the repair-process 3/4 through, then all the 4 gaps would
> contain 3/4 the correct data but would be empty in the last 1/4.
>
> > may not be able to reject it or to prove it's all valid.  So the
> > application will be forced to support the idea that blocks have been
> > "repalce" but the quality is still unknown.  So you have to continue to
> > reclaculate missing data not knowing if the work you are doing is a
> > waste of time, or not.
>
> Yes, but if the PAR-files span the whole file, you can recalculate the
> hash-tree, and arrive at the file-hash or not, telling you if it was
> successful or not.
>
> > And, with these par files which do not cover the entire file, even if
> > you have all the par files you need to reproduce the articles you are
> > missing from posts 21-35, and go ahead and reproduce the data, you may
> > still not be able to prove or dis-prove that the the articles you
> > generated or the par files they came from are valid because you may not
> > have the parts of the hash tree you need to figure that out.
>
> Yes. Another added complexity issue.

It's not really any different than your approach.  In the end, you need
enough PAR data to reconstruct the entire file before you know for sure
that all the PAR data is valid.

> > So, my point is this, if you are woking on a huge file 20GB which was
> > posted as 40,000 500K articles, and you missed a total of 500 parts,
> > but you found and downloaded 500 par files to fix all those holes (and
> > you have been working on getting this complete file for months), you
> > can't know for sure if any of those 500 par files are corrupted or
> > fakes, until you fill in all the 500 missing parts and then verify the
> > entire hash tree.
>
> Yes.
>
> > No one wants to find out a month later that the par file they grabbed
> > was bogus, but that another one posted 2 weeks ago that they didn't
> > bother to download because it was a duplicate, was in fact the real one
> > they needed.
> >
> > So I think we need a little more help being able to identify bogus par
> > files.
>
> I see no easy way in doing this. Because anyone having the full file
> should be able to produce PAR-files, not only the original poster.
>
> > But, here's an idea.
> >
> > If we include an X-Bin-Signature for each par file which is the same
> > signature you would put on an article spanning the entire par-set, you
> > would then have the hash values you need to veryify the entire par-set
> > once it was re-constructed (i.e. the 100 article set).
>
> Yes, but we possibly don't even want the entire PAR-set, I might only
> need one single PAR-file. Forcing someone to download an entire set of an
> arbitrary length just to be sure is even more wasteful.

I think you missed my point.  I was just talking about what you would but
in the signature of a PAR file.  If the PAR data coverd 100 articles, then
the signature you need to use in that single PAR article, would be the same
signature you would place in a data article which were those 100 articles
combined.

I really need that white board...

> > Maybe there is a way to prove that par data is valid and we just
> > haven't thought about it yet.
>
> Possible, but I simply see no easy way at the moment for this problem.
>
> > The larger the range of articles you cover with a par file, the more
> > likely multiple par files will be needed, and the more likely a bogus
> > or forged par file is going to screew things up.  So the answer may be
> > to use smaller article ranges if you are having problems with corrupted
> > or forged par files.
>
> Not necessarily, the range of par files does not matter. The completion
> of the original xBin file does. If it is complete I will never need a
> par-file. If only one article out of it got lost, I will only need one
> par-file. If more than one article got lost, then it depends on how many
> virtual segments the gaps are spanning.

Yeah, I don't think you are seeing my point.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20030130214337.749$eF@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.maxwell.syr.edu!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <20021230133312.202$K5@newsreader.com> <20021230171837.399$Im@newsreader.com> <20030103212914.998$3s@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <20030130214337.749$eF@newsreader.com>
Subject: Re: xBin and PARity files
Date: Fri, 31 Jan 2003 02:43:37 +0000
From: curt@kcwc.com (Curt Welch)
References: <20021230133312.202$K5@newsreader.com> <20021230171837.399$Im@newsreader.com> <20030103212914.998$3s@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news.maxwell.syr.edu!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com 4@VQcQRmqw0bGRo/2O1w3Q-u3OltZwM+fcfRAlxL41xl_V
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
  %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 445