Subject Question about "wrong page type" errors.
Author Dunbar, Norman
Good afternoon all,

I have a system running Firebird 2.1 on a Windows server or two. I can't
see an application running nor can I see services running so I'm
assuming embedded - but the fbembed.dll is not on the server as far as I
can see. So I'm a wee bit puzzled already.

We have had a database corruption detected on two databases on two
separate servers. Both show the following errors in the firebird.log -
although the page numbers differ:

<EXTRACT>
greenbird (Server) Mon Oct 26 11:21:26 2009
Database: /u00/firebird/databases/local.fdb
Page 337334 wrong type (expected 7 encountered 8)


greenbird (Server) Mon Oct 26 11:21:26 2009
Database: /u00/firebird/databases/local.fdb
Index 1 is corrupt on page 337334 level 34. File:
../src/jrd/validation.cpp, line: 1455
in table REPORTS (182)


greenbird (Server) Mon Oct 26 11:21:26 2009
Database: /u00/firebird/databases/local.fdb
Index 1 is corrupt on page 337334 level 34. File:
../src/jrd/validation.cpp, line: 1469
in table REPORTS (182)
</EXTRACT>

This matches with the output from a full backup:

gbak: ERROR:database file appears corrupt
(/u00/firebird/databases/local.fdb)
gbak: ERROR: wrong page type
gbak: ERROR: page 337334 is of wrong type (expected 7, found 8)


Running gstat against the table in question gives me this:

<EXTRACT>
Database file sequence:
File /u00/firebird/databases/local.fdb is the only file

Analyzing database pages ...
Expected b-tree bucket on page 337334 from 146314
...
</EXTRACT>

Looking around a *copy* of the database file on a Linux server, that has
got SuperServer 2.1.3 installed, I can follow index page 146314's NEXT
pointer which does indeed point to page 337334 which is, unfortunately,
a type 8 BLOB page which is part of a blob chain and the page in
question shouldn't be part of the index chain - to my mind.

Now, I found the following in the firebird.conf file:

# ENABLED FOR FEWS
RemoteFileOpenAbility = 1

(Yes, I have read and understood the warnings above this setting in the
file - this is an app that was installed for us by a vendor and we
didn't turn it on!)

Talking to one of my fellow DBAs, he says that there is a "sync" process
that makes sure that the data on one server is the same as the data in
the other. Now, I'm thinking that the above setting is the cause of all
our troubles because the warning clearly states that we are asking for
trouble!

I'm sure that we are running embedded - well, almost sure, I just need
some way to find out. If so, we are not using any NFS mounted databases
- these are Windows servers, I think they are on a share - which I can
confirm if required.

My theory is that one connection, local or remote needed a new page for
the corrupted index chain and got page 337334. Then another connection
(remote possibly?) needed a new blob page and was given the same page -
is this possible?

The index page, type 7, was written first and then overwritten by the
blob page thus corrupting the index chain.

Is there anyone who can confirm my thoughts on the matter as I need to
provide management with a suitable reason why we got similar corruption
on both databases - and both were expected type 7, found type 8 - just
on different tables/indexes/pages.

I appreciate any advice or information you have, I will be unlikely to
turn off the setting (by the way, everything else is defaulted) above -
unless I have a jolly good reason and can back it up.

One thing that did prove useful was Ann's "Firebird For The Database
Expert" documents on IBPhoenix. Thanks.


Cheers,
Norm.



Norman Dunbar
Contract Oracle DBA
CIS Engineering Services
Internal : 7 28 2051
External : 0113 231 2051





Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else. We have checked this email and its attachments for viruses. But you should still check any attachment before opening it. We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes. If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk

Information in this message may be confidential and may be legally privileged. If you have received this message by mistake, please notify the sender immediately, delete it and do not copy it to anyone else.

We have checked this email and its attachments for viruses. But you should still check any attachment before opening it.
We may have to make this message and any reply to it public if asked to under the Freedom of Information Act, Data Protection Act or for litigation. Email messages and attachments sent to or from any Environment Agency address may also be accessed by someone other than the sender or recipient, for business purposes.

If we have sent you information and you wish to use it please read our terms and conditions which you can get by calling us on 08708 506 506. Find out more about the Environment Agency at www.environment-agency.gov.uk