X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-bdb%2Fkey.c;h=6747d2930ac9ef7558c447a5bee1f4b3eee7dd65;hb=3bf9998d7885ef6bbc4690d4229e5cb5068a35de;hp=9eae0affdf9af4e2bd1f0861cffa11ffe7015c09;hpb=3c598e89fb34a892d369a138daa8c3314294493c;p=openldap diff --git a/servers/slapd/back-bdb/key.c b/servers/slapd/back-bdb/key.c index 9eae0affdf..6747d2930a 100644 --- a/servers/slapd/back-bdb/key.c +++ b/servers/slapd/back-bdb/key.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 2000-2004 The OpenLDAP Foundation. + * Copyright 2000-2008 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,42 +30,31 @@ int bdb_key_read( Backend *be, DB *db, - DB_TXN *txn, + BDB_LOCKER locker, struct berval *k, - ID *ids + ID *ids, + DBC **saved_cursor, + int get_flag ) { int rc; DBT key; -#ifdef NEW_LOGGING - LDAP_LOG( INDEX, ENTRY, "key_read: enter\n", 0, 0, 0 ); -#else Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 ); -#endif DBTzero( &key ); bv2DBT(k,&key); key.ulen = key.size; key.flags = DB_DBT_USERMEM; - rc = bdb_idl_fetch_key( be, db, txn, &key, ids ); + rc = bdb_idl_fetch_key( be, db, locker, &key, ids, saved_cursor, get_flag ); if( rc != LDAP_SUCCESS ) { -#ifdef NEW_LOGGING - LDAP_LOG( INDEX, ERR, "bdb_key_read: failed (%d)\n", rc, 0, 0 ); -#else Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read: failed (%d)\n", rc, 0, 0 ); -#endif } else { -#ifdef NEW_LOGGING - LDAP_LOG( INDEX, DETAIL1, - "bdb_key_read: %ld candidates\n", (long)BDB_IDL_N(ids), 0, 0); -#else Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n", (long) BDB_IDL_N(ids), 0, 0 ); -#endif } return rc; @@ -85,13 +74,8 @@ bdb_key_change( int rc; DBT key; -#ifdef NEW_LOGGING - LDAP_LOG( INDEX, ENTRY, "key_change: %s ID %lx\n", - op == SLAP_INDEX_ADD_OP ? "Add" : "Delete", (long) id, 0 ); -#else Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n", op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 ); -#endif DBTzero( &key ); bv2DBT(k,&key); @@ -100,7 +84,13 @@ bdb_key_change( if (op == SLAP_INDEX_ADD_OP) { /* Add values */ - rc = bdb_idl_insert_key( be, db, txn, &key, id ); + +#ifdef BDB_TOOL_IDL_CACHING + if ( slapMode & SLAP_TOOL_QUICK ) + rc = bdb_tool_idl_add( be, db, txn, &key, id ); + else +#endif + rc = bdb_idl_insert_key( be, db, txn, &key, id ); if ( rc == DB_KEYEXIST ) rc = 0; } else { /* Delete values */ @@ -108,11 +98,7 @@ bdb_key_change( if ( rc == DB_NOTFOUND ) rc = 0; } -#ifdef NEW_LOGGING - LDAP_LOG( INDEX, RESULTS, "key_change: return %d\n", rc, 0, 0 ); -#else Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 ); -#endif return rc; }