dbTalk Databases Forums  

illegal page type or format

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss illegal page type or format in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
isha
 
Posts: n/a

Default illegal page type or format - 03-27-2006 , 03:20 AM






Hi!

i am using a berkley Db, BTREE type.
I have written a test case which stores the data in the db and then
retrives it using cursor.

Everytime i try to read the data, i get the following error:
page 1: illegal page type or format
PANIC: Invalid argument
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery
PANIC: fatal region error detected; run recovery


The exception is :
com.sleepycat.db.RunRecoveryException: DB_RUNRECOVERY: Fatal error, run
database recovery: DB_RUNRECOVERY: Fatal error, run database recovery
at com.sleepycat.db.internal.db_javaJNI.Dbc_get(Nativ e Method)
at com.sleepycat.db.internal.Dbc.get(Dbc.java:62)
at com.sleepycat.db.Cursor.getNext(Cursor.java:108)


Its a single threaded application, on Linux.

Thanks in advance.

Isha


Reply With Quote
  #2  
Old   
Michael Cahill
 
Posts: n/a

Default Re: illegal page type or format - 03-27-2006 , 08:25 PM






Hi Isha,

Do you use the same Database handle for both storing and retrieving the
data? If not, is the Database closed cleanly in between the storing
step and the retrieving step?

Regards,
Michael.


Reply With Quote
  #3  
Old   
isha
 
Posts: n/a

Default Re: illegal page type or format - 03-28-2006 , 05:08 AM



Hi Michael,

I dont use the same Database handle for both storing and retrieving the
data. I use to diffrent ones. The database needs to be open in both
cases as read and write operations happen simultaneously.

If i use cursor.getFirst instead of cursor.getNext, this error does not
occur. Any ideas why this happens?


Thanks,

Isha


Reply With Quote
  #4  
Old   
Michael Cahill
 
Posts: n/a

Default Re: illegal page type or format - 03-28-2006 , 05:40 PM



Hi Isha,

Quote:
I dont use the same Database handle for both storing and retrieving the
data. I use to diffrent ones. The database needs to be open in both
cases as read and write operations happen simultaneously.
Firstly, there is no reason why you couldn't use one Database handle,
and have some threads writing while other threads are reading. That
should work fine using just a single handle.

Using multiple Database handles, the problem is likely to be that they
are opened independently, so they share nothing. In particular, they
do not share a cache or lock manage. That means that each will read
and write the database file independently, so they will not see
consistent data, which is causing the errors you reported.

To resolve this, you will need to open an environment handle configured
with a cache and locking, then use Environment.openDatabase to open the
Database handles. The environment handle can be private to the process
(using EnvironmentConfig.setPrivate) if you don't want to manage an
environment directory on disk.

Quote:
If i use cursor.getFirst instead of cursor.getNext, this error does not
occur. Any ideas why this happens?
It may be that the first page of the database happens to be on disk
when you read it with the second handle. The only way to make this
work in general is to have the two Database handles share a cache.

Regards,
Michael.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.