]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Import slapd nextid chunking from -devel.
authorKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 22:33:52 +0000 (22:33 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 22:33:52 +0000 (22:33 +0000)
CHANGES
servers/slapd/back-ldbm/back-ldbm.h
servers/slapd/back-ldbm/close.c
servers/slapd/back-ldbm/init.c
servers/slapd/back-ldbm/nextid.c
servers/slapd/back-ldbm/proto-back-ldbm.h

diff --git a/CHANGES b/CHANGES
index 9f03c0cce4cf574f1ea87802b55f9abe21afbf12..1f74b1185edda45bfa357ca1ec94cd16038ce8dc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,8 +5,9 @@ Changes included in OpenLDAP 1.2
        Add ldappasswd() tool
        Add salted MD5/SHA1 password support
        Add client/tools password prompting (-W)
-       Add slapd logging option
        Add slapd alternative args/pid file locations
+       Add slapd logging option
+       Add slapd nextid chunking
        Fixed client SIGPIPE handling
        Fixed configure wait3 handling
        Fixed lber leaking ber_scanf
@@ -15,7 +16,6 @@ Changes included in OpenLDAP 1.2
        Updated client -d(ebug) handling
        Updated slapd alias deref functionality to be optional
        Updated slapd DN handling
-       Updated slapd .args/.pid file handling
        Updated client/tools Kerberos option handling
 
 Changes included in OpenLDAP 1.1.3
index 227bde5a403e975d8c39170c049d462f65ea7707..5f46374c79f5517c6b65ac908905553dc8b39274 100644 (file)
@@ -104,8 +104,16 @@ struct attrinfo {
 
 #define MAXDBCACHE     10
 
+/* this could be made an option */
+#ifndef SLAPD_NEXTID_CHUNK
+#define SLAPD_NEXTID_CHUNK     32
+#endif
+
 struct ldbminfo {
        ID                      li_nextid;
+#if SLAPD_NEXTID_CHUNK > 1
+       ID                      li_nextid_wrote;
+#endif
        char            *li_nextid_file;
        pthread_mutex_t         li_root_mutex;
        pthread_mutex_t         li_add_mutex;
index 4539163b2fb5f5c822785ba88b80cb626fd6ffb1..310f441b5d1343b565bd84cdd5ff59ca7c570931 100644 (file)
 void
 ldbm_back_close( Backend *be )
 {
+       Debug( LDAP_DEBUG_TRACE, "ldbm backend saving nextid\n", 0, 0, 0 );
+       if ( next_id_save( be ) < 0 ) {
+               Debug( LDAP_DEBUG_ANY, "ldbm backend nextid save failed!\n", 0, 0, 0 );
+       }
+
        Debug( LDAP_DEBUG_TRACE, "ldbm backend syncing\n", 0, 0, 0 );
        ldbm_cache_flush_all( be );
        Debug( LDAP_DEBUG_TRACE, "ldbm backend done syncing\n", 0, 0, 0 );
index 703edb33e43d699d7962efcea6b52b8afe61a846..21a7dc5136d74c5d5f044cca336f2e6c909fdd59 100644 (file)
@@ -25,6 +25,10 @@ ldbm_back_init(
        /* arrange to read nextid later (on first request for it) */
        li->li_nextid = NOID;
 
+#if SLAPD_NEXTID_CHUNK > 1
+       li->li_nextid_wrote = NOID;
+#endif
+
        /* default cache size */
        li->li_cache.c_maxsize = DEFAULT_CACHE_SIZE;
 
index ac899e05f779ad41c48da2c189500b10826c0579..e29d86b6ca4e9cb9930d361ade9f27ab19390280 100644 (file)
@@ -82,6 +82,20 @@ next_id_write( Backend *be, ID id )
        return rc;
 }
 
+int
+next_id_save( Backend *be )
+{
+       struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+       ID id = next_id_get( be );
+       int rc = next_id_write( be, id );
+
+       if (rc == 0) {
+               li->li_nextid_wrote = id;
+       }
+
+       return rc;
+}
+
 ID
 next_id( Backend *be )
 {
@@ -97,10 +111,22 @@ next_id( Backend *be )
                if ( li->li_nextid == NOID ) {
                        li->li_nextid = 1;
                }
+
+#if SLAPD_NEXTID_CHUNK > 1
+               li->li_nextid_wrote = li->li_nextid;
+#endif
        }
 
        id = li->li_nextid++;
+
+#if SLAPD_NEXTID_CHUNK > 1
+       if ( li->li_nextid > li->li_nextid_wrote ) {
+               li->li_nextid_wrote += SLAPD_NEXTID_CHUNK;
+               (void) next_id_write( be, li->li_nextid_wrote );
+       }
+#else
        (void) next_id_write( be, li->li_nextid );
+#endif
 
        pthread_mutex_unlock( &li->li_nextid_mutex );
        return( id );
@@ -109,7 +135,7 @@ next_id( Backend *be )
 void
 next_id_return( Backend *be, ID id )
 {
-#ifdef NEXT_ID_RETURN
+#ifdef SLAPD_NEXTID_RETURN
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
 
        pthread_mutex_lock( &li->li_nextid_mutex );
@@ -120,7 +146,10 @@ next_id_return( Backend *be, ID id )
        }
 
        li->li_nextid--;
+
+#if !( SLAPD_NEXTID_CHUCK > 1 )
        (void) next_id_write( be, li->li_nextid );
+#endif
 
        pthread_mutex_unlock( &li->li_nextid_mutex );
 #endif
@@ -141,6 +170,10 @@ next_id_get( Backend *be )
                if ( li->li_nextid == NOID ) {
                        li->li_nextid = 1;
                }
+
+#if SLAPD_NEXTID_CHUNK > 1
+               li->li_nextid_wrote = li->li_nextid;
+#endif
        }
 
        id = li->li_nextid;
index c70d20a1c013d616b823641aefb5a6c41a30c1a7..b9fd37bbdc582c04e4610399558b9c2f986a5b42 100644 (file)
@@ -130,6 +130,7 @@ int index_add_values LDAP_P(( Backend *be, char *type, struct berval **vals, ID
 ID next_id LDAP_P(( Backend *be ));
 void next_id_return LDAP_P(( Backend *be, ID id ));
 ID next_id_get LDAP_P(( Backend *be ));
+int next_id_save LDAP_P(( Backend *be ));
 
 LDAP_END_DECL
 #endif