Subject Re: [Firebird-Architect] Re: [Firebird-devel] New backup technology
Author Nickolay Samofatov
Hello, Ann,

>>2. Each page has SCN (System Change Number) that is used to do
>>incremental backups and during merge of changes from difference file
>>(writing to main database file is allowed during merge)
>>
> Each page already has a generation number on it, though it doesn't have
> its page number.

Generation is not useful for us. Page number is not needed actually.
We need database-global SCN counter to mark all modified pages with.
It is very convenient to use for incremental backups.

>>3. Difference file consists of pointer pages located at regular
>>intervals and redirected pages in (almost) random order. Page allocation
>>tables are cached in memory for each CS process (this is how it works
>>now, v.2.0 is planned to have new shared memory infrastructure so this
>>may be improved in non-clustered case).
>>
> Let me see if I understand how this works. You lock the database and
> start writing changes to a difference file - that file has some sort of
> pointer mechanism so if you're looking for page 15, you go to pointer 15
> and if the page is in the difference file, you'll find its offset. When
> the difference file is in use, every transaction must check the
> differences first, then the regular database. Right? When the copy is
> done, you unlock the database and users make their changes directly to
> it again, though they need to continue to check the difference file.
> You start applying the pages from the difference file to the database.
> Before applying a page from the file to the database, you first check
> the generation number. If the database page has a higher generation
> number, then you skip writing from the difference file and drop that
> changed page on the floor. When you've emptied the difference file
> everything goes back to normal.

Exactly.

>>BTW, I can implement both approaches - locking main file for changes
>>to exploit OS-level tools and logging old pages into difference file
>>when NBACKUP is used. This doesn't change the implementation significantly.
>>NBACKUP needs a kind of Media Manager anyway.
>>
> Apparently I was either unclear or completely dunderheaded. For the
> shadow type backup, you log new changes to pages that have already been
> copied, not the old state - that's already there and wrong. You end up
> with a copy that's current as of the time it finished, not when it started.

Ok, that was what Mark and others offered in Fulda. Keep old pages,
not new ones in a difference file.

> Ann

Nickolay Samofatov