Subject Re: [firebird-support] Re: Bad new: FB2.1.4 : gfix say INDEX PAGE IN ERROR: 1
Author Ann W. Harrison
hvlad wrote:
>>> I recommend to run gfix -v -full every day (night) when (if) it is possible.
>> Hi Vlad,
>> I'm just wondering... is it a good pratice to run gfix -v -full in a deployed database every day (night)? Or this recomendation is just for special cases like this of Stephen?
>
> I always recommend to validate database after any suspicious action (such as not correct Firebird shutdown or power failure etc) and, when possible, dayly (nightly). It is not always possible, i know.

That's good advice as long as you don't take the results of the
validation too seriously and rebuild a database that's functionally
OK. Validation doesn't distinguish well between errors that are
not corruption like orphan pages or orphan record versions and those
that are serious.

In Stephane's case, for example, if he killed a server that was
hanging, he's likely to see orphan pages and record versions and
possibly some bad pointer in the index.

Firebird uses careful write rather than a write-ahead log, so
each page change is written in only one place. The database
also serves as its own undo log. Careful write is a simple
concept - you write the thing before you write the pointer
to the thing and you remove the pointer before you remove
the thing it points to.

What this means in practice is that when creating a back version
of a record, you first create the back version, then change the
new record to point to the back version, then change the page
index to point to the new record. If the server crashes between
any of those steps, you have an orphaned record version, but
it was created by a transaction that failed, so nobody cares.
Similarly, if you want to release a data page, you first
remove it from the pointer page, then change the page inventory
to say it's free. If you crash between those steps, the
page inventory says the page is in use, but nobody is actually
using it.

If you validate that database, you'll get errors, but they're
just wasted space, not actual corruption.


Cheers,

Ann