]> git.sur5r.net Git - openldap/commitdiff
Initial idl fetch code, undef BDB_INDEX for now, other cleanup
authorKurt Zeilenga <kurt@openldap.org>
Fri, 5 Oct 2001 01:19:58 +0000 (01:19 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 5 Oct 2001 01:19:58 +0000 (01:19 +0000)
servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/config.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/extended.c
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/idl.c
servers/slapd/back-bdb/key.c
servers/slapd/back-bdb/proto-bdb.h

index b3fd31f38375f6644220ceda62ef98b5b354c15c..d3191f5209edc855e90c988f5416ebc83be31247 100644 (file)
@@ -15,7 +15,7 @@
 
 LDAP_BEGIN_DECL
 
-#define BDB_INDEX 1
+/* #define BDB_INDEX 1 */
 /* #define BDB_REINDEX 1 */
 /* #define BDB_FILTER_INDICES 1 */
 #define BDB_CONFIG_INDICES 1
index f9a66fcc638c5a4f5283f75b5087d34bf5e4683a..c22a84723974c00de01a35760a0701867a8c9fb2 100644 (file)
@@ -1,4 +1,4 @@
-/* config.c - ldbm backend configuration file routine */
+/* config.c - bdb backend configuration file routine */
 /* $OpenLDAP$ */
 /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
index 8ad2557473e2af42b75a86c0f22ca8b1a6fd0b69..de0028a0be70efb02ea2b609c3d3b35ccab3ce98 100644 (file)
@@ -1,4 +1,4 @@
-/* delete.c - ldbm backend delete routine */
+/* delete.c - bdb backend delete routine */
 /* $OpenLDAP$ */
 /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
index 04b96f823a5bbbb0d1fe171c2cce1e90b6d3a043..83ab00ccc4873cdc7ddd234511cbc9bf18f4e714 100644 (file)
@@ -1,4 +1,4 @@
-/* extended.c - ldbm backend extended routines */
+/* extended.c - bdb backend extended routines */
 /* $OpenLDAP$ */
 /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
@@ -49,4 +49,5 @@ bdb_extended(
 
        *text = "not supported within naming context";
        return LDAP_OPERATIONS_ERROR;
-}
\ No newline at end of file
+}
+
index 3e7427834b7af5775bae57c7d8e3e8f7daae5a74..73490efa0756fdd71046b555ac487701ee02e6a6 100644 (file)
@@ -310,15 +310,15 @@ equality_candidates(
 
        if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_TRACE,
-                       "<= bdb_equality_candidates: (%s%s) MR filter failed (%d)\n",
-                       "", "", rc );
+                       "<= bdb_equality_candidates: MR filter failed (%d)\n",
+                       rc, 0, 0 );
                return 0;
        }
 
        if( keys == NULL ) {
                Debug( LDAP_DEBUG_TRACE,
-                       "<= bdb_equality_candidates: no keys (%s%s)\n",
-                       "", "", 0 );
+                       "<= bdb_equality_candidates: no keys\n",
+                       0, 0, 0 );
                return 0;
        }
 
@@ -417,22 +417,22 @@ approx_candidates(
 
        if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_TRACE,
-                       "<= approx_candidates: (%s%s) MR filter failed (%d)\n",
-                       dbname, LDBM_SUFFIX, rc );
+                       "<= approx_candidates: (%s) MR filter failed (%d)\n",
+                       dbname, rc, 0 );
                return idl;
        }
 
        if( keys == NULL ) {
                Debug( LDAP_DEBUG_TRACE,
-                       "<= approx_candidates: no keys (%s%s)\n",
-                       dbname, LDBM_SUFFIX, 0 );
+                       "<= approx_candidates: no keys (%s)\n",
+                       dbname, 0, 0 );
                return idl;
        }
 
        if ( db == NULL ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= approx_candidates db open failed (%s%s)\n",
-                       dbname, LDBM_SUFFIX, 0 );
+                       "<= approx_candidates db open failed (%s)\n",
+                       dbname, 0, 0 );
                return idl;
        }
 
@@ -537,24 +537,24 @@ substring_candidates(
 
        if( rc != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_TRACE,
-                       "<= substrings_candidates: (%s%s) MR filter failed (%d)\n",
-                       dbname, LDBM_SUFFIX, rc );
+                       "<= substrings_candidates: (%s) MR filter failed (%d)\n",
+                       dbname, rc, 0 );
                return idl;
        }
 
        if( keys == NULL ) {
                Debug( LDAP_DEBUG_TRACE,
-                       "<= substrings_candidates: (0x%04lx) no keys (%s%s)\n",
-                       mask, dbname, LDBM_SUFFIX );
+                       "<= substrings_candidates: (0x%04lx) no keys (%s)\n",
+                       mask, dbname, 0 );
                return idl;
        }
 
-       db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_READER );
+       rc = bdb_db_cache( be, dbname, &db );
        
        if ( db == NULL ) {
                Debug( LDAP_DEBUG_ANY,
-                       "<= substrings_candidates db open failed (%s%s)\n",
-                       dbname, LDBM_SUFFIX, 0 );
+                       "<= substrings_candidates db open failed (%s)\n",
+                       dbname, 0, 0 );
                return idl;
        }
 
index 71666bc8624fc8ed3601a57557c4dbed735a43d5..0463bc5ba92bd0c780a8c8ff0a60934405837c79 100644 (file)
@@ -211,6 +211,30 @@ static int idl_delete( ID *ids, ID id )
        return 0;
 }
 
+int
+bdb_idl_fetch_key(
+       BackendDB       *be,
+       DB                      *db,
+       DB_TXN          *tid,
+       DBT                     *key,
+       ID                      *ids )
+{
+       int rc;
+       DBT data;
+
+       assert( ids != NULL );
+
+       DBTzero( &data );
+       data.data = ids;
+       data.ulen = BDB_IDL_SIZE * sizeof( ID );
+       data.flags = DB_DBT_USERMEM;
+
+       /* fetch it */
+       rc = db->get( db, tid, key, &data, 0 );
+
+       return rc;
+}
+
 int
 bdb_idl_insert_key(
        BackendDB       *be,
index 95109daa085ed0cfbff0cc89a12d95864e60f190..f5b877e5a21ee6d9ca5a85d2bbf03e30bcf6de54 100644 (file)
@@ -23,36 +23,45 @@ bdb_key_read(
        DB *db,
        DB_TXN *txn,
     struct berval *k,
-       ID **idout
+       ID *ids
 )
 {
-       Datum           key;
-       ID_BLOCK                *idl;
+       DBT             key;
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
-                  "key_read: enter\n" ));
+               "key_read: enter\n" ));
 #else
        Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
 #endif
 
-       ldbm_datum_init( key );
-       key.dptr = k->bv_val;
-       key.dsize = k->bv_len;
+       DBzero( &key );
+       key.data = k->bv_val;
+       key.size = k->bv_len;
 
-       rc = bdb_idl_fetch_key( be, db, key, idl );
+       rc = bdb_idl_fetch_key( be, db, txn, key, ids );
 
+       if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
-                  "key_read: %ld candidates\n",
-                  idl ? ID_BLOCK_NIDS(idl) : 0 ));
+               LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
+                       "bdb_key_read: failed (%d)\n",
+                       rc ));
 #else
-       Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
-              idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+               Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read: failed (%d)\n",
+                       rc, 0, 0 );
 #endif
+       } else {
+#ifdef NEW_LOGGING
+               LDAP_LOG(( "index", LDAP_LEVEL_ENTRY,
+                       "bdb_key_read: %ld candidates\n",
+                       idl ? ID_BLOCK_NIDS(idl) : 0 ));
+#else
+               Debug( LDAP_DEBUG_TRACE, "<= bdb_index_read %ld candidates\n",
+               idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
+#endif
+       }
 
-       *idout = idl;
-       return LDAP_SUCCESS;
+       return rc;
 }
 #endif
 
index 06c19225330554d36ca0437e0db8c3ff60cc1020..7e641bf9d5178fd8c0a2416d43f9f9b2465070b8 100644 (file)
@@ -142,6 +142,13 @@ int bdb_id2entry(
  */
 unsigned bdb_idl_search( ID *ids, ID id );
 
+int bdb_idl_fetch_key(
+       BackendDB *be,
+       DB *db,
+       DB_TXN *txn,
+       DBT *key,
+       ID *ids );
+
 int bdb_idl_insert_key(
        BackendDB *be,
        DB *db,