> On 04/07/11 11:00, Vlad Khorsun wrote:
>>     Right after CREATE DATABASE and until disconnect database works with 
>> actual FW=OFF,
>> despite of settings on header page. We specially didn't changed this to make 
>> restore fast and 
>> simple (no need to disconnect and no chance to lose exclusive attachment).
> 
> Always thought that this works only for gbak attachment. What do you

    Hmm... i was wrong about gbak. It is explicitly set isc_dpb_force_write to 
0 when created database. 
Later, after restore of data, it restored also FW flag to the state which was 
read in backup file.

> think, is it a bug or a feature in non-gbak case?

    So, i think, this is the bug. Look at jrd8_create_database, it :

a) create database using PIO_create(). PIO_create() creates file in FW=OFF mode.

b) format header page using PAG_format_header(). It set FW=ON flag on header 
page.
    Note, current file is opened with FW=OFF mode and fil_flags have no 
FIL_force_write flag set

c) then it call PAG_set_force_write(), if isc_dpb_force_write was set in DPB
    - if isc_dpb_force_write is present in DPB and set to zero then FW=OFF will 
be set at header 
    page and file will not be re-opened with FW=OFF as it is already in this 
mode

    - if isc_dpb_force_write is present in DPB and set to non-zero value then 
FW=ON will be set
    at header page and file will be re-opened with FW=ON

    - if isc_dpb_force_write is NOT present in DPB nothing will be done and 
file will be left in
      FW=OFF mode while header page will sill have FW=ON flag. So, next 
attachment will
      work in correct FW=ON mode.


    We can fix engine (make PIO_create to create files in FW=ON mode, or add 
new parameter to it) but 
we can't fix old applications which creates database and expect fast work in 
this first attachment. 

Regards,
Vlad


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to