1 /* operational.c - bdb backend operational attributes function */
3 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
12 #include <ac/socket.h>
16 #include "proto-bdb.h"
19 * sets the supported operational attributes (if required)
32 struct bdb_info *bdb = (struct bdb_info *) be->be_private;
36 struct bdb_op_info opinfo;
40 if ( !opattrs && !ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
46 retry: /* transaction retry */
49 bdb_unlocked_cache_return_entry_w(&bdb->bi_cache, e);
53 LDAP_LOG ( OPERATION, DETAIL1,
54 "=> bdb_operational: retrying...\n", 0, 0, 0 );
56 Debug( LDAP_DEBUG_TRACE, "==> bdb_operational: retrying...\n",
59 rc = TXN_ABORT( ltid );
66 ldap_pvt_thread_yield();
69 /* begin transaction */
70 rc = TXN_BEGIN( bdb->bi_dbenv, NULL, <id, bdb->bi_db_opflags );
73 LDAP_LOG ( OPERATION, ERR,
74 "=> bdb_operational: txn_begin failed: %s (%d)\n",
75 db_strerror(rc), rc, 0 );
77 Debug( LDAP_DEBUG_TRACE,
78 "bdb_operational: txn_begin failed: %s (%d)\n",
79 db_strerror( rc ), rc, 0 );
86 opinfo.boi_txn = ltid;
88 op->o_private = &opinfo;
90 rc = bdb_dn2id_children( be, ltid, &e->e_nname, 0 );
93 case DB_LOCK_DEADLOCK:
94 case DB_LOCK_NOTGRANTED:
99 *aa = slap_operational_hasSubordinate( rc == 0 );
107 LDAP_LOG ( OPERATION, ERR,
108 "=> bdb_operational: has_children failed: %s (%d)\n",
109 db_strerror(rc), rc, 0 );
111 Debug(LDAP_DEBUG_ARGS,
112 "<=- bdb_operational: has_children failed: %s (%d)\n",
113 db_strerror(rc), rc, 0 );
119 if ( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
120 ldap_pvt_thread_yield();
121 TXN_CHECKPOINT( bdb->bi_dbenv,
122 bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
125 if ( ltid != NULL ) {
127 op->o_private = NULL;