dbTalk Databases Forums  

DB init hang

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


Discuss DB init hang in the comp.databases.berkeley-db forum.



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

Default DB init hang - 05-31-2006 , 03:40 AM






Hi,
I'm using BDB in my program ,I use single process write and update the
database records.
the environment init flags is:
DB_CREATE | DB_INIT_MPOOL |DB_INIT_TXN|DB_INIT_LOG | DB_INIT_LOCK
I do not use transactions explicitly.
I found that the db cursor will hang in some time( not always) , then I
stop the program and restart ,it will hang in the primary DB
association with secondary DB.
But if I remove DB_INIT_LOCK in the above flags ,it works fine.

db_stat -c will show the folling results when hang:

[chenyajun@test data]$ db_stat -c
56 Last allocated locker ID.
2147M Current maximum unused locker ID.
9 Number of lock modes.
1000 Maximum number of locks possible.
1000 Maximum number of lockers possible.
1000 Maximum number of lock objects possible.
24 Number of current locks.
25 Maximum number of locks at any one time.
40 Number of current lockers.
40 Maximum number of lockers at any one time.
6 Number of current lock objects.
11 Maximum number of lock objects at any one time.
21547 Total number of locks requested.
21523 Total number of locks released.
0 Total number of lock requests failing because DB_LOCK_NOWAIT
was set.
3 Total number of locks not immediately available due to
conflicts.
0 Number of deadlocks.
10M Lock timeout value.
0 Number of locks that have timed out.
0 Transaction timeout value.
0 Number of transactions that have timed out.
440KB The size of the lock region..
0 The number of region locks granted after waiting.
40785 The number of region locks granted without waiting.

Does it mean that 3 locks were not released on time and cause lock
conflict?
when it works fine , these first column in this lines is 0 .

I try to modify my code ,add set_timeout & set_lk_detect to the
environment:
(*myEnv)->set_timeout(*myEnv, 1000000*1, DB_SET_LOCK_TIMEOUT);
(*myEnv)->set_lk_detect(*myEnv,DB_LOCK_MINWRITE);
But the problem still exists.
db_stat -Co shows several locks status as "EXPIRED".
db_deadlock shows nothing output.
This program is not multipe process, neither multiple thread, why still
lock conflict?
how to avoid?


Reply With Quote
  #2  
Old   
Mike
 
Posts: n/a

Default Re: DB init hang - 05-31-2006 , 10:54 AM






0day,

If you do not use transactions explicitly then open cursors can block
updates in the same thread. A cursor will hold a lock on the page on
which it is currently posistioned. This will block any updates to that
page. If you want to leave the cursor open and at the same time
perform an update then the update and the cursor must be in the same
transactions.

If you are not using transactions and not specifying DB_AUTO_COMMIT
then your updates will not be recoverable.

The fact that 3 locks were not immediately available due to conflicts
means that a request to read or write a page was blocked by another
operation that already had a lock on that page.

Michael Ubell
Sleepycat Software


Reply With Quote
  #3  
Old   
0day
 
Posts: n/a

Default Re: DB init hang - 06-01-2006 , 10:27 AM



Very thanks ,I'll try later...


Reply With Quote
  #4  
Old   
0day
 
Posts: n/a

Default Re: DB init hang - 06-01-2006 , 10:28 AM



very thanks ..
I'll try later.


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.