mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
ITS#7222 fix bdb/hdb cache hang under high load
This commit is contained in:
parent
4272551a01
commit
243a2316d3
@ -1361,7 +1361,7 @@ bdb_cache_delete(
|
|||||||
DB_LOCK *lock )
|
DB_LOCK *lock )
|
||||||
{
|
{
|
||||||
EntryInfo *ei = BEI(e);
|
EntryInfo *ei = BEI(e);
|
||||||
int rc, busy = 0;
|
int rc, busy = 0, counter = 0;
|
||||||
|
|
||||||
assert( e->e_private != NULL );
|
assert( e->e_private != NULL );
|
||||||
|
|
||||||
@ -1378,7 +1378,7 @@ bdb_cache_delete(
|
|||||||
|
|
||||||
bdb_cache_entryinfo_unlock( ei );
|
bdb_cache_entryinfo_unlock( ei );
|
||||||
|
|
||||||
while ( busy ) {
|
while ( busy && counter < 1000) {
|
||||||
ldap_pvt_thread_yield();
|
ldap_pvt_thread_yield();
|
||||||
busy = 0;
|
busy = 0;
|
||||||
bdb_cache_entryinfo_lock( ei );
|
bdb_cache_entryinfo_lock( ei );
|
||||||
@ -1387,6 +1387,13 @@ bdb_cache_delete(
|
|||||||
ei->bei_finders > 0 )
|
ei->bei_finders > 0 )
|
||||||
busy = 1;
|
busy = 1;
|
||||||
bdb_cache_entryinfo_unlock( ei );
|
bdb_cache_entryinfo_unlock( ei );
|
||||||
|
counter ++;
|
||||||
|
}
|
||||||
|
if( busy ) {
|
||||||
|
bdb_cache_entryinfo_lock( ei );
|
||||||
|
ei->bei_state ^= CACHE_ENTRY_DELETED;
|
||||||
|
bdb_cache_entryinfo_unlock( ei );
|
||||||
|
return DB_LOCK_DEADLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get write lock on the data */
|
/* Get write lock on the data */
|
||||||
|
Loading…
Reference in New Issue
Block a user