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? |