Subject Re: [firebird-support] Using DB while nbackup -N is running
Author Kjell Rilbe
Paul Vinkenoog skriver:
> This is from the original description by the developers (main developer
> was Nickolay Samofatov):
> ===
> The backup state cycle is:
> nbak_state_normal -> nbak_state_stalled -> nbak_state_merge
> -> nbak_state_normal
> * In normal state writes go directly to the main database files.
> * In stalled state writes go to the difference file only and the main
> files are read only.
> * In merge state new pages are not allocated from difference files.
> Writes go to the main database files. Reads of mapped pages compare
> both page versions and return the version which is fresher, because
> we don't know if it is merged or not.

I don't quite understand this, and perhaps I'm beating a dead horse...
But... I just want to get a grasp on how this works... :-)

I assume "mapped pages" are pages that were updated during stalled
state, and thus have a newer version in the delta than in the main file.

Do I then understand correctly as follows:

1. Main file contains page rev 1.

2. Page is updated during stalled state, resulting in page rev 2 in the
delta. Main file still contains rev 1.

3. Merge starts.

4. Page is read in order to make changes to it. This will read rev 2
from the delta since that's the newer one.

5. Page is changed and then written to main file, resulting in rev 3
there. Delta still contains rev 2.

6. Page is again read in order to make further changes to it. This will
read rev 3 from the main file, since this is the newer one.

7. Page is updated and then written to the main file, rev 4. Delta still
has rev 2.

8. Nbackup reaches this page in its merge operation, notices that the
main file has a newer rev and discards rev 2 from the delta. (Perhaps it
has already been marked as outdated?)

9. Merge finishes.

This would appear to work and be consistent with the quoted text above,
although I did find the text somewhat unclear.

Kjell Rilbe
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64