Subject Re: [firebird-support] Symantec livestate recovery
Author Daniel Rail
Hi,

At March 26, 2005, 06:34, Hannes Streicher wrote:


> Guten Tag Steffen Heil,

> am Samstag, 26. März 2005 um 11:13 schrieben Sie:



>> Hi

>>> But what if the snapshot that you backup is taken in the
>>> midst of a database update that Firebird is writing? Even if
>>> Firebird's operations is not disturbed in any way, will the
>>> snapshot be valid or will your backup copy in fact contain a
>>> corrupt database?

>> Firebird's concept of "carefull writes" should NEVER leave the database file
>> in an inconsistent state at any point in time...

> and if that is so then
> why is everybody advising against copying the DB - file while
> transactions are running ?

When you are performing a file copy, the operating system isn't
copying a frozen image, but a live image of a file. So, in essence if
the file is changing while it is copying, it is greatly possible that
some modified/added pages will not be part of the copy.

Here's an example of what could happen:
- You start to do a file copy of the database and the database is
still being used.
- While in the middle of the copy operation, a transaction is being
committed. That transaction has to add pages and modify other pages.
Chances are that the added pages will be part of the copied file, but
at the same time not visible by the copy's pointer pages. Also, if
some of the modified pages is, in example, a blob that uses two pages
and one page is written in the portion of the file that hasn't been
copied, yet, and the other page written to the already copied portion. If
this is a blob that only used one page and now using 2 pages and that
the second page has simply been written in a page that is free. When
trying to access that blob when using the copied database file,
Firebird will try to access the second page to return the whole blob,
but will encounter a page that is marked as free.

These were just examples that I could think of. And, you could
probably come up with more examples yourself, and I'm sure Ann could
think of more, unless she proves me wrong.

--
Best regards,
Daniel Rail
Senior Software Developer
ACCRA Consultants Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)