|Subject||Re: [firebird-support] Dump blobs from GDB File - Part II|
> Let me see if I can be more clear. All blobs have some level 0 data.OK Ann that's what I understood :
> That may be on a data page (if it fits), or on one or more blob pages.
> If the level 0 blob is stored on blob pages, then there is a level 1
> blob that contains an array of the page numbers for the blob. The
> level 1 blob is also stored on a data page unless it is to large to
> fit. If it is too large, then there is a level 2 blob that contains
> an array of the page numbers of the level 1 blob pages.
> The blob id stored in the record has the same format as a db_key. It
> decomposes into a relation id, a pointer page sequence number, an
> offset on the pointer page which contains the number of the data
> page, and an index on the data page.
> So the record MUST point to something on a data page.
level 0 blobs are blobs datas :
if they fit in the datapage they are stored in the datapage else
they are stored in a blob page and a level 1 blob is build to index
all the level 0 blobs pages.
level 1 blobs are pointers on level 0 blobs
the level 0 blobs are always stored in blobs pages
if there are to much pointers to fit in a datapage
a level 2 blob is build to index all level 1 blobs pages
level 2 blobs are pointers on level 1 blobs pages
they are always stored in a datapage and
the level 1 blobs are always stored in blobs pages pointing on
level 0 blobs that are always stored in blobs pages
>> Now I can read blobs level 0 from data pages. Great :) But I'veThat's doesn't works because i didn't read the blob pages in the right order. You cannot "scan" the whole pages of the database extracting the blobs that are in blobs pages. You must scan the datapages, detecting level 1 or level 2 blobs to get the blobs pages in the right order.
>> tested my dump tool on a functionnal database and with a SELECT
>> COUNT(*) FROM TABLE I get 123326 records (with a blob per record).
>> With my tool I'm able to retrieve 121572 interesting blobs either in
>> blobs pages or in data pages (level 0). Does that mean that there
>> are 2000 blobs with level 1 or 2 stored elsewhere ?
> No, I don't think so. My guess is that you're missing some blobs on
> data pages, but maybe not. Finding more blobs than records would make
> sense if some blob were multi-page and got counted twice. But fewer
> doesn't make a lot of sense to me. Perhaps asking the question again
> in slightly different way would help.
Next question : What are "Stream Blobs" ? I saw that some of the metadatas are stored in this kind of blobs but I don't understand why.
Really thanks, If anybody is interrested in my delphi code (an object that can walk over the full database raising events when a page is found or when a blob is found so that you can do practically whatever you want)... ask me :)