]> git.sur5r.net Git - openldap/commitdiff
mdb_db_close() should not force env_sync in quick mode
authorHoward Chu <hyc@openldap.org>
Tue, 13 Sep 2011 08:28:37 +0000 (01:28 -0700)
committerHoward Chu <hyc@openldap.org>
Tue, 13 Sep 2011 08:28:37 +0000 (01:28 -0700)
servers/slapd/back-mdb/init.c

index 7b2fb3004477db4623d1a80dbe54ce83e3eaf9b9..75d4cdd01e5f09d1a4735b2e0dc6ce7232074333 100644 (file)
@@ -279,13 +279,17 @@ mdb_db_close( BackendDB *be, ConfigReply *cr )
 
                        mdb_txn_abort( txn );
 
-                       /* force a sync */
-                       rc = mdb_env_sync( mdb->mi_dbenv, 1 );
-                       if( rc != 0 ) {
-                               Debug( LDAP_DEBUG_ANY,
-                                       "mdb_db_close: database \"%s\": "
-                                       "mdb_env_sync failed: %s (%d).\n",
-                                       be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
+                       /* force a sync, but not if we were ReadOnly,
+                        * and not in Quick mode.
+                        */
+                       if (!(slapMode & (SLAP_TOOL_QUICK|SLAP_TOOL_READONLY))) {
+                               rc = mdb_env_sync( mdb->mi_dbenv, 1 );
+                               if( rc != 0 ) {
+                                       Debug( LDAP_DEBUG_ANY,
+                                               "mdb_db_close: database \"%s\": "
+                                               "mdb_env_sync failed: %s (%d).\n",
+                                               be->be_suffix[0].bv_val, mdb_strerror(rc), rc );
+                               }
                        }
                }