FirebirdSQL / firebird

Firebird server, client and tools
https://firebirdsql.org
1.26k stars 217 forks source link

Fix refetch header data from delta when database in backup lock #8268

Closed XaBbl4 closed 1 month ago

XaBbl4 commented 1 month ago

If for dbb_sweep_interval this is not so critical, then for dbb_repl_sequencethis can damage the replica, since the segments will be saved with the old number (saved in the main header at the time of transition to the backup lock state) after each clean connection to the database.

Simple example for dbb_sweep_interval:

1 console - run isql 2 console - operations with gfix

1> create database 'test';
2> gfix -h 500 test
1> select mon$sweep_interval from mon$database; commit;
MON$SWEEP_INTERVAL
==================
               500
1> alter database begin backup;
2> gfix -h 1000 test
1> select mon$sweep_interval from mon$database; commit;    -- without reconnection to DB
MON$SWEEP_INTERVAL
==================
               1000             -- CORRECT
1> quit;
1> connect 'test';
1> select mon$sweep_interval from mon$database; commit;    -- after reconnection
MON$SWEEP_INTERVAL
==================
               500              -- WRONG (in delta file dbb_sweep_interval = 1000)
livius2 commented 1 month ago

What about other flags?

XaBbl4 commented 1 month ago

What about other flags?

As far as I can see, the other flags do not change after begin backup. There are some doubts about the HDR_crypt_... flags, but they are also not read in PAG_init2, which requires refetch.