diff --git a/servers/slapd/back-mdb/init.c b/servers/slapd/back-mdb/init.c index 7b2fb3004477db4623d1a80dbe54ce83e3eaf9b9..75d4cdd01e5f09d1a4735b2e0dc6ce7232074333 100644 --- a/servers/slapd/back-mdb/init.c +++ b/servers/slapd/back-mdb/init.c @@ -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 ); + } } }