/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2013 The OpenLDAP Foundation.
+ * Copyright 2000-2017 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
BER_BVC("ad2i"),
BER_BVC("dn2i"),
BER_BVC("id2e"),
+ BER_BVC("id2v"),
BER_BVNULL
};
mdb->mi_search_stack = NULL;
mdb->mi_mapsize = DEFAULT_MAPSIZE;
+ mdb->mi_rtxn_size = DEFAULT_RTXN_SIZE;
+ mdb->mi_multi_hi = UINT_MAX;
+ mdb->mi_multi_lo = UINT_MAX;
be->be_private = mdb;
be->be_cf_ocs = be->bd_info->bi_cf_ocs;
if ( rc ) {
Debug( LDAP_DEBUG_ANY,
- LDAP_XSTRING(mdb_db_open) ": database \"%s\" cannot be opened, err %d. "
+ LDAP_XSTRING(mdb_db_open) ": database \"%s\" cannot be opened: %s (%d). "
"Restore from backup!\n",
- be->be_suffix[0].bv_val, rc, 0 );
+ be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
goto fail;
}
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, flags & MDB_RDONLY, &txn );
if ( rc ) {
Debug( LDAP_DEBUG_ANY,
- LDAP_XSTRING(mdb_db_open) ": database \"%s\" cannot be opened, err %d. "
+ LDAP_XSTRING(mdb_db_open) ": database \"%s\" cannot be opened: %s (%d). "
"Restore from backup!\n",
- be->be_suffix[0].bv_val, rc, 0 );
+ be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
goto fail;
}
} else {
if ( i == MDB_DN2ID )
flags |= MDB_DUPSORT;
+ if ( i == MDB_ID2VAL )
+ flags ^= MDB_INTEGERKEY|MDB_DUPSORT;
if ( !(slapMode & SLAP_TOOL_READONLY) )
flags |= MDB_CREATE;
}
if ( i == MDB_ID2ENTRY )
mdb_set_compare( txn, mdb->mi_dbis[i], mdb_id_compare );
- else if ( i == MDB_DN2ID ) {
+ else if ( i == MDB_ID2VAL ) {
+ mdb_set_compare( txn, mdb->mi_dbis[i], mdb_id2v_compare );
+ mdb_set_dupsort( txn, mdb->mi_dbis[i], mdb_id2v_dupsort );
+ } else if ( i == MDB_DN2ID ) {
MDB_cursor *mc;
MDB_val key, data;
- ID id;
mdb_set_dupsort( txn, mdb->mi_dbis[i], mdb_dup_compare );
/* check for old dn2id format */
rc = mdb_cursor_open( txn, mdb->mi_dbis[i], &mc );
goto fail;
}
- rc = mdb_attr_dbs_open( be, txn, cr );
- if ( rc ) {
- mdb_txn_abort( txn );
- goto fail;
+ /* slapcat doesn't need indexes. avoid a failure if
+ * a configured index wasn't created yet.
+ */
+ if ( !(slapMode & SLAP_TOOL_READONLY) ) {
+ rc = mdb_attr_dbs_open( be, txn, cr );
+ if ( rc ) {
+ mdb_txn_abort( txn );
+ goto fail;
+ }
}
rc = mdb_txn_commit(txn);
bi->bi_op_search = mdb_search;
bi->bi_op_unbind = 0;
+ bi->bi_op_txn = mdb_txn;
bi->bi_extended = mdb_extended;
bi->bi_tool_sync = 0;
bi->bi_tool_dn2id_get = mdb_tool_dn2id_get;
bi->bi_tool_entry_modify = mdb_tool_entry_modify;
+ bi->bi_tool_entry_delete = mdb_tool_entry_delete;
bi->bi_connection_init = 0;
bi->bi_connection_destroy = 0;