]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/init.c
Merge branch 'mdb.master' of /home/hyc/OD/mdb
[openldap] / servers / slapd / back-bdb / init.c
index c92ebcef445f08c02608e6d4f38efbcae4d6bdaa..526fee8ed6c7d4a990c3a52287926cfdb6db9b3f 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2009 The OpenLDAP Foundation.
+ * Copyright 2000-2011 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -223,6 +223,7 @@ bdb_db_open( BackendDB *be, ConfigReply *cr )
                        "Run manual recovery if errors are encountered.\n",
                        be->be_suffix[0].bv_val, 0, 0 );
                do_recover = 0;
+               do_alock_recover = 0;
                quick = alockt;
        }
 
@@ -368,9 +369,11 @@ shm_retry:
        }
 #endif
 
-       /* Default dncache to 2x entrycache */
-       if ( bdb->bi_cache.c_maxsize && !bdb->bi_cache.c_eimax ) {
-               bdb->bi_cache.c_eimax = bdb->bi_cache.c_maxsize * 2;
+       /* dncache defaults to 0 == unlimited
+        * must be >= entrycache
+        */
+       if ( bdb->bi_cache.c_eimax && bdb->bi_cache.c_eimax < bdb->bi_cache.c_maxsize ) {
+               bdb->bi_cache.c_eimax = bdb->bi_cache.c_maxsize;
        }
 
        if ( bdb->bi_idl_cache_max_size ) {
@@ -537,10 +540,23 @@ shm_retry:
                rc = bdb_id2entry( be, NULL, 0, &e );
        }
        if ( !e ) {
+               struct berval gluebv = BER_BVC("glue");
+               Operation op = {0};
+               Opheader ohdr = {0};
                e = entry_alloc();
                e->e_id = 0;
                ber_dupbv( &e->e_name, (struct berval *)&slap_empty_bv );
                ber_dupbv( &e->e_nname, (struct berval *)&slap_empty_bv );
+               attr_merge_one( e, slap_schema.si_ad_objectClass,
+                       &gluebv, NULL );
+               attr_merge_one( e, slap_schema.si_ad_structuralObjectClass,
+                       &gluebv, NULL );
+               op.o_hdr = &ohdr;
+               op.o_bd = be;
+               op.ora_e = e;
+               op.o_dn = be->be_rootdn;
+               op.o_ndn = be->be_rootndn;
+               slap_add_opattrs( &op, NULL, NULL, 0, 0 );
        }
        e->e_ocflags = SLAP_OC_GLUE|SLAP_OC__END;
        e->e_private = &bdb->bi_cache.c_dntree;
@@ -814,7 +830,8 @@ bdb_back_initialize(
         */
        bi->bi_tool_entry_open = bdb_tool_entry_open;
        bi->bi_tool_entry_close = bdb_tool_entry_close;
-       bi->bi_tool_entry_first = bdb_tool_entry_next;
+       bi->bi_tool_entry_first = backend_tool_entry_first;
+       bi->bi_tool_entry_first_x = bdb_tool_entry_first_x;
        bi->bi_tool_entry_next = bdb_tool_entry_next;
        bi->bi_tool_entry_get = bdb_tool_entry_get;
        bi->bi_tool_entry_put = bdb_tool_entry_put;