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 */
48 bdb_cache_return_entry_w(&bdb->bi_cache, e);
51 LDAP_LOG (( "operational", LDAP_LEVEL_DETAIL1,
52 "=> bdb_operational: retrying...\n" ));
54 Debug( LDAP_DEBUG_TRACE, "==> bdb_operational: retrying...\n",
57 rc = TXN_ABORT( ltid );
64 ldap_pvt_thread_yield();
67 /* begin transaction */
68 rc = TXN_BEGIN( bdb->bi_dbenv, NULL, <id, bdb->bi_db_opflags );
71 LDAP_LOG (( "operational", LDAP_LEVEL_ERR,
72 "=> bdb_operational: txn_begin failed: %s (%d)\n",
73 db_strerror(rc), rc ));
75 Debug( LDAP_DEBUG_TRACE,
76 "bdb_operational: txn_begin failed: %s (%d)\n",
77 db_strerror( rc ), rc, 0 );
84 opinfo.boi_txn = ltid;
86 op->o_private = &opinfo;
88 rc = bdb_dn2id_children( be, ltid, &e->e_nname );
91 case DB_LOCK_DEADLOCK:
92 case DB_LOCK_NOTGRANTED:
97 *aa = slap_operational_hasSubordinate( rc == 0 );
105 LDAP_LOG (( "operational", LDAP_LEVEL_ERR,
106 "=> bdb_operational: has_children failed: %s (%d)\n",
107 db_strerror(rc), rc ));
109 Debug(LDAP_DEBUG_ARGS,
110 "<=- bdb_operational: has_children failed: %s (%d)\n",
111 db_strerror(rc), rc, 0 );
117 if ( rc == LDAP_SUCCESS && bdb->bi_txn_cp ) {
118 ldap_pvt_thread_yield();
119 TXN_CHECKPOINT( bdb->bi_dbenv,
120 bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
123 if ( ltid != NULL ) {
125 op->o_private = NULL;