mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 08:39:37 -05:00
More for ITS#6961 - deadlock checking
This commit is contained in:
parent
f5cb879aed
commit
ce9bbd2df2
1 changed files with 23 additions and 6 deletions
|
|
@ -313,7 +313,7 @@ sameido:
|
||||||
/* Get the next ID from the DB. Used if the candidate list is
|
/* Get the next ID from the DB. Used if the candidate list is
|
||||||
* a range and simple iteration hits missing entryIDs
|
* a range and simple iteration hits missing entryIDs
|
||||||
*/
|
*/
|
||||||
static ID
|
static int
|
||||||
bdb_get_nextid(struct bdb_info *bdb, DB_TXN *ltid, ID *cursor)
|
bdb_get_nextid(struct bdb_info *bdb, DB_TXN *ltid, ID *cursor)
|
||||||
{
|
{
|
||||||
DBC *curs;
|
DBC *curs;
|
||||||
|
|
@ -326,7 +326,7 @@ bdb_get_nextid(struct bdb_info *bdb, DB_TXN *ltid, ID *cursor)
|
||||||
rc = bdb->bi_id2entry->bdi_db->cursor(
|
rc = bdb->bi_id2entry->bdi_db->cursor(
|
||||||
bdb->bi_id2entry->bdi_db, ltid, &curs, bdb->bi_db_opflags );
|
bdb->bi_id2entry->bdi_db, ltid, &curs, bdb->bi_db_opflags );
|
||||||
if ( rc )
|
if ( rc )
|
||||||
return NOID;
|
return rc;
|
||||||
key.data = &nid;
|
key.data = &nid;
|
||||||
key.size = key.ulen = sizeof(ID);
|
key.size = key.ulen = sizeof(ID);
|
||||||
key.flags = DB_DBT_USERMEM;
|
key.flags = DB_DBT_USERMEM;
|
||||||
|
|
@ -335,9 +335,8 @@ bdb_get_nextid(struct bdb_info *bdb, DB_TXN *ltid, ID *cursor)
|
||||||
rc = curs->c_get( curs, &key, &data, DB_SET_RANGE );
|
rc = curs->c_get( curs, &key, &data, DB_SET_RANGE );
|
||||||
curs->c_close( curs );
|
curs->c_close( curs );
|
||||||
if ( rc )
|
if ( rc )
|
||||||
return NOID;
|
return rc;
|
||||||
BDB_DISK2ID( &nid, cursor );
|
BDB_DISK2ID( &nid, cursor );
|
||||||
return *cursor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -747,6 +746,7 @@ fetch_entry_retry:
|
||||||
ltid->flags &= ~TXN_DEADLOCK;
|
ltid->flags &= ~TXN_DEADLOCK;
|
||||||
goto fetch_entry_retry;
|
goto fetch_entry_retry;
|
||||||
}
|
}
|
||||||
|
txnfail:
|
||||||
opinfo->boi_err = rs->sr_err;
|
opinfo->boi_err = rs->sr_err;
|
||||||
send_ldap_error( op, rs, LDAP_BUSY, "ldap server busy" );
|
send_ldap_error( op, rs, LDAP_BUSY, "ldap server busy" );
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -775,8 +775,25 @@ fetch_entry_retry:
|
||||||
(long) id, 0, 0 );
|
(long) id, 0, 0 );
|
||||||
} else {
|
} else {
|
||||||
/* get the next ID from the DB */
|
/* get the next ID from the DB */
|
||||||
id = bdb_get_nextid( bdb, ltid, &cursor );
|
id_retry:
|
||||||
cursor = id - 1;
|
rs->sr_err = bdb_get_nextid( bdb, ltid, &cursor );
|
||||||
|
if ( rs->sr_err == DB_NOTFOUND ) {
|
||||||
|
break;
|
||||||
|
} else if ( rs->sr_err == DB_LOCK_DEADLOCK ) {
|
||||||
|
if ( opinfo )
|
||||||
|
goto txnfail;
|
||||||
|
ltid->flags &= ~TXN_DEADLOCK;
|
||||||
|
goto id_retry;
|
||||||
|
} else if ( rs->sr_err == DB_LOCK_NOTGRANTED ) {
|
||||||
|
goto id_retry;
|
||||||
|
}
|
||||||
|
if ( rs->sr_err ) {
|
||||||
|
rs->sr_err = LDAP_OTHER;
|
||||||
|
rs->sr_text = "internal error in get_nextid";
|
||||||
|
send_ldap_result( op, rs );
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
cursor--;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto loop_continue;
|
goto loop_continue;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue