Article View: news.software.nntp
Article #62589Re: xBin and PARity files
From: Curt Welch
Date: Mon, 30 Dec 2002 22:18
Date: Mon, 30 Dec 2002 22:18
396 lines
21068 bytes
21068 bytes
Rene <invalid@email.addr> wrote: > As of this time's writing, I'd go with a fixed size for this virtual > segment of about 10MB. This would lead to people using normal reposts for > small files but using the par-system for larger files. There's the complexity that par files are limited to the number of virtual segments they can cover depending on the word sized used in the RS algorithm. I belive, but do not know, that all the current tools out there use 8 bit words and therefore limit the number of files/virtual segments which can be proteced by the par data to something like 128 or 256. 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. 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? Also, to generate a missing virtial segment using par data, you have to scan and do calculations over all the virtual segments protected by PAR data. So if you have a 2GB file, the program to reconstruct the missing 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. I suspect this is going to be unworkable for very large files. > But how should a newsreader react if the virtual segments does not match > (align) with the downloaded blocks? Ie consider the following picture: > > +-----+-----+-----+-----+-----+-----+-----+ > | 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. 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. 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. 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. 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 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. The download tool then needs to figure out how many par files are needed for each 100-segment block based on how much data is missing from each. > Header of Parity Data > ===================== > 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. > 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. 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. Since I propose the parity files not spaning the entire xBIn file, you need to also specify which virtual segments this parity file does span. I suggest you do it using the same offset we use for real data, and then adding a repeat count. So a normal data segment has this data: $H hash $S file size $o segment offset in hash blocks $s segment size in hash blocks A parity file could have: $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. 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). 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. Article alignment.... 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. You can post par files which match the orginal article split, but, because we are talking about trying to keep all the articles in a set as close the same size as possible, the articles will in fact not be the same size. The first 20 articles in a 35 article set might be 20 hash blocks each, and the next 14 19 hash blocks, and the last one 20 hash blocks. And I was thinking this would really mess up the par system because you can't pick virtial segment sizes which match this article split. But as I write this, I see the obvious answer. 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. This way, the above simple system of defining par files as covering a consecutive range of fixed sized virtial segments, can be nicely matched to the files which were posted even though the split sizes were selected to equalize the file sizes and cause them to have different sizes. 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. And if you make the last file the same size (19 above), instead of making it 20 like we have talked about to beter equlize the article sizes, then the par files work even better. > Security > ======== > Therefor, for the secure operation of xBin with parity, an xBin compliant > newsreader MUST check the hash tree after each attempt at parity repair. > That way, problems are detected and a corruption of the file is not > possible. Good idea. But it has problems that I think we need to figure out. 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 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. 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. 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. 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. The fact that the entire 20GB file is broken into rantges of 100 articles each covered by it's own par files, helps. But, because of the hash tree alighment, you may not have the hash values you need to verify that single 100 article block. 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). So, you pretend that the entire 100 article set is being posted as one huge article, and the X-Bin-Signature that would be generated for that huge article, is the one you include with each par file that covers that huge segment of data, then will know for sure you had the hash values you needed to verify that segment of data once you filled in all your holes. So, for the 500 par file example above, it would limit the problem into dealing with each 100 article set. So, if out of the 500 par files you had, 1 was broken or otherwise bogus, then that 1 bad par file would only mess up the articles form one 100-aritcle range of that 40,000 article post. However, if someone trying to attack the post, posted multiple bad par files for every 100-article set, you would still be screewed, beause you have no easy way to know which of the 10 par files you got for that 100 article set are the fakes, and which are the good ones. If you need only 5 par files, and there are 20 par files posted, you can download all 20 of them and try them 5 at a time, but that sucks, beause it would take forever for the software to automatically try this. If you manually look at the par files, you could see that some came from one place and some seemed to come from another (looking at the path), so you could try using only par files from one place vs the other in a gess that the bad ones all came from the same source. But this requires manual intervention, and xBin is all about preventing that. Maybe there is a way to prove that par data is valid and we just haven't thought about it yet. > And if a corruption is not possible, attackers probably don't take up the > effort to even create fake-parity data, even though they could. They can't corrupt the valid data you downloaded, but they can corrupt all the other par files from the same set because all the par files become useless once you get one bad apple and have no automatic and computationaly "reasonable" way of identifying it. But, I guess, the smaller the par-file-sets you cover with each par file, the more reasonabl it becomes. If you generate a 1 par file for each 5 aricles posted instead of 20 for each 100, then you are likely to only need 1 par file to fill that 1 hole, and you will then (with the X-Bin-Signature from the par file) have evertyhing you need to verify the data after you generate the 1 missing file. 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. The smallest case is 2 articles covered by one par file, and with that, if you have one valid article, and one par file from the range, then you just generate the missing article in the par and verify it to prove or dis-prove the quality of the par file. Ok, I think this will work then, and the more a group is under attack, the smaller the range of par files they use, and it's under real heavy attck, they just stop using par files and only post fills. > There's an easier way than that ! [making the newsreader generate standard data and par-files for use by standard external par utility]. That will work even better when you limit the range of data each par file covers, because instead of splitting up a 20GB file into who knows how many files for the par utility to mess wtih, you only need to deal with the limited range of data which the par file covers. So if the xbin par files cover 20 200K posts, you just generate 20 files, and the N par files, use the external utility to fill in the gaps, and then make the newsreader check the generated fills for validity. You then remove all those external files, and go on to the next without every haivng ot so an exta 20GB of disk space just to replace 1 200K lost article. > Problems: Two users having the same file may have different file names, > so > if those each create some parity files, they won't be able to fix data > because their meta-data does not match. So we chose as "basefilename" for > the split files the file-hash in an appropriate encoding (base64..) The newsreader needs to hide all that. It would need to understand the xBin par file layout and know how to geneate the tmp files and the par files and make up the correct metadata to point to the tmp files. But, this may be so much work and so much knowledge of of par files that it won't really help simply the job for the newsreader. Here's another option.... If we were to define a standard disk format for saving partially downloaded xBin files which includes the data and hash data, then we could create either a complete par tool to work on that data (hack some of the current PAR utilities?) or just a data extraction tool which reads the xBin data files and produces the par files which the current par tools could use. If we had either of those tools available, then the newsreader authors would only have to store the xBin data (and the downloaded par data) in that standard format and the external tools would deal with the par problems for it. Having a standard disk-format for partially downloaded xBin files might be good for other reasons as well - but it might get very complex very fast when we look at how much information the newsreaders might want to store in these type of files and how much some newsreaders would not want to bother with. For example, you might bundle all the data into a directory with a common name, such as a hex version of the full 160 bit file-hash. (or XB-9A8700BD51F etc). Then in that directory, you have data segments where the file name is D-OFFSET where OFFSET is a hex offset value. And parity data files named P-OFFSET-P-N (the size of the file defines tells you the segment size for both of those). where the second P is the parity file sequence number and N is the number of virtual segments the data spans. Then you add a file to store all the known and verifyed hash tree data. Maybe something like this is all we needed. The newsreader can create and store additional files if it wants to keep additional meda-data (dates, download times, which server the data came from, the article headers from the orginal articles, the orignals articles, etc etc). But if we cerated a PC tool to go though that directory and fill in holes using the parity files then the job of the newsreader gets easier. Ah, but putting 40,000 files in one directly is an issue if you are dealing with a huge file.... Maybe the answer is for the newsreader to combine data segments whenever it can. So instead of ten files for blocks 1 to 100, it would be combined into one file where the name showed the correct offset and size for the whole thing. > So now we're really at the end of my parity with xBin excurse. Comments? > Additions? Corrections? > > I *really* vote for the inclusion of Par-technology into xBin, and into > xBin v1.0, not later. Yeah, me to. > We really only need to define a new header-set, describing PAR files and > their sequence number as well as the "virtual block size". At least, > that's what I think is needed. I think we only need a $P and $N added to the mesage-ID and use the Signature like I described. And the data encoded in the PAR file is pure RS data with no meta data. How to encode that is an issue though. If uuencode, what's the name to use on the begin line? and for yEnc, does it look just like one small file (I guess that's the answer), so then we just need to figure out what name should be used for the file. The name is not real improtant, but it wouldn't hurt to figure out something and specify it as the name. I guess it would fit with type type of stuff I was talking about above, It could have a name which was something like 982761DF-2-A2.XBP where the first hex number is the offset, the 2 is the parity sequency number, and the A2 is the count of blocks spaned by this PAR file. Using P02 would probably be wrong since the data would not be a valud standard PAR file and would not attemnt to include the typical PAR meta-data inside the file. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20021230171837.399$Im@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!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<20021230133312.202$K5@newsreader.com>Show Full Headers
Complete Article Headers
Message-ID: <20021230171837.399$Im@newsreader.com>
Subject: Re: xBin and PARity files
Date: Mon, 30 Dec 2002 22:18:37 +0000
From: curt@kcwc.com (Curt Welch)
References: <20021230133312.202$K5@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!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com xqFeCFM5d5XnO2g4JFq@Z+2i3w074qSDP89Z9fM5/oT86@s
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: 395