Diff for /servers/slapd/back-bdb/dbcache.c between versions 1.43.2.6 and 1.43.2.8

version 1.43.2.6, 2008/02/11 23:26:45 version 1.43.2.8, 2009/01/22 00:01:05
Line 1 Line 1
 /* dbcache.c - manage cache of open databases */  /* dbcache.c - manage cache of open databases */
 /* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/dbcache.c,v 1.43.2.5 2008/02/08 23:41:13 quanah Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/dbcache.c,v 1.43.2.7 2008/11/10 17:12:13 quanah Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
  * Copyright 2000-2008 The OpenLDAP Foundation.   * Copyright 2000-2009 The OpenLDAP Foundation.
  * All rights reserved.   * All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
Line 57  bdb_db_hash( Line 57  bdb_db_hash(
 #define BDB_INDEXTYPE   DB_BTREE  #define BDB_INDEXTYPE   DB_BTREE
 #endif  #endif
   
   /* If a configured size is found, return it, otherwise return 0 */
   int
   bdb_db_findsize(
           struct bdb_info *bdb,
           struct berval *name
   )
   {
           struct bdb_db_pgsize *bp;
           int rc;
   
           for ( bp = bdb->bi_pagesizes; bp; bp=bp->bdp_next ) {
                   rc = strncmp( name->bv_val, bp->bdp_name.bv_val, name->bv_len );
                   if ( !rc ) {
                           if ( name->bv_len == bp->bdp_name.bv_len )
                                   return bp->bdp_size;
                           if ( name->bv_len < bp->bdp_name.bv_len &&
                                   bp->bdp_name.bv_val[name->bv_len] == '.' )
                                   return bp->bdp_size;
                   }
           }
           return 0;
   }
   
 int  int
 bdb_db_cache(  bdb_db_cache(
         Backend *be,          Backend *be,
Line 121  bdb_db_cache( Line 144  bdb_db_cache(
                 }                  }
         }          }
   
         rc = db->bdi_db->set_pagesize( db->bdi_db, BDB_PAGESIZE );          if( bdb->bi_flags & BDB_CHKSUM ) {
                   rc = db->bdi_db->set_flags( db->bdi_db, DB_CHKSUM );
                   if ( rc ) {
                           Debug( LDAP_DEBUG_ANY,
                                   "bdb_db_cache: db set_flags(DB_CHKSUM)(%s) failed: %s (%d)\n",
                                   bdb->bi_dbenv_home, db_strerror(rc), rc );
                           ldap_pvt_thread_mutex_unlock( &bdb->bi_database_mutex );
                           db->bdi_db->close( db->bdi_db, 0 );
                           ch_free( db );
                           return rc;
                   }
           }
   
           /* If no explicit size set, use the FS default */
           flags = bdb_db_findsize( bdb, name );
           if ( flags )
                   rc = db->bdi_db->set_pagesize( db->bdi_db, flags );
   
 #ifdef BDB_INDEX_USE_HASH  #ifdef BDB_INDEX_USE_HASH
         rc = db->bdi_db->set_h_hash( db->bdi_db, bdb_db_hash );          rc = db->bdi_db->set_h_hash( db->bdi_db, bdb_db_hash );
 #endif  #endif

Removed from v.1.43.2.6  
changed lines
  Added in v.1.43.2.8


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org