dbTalk Databases Forums  

verify without cache

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


Discuss verify without cache in the comp.databases.berkeley-db forum.



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

Default verify without cache - 10-23-2003 , 08:15 AM






Hi,
how can i use verifying without cache.
In 'db_verify.c' we use cache in this code :
---------------------------------------------------------
private = 0;
if ((ret =
dbenv->open(dbenv, home, DB_INIT_MPOOL | DB_USE_ENVIRON,
0)) != 0) {
if ((ret = dbenv->set_cachesize(dbenv, 0, cache, 1))
!= 0) {
dbenv->err(dbenv, ret, "set_cachesize");
goto shutdown;
}
private = 1;
if ((ret = dbenv->open(dbenv, home,
DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_USE_ENVIRON,
0)) != 0) {
dbenv->err(dbenv, ret, "open");
goto shutdown;
}
}
-------------------------------------------------------------
where 'cache' size is define aka MEGABYTE.
In verify i don't want use cache.
I have DB(database).I make this procedur open->DB after read->DB, then
close DB(some procedure is bad and crash this DB).
Now, when i run 'db_verify' on this DB, is everything OK, but when i
remove enviroments and then run 'db_verify' it put a DB is broken. I
think it's because 'db_verify' check DB from cache(enviroments) and i
don't need this.
Tnak you for yours answers

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

Default Re: verify without cache - 10-23-2003 , 01:04 PM






Igor,

The Berkeley Db code always uses a cache to hold pages from the database.
Even in the cases where you do not specify the size or even explicitly
specify an environment.

It sounds like the problem you have is that you are removing the environment
without flushing the database to disk. If you are using the Transactional
Data Store, you should run recovery (either db_recover or open the environment
specifying DB_RECOVER) which will restore the databases to a consistent
state. If you are not using TDS then after a crash your data can be left
in an inconsistent state. The fact that db_verify does not report any
problems when using the existing environment, indicates that the data
is consistent when viewed using the cached data. You could try opening
the database using the existing environment and calling DB->sync to
flush the cache. If your application crashed while holding resources
within the Berkeley DB library then it is possible that this
attempt my hang.

If you want to run db_verify without referencing an existing environment
you should not specify the -h flag and use the full path name to
the database you want to verify.

Michael Ubell
Sleepycat Software.


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.