Full_Name: Maxime Besson Version: 2.4.48 OS: Debian Buster / CentOS7 URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (2a01:cb00:802:8400:2cbe:3c60:fca6:e50b)
While migrating configuration from slapd.conf to cn=config, I noticed something pretty strange related to the dbnosync option
The result of converting the following config:
include ./core.schema pidfile ./slapd.1.pid argsfile ./slapd.1.args
database mdb suffix "dc=example,dc=com" rootdn "cn=Manager,dc=example,dc=com" rootpw secret directory db.1.a index objectClass eq index cn,sn,uid pres,eq,sub index entryUUID,entryCSN eq
Is (only interested in MDB config): # AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. # CRC32 3df9c3d6 dn: olcDatabase={1}mdb objectClass: olcDatabaseConfig objectClass: olcMdbConfig olcDatabase: {1}mdb olcSuffix: dc=example,dc=com olcAddContentAcl: FALSE olcLastMod: TRUE olcMaxDerefDepth: 15 olcReadOnly: FALSE olcRootDN: cn=Manager,dc=example,dc=com olcRootPW:: c2VjcmV0 olcSyncUseSubentry: FALSE olcMonitoring: TRUE olcDbDirectory: db.1.a olcDbNoSync: FALSE olcDbIndex: objectClass eq olcDbIndex: entryUUID eq olcDbIndex: entryCSN eq olcDbIndex: cn pres,eq,sub olcDbIndex: uid pres,eq,sub olcDbIndex: sn pres,eq,sub olcDbMaxReaders: 0 olcDbMaxSize: 10485760 olcDbMode: 0600 olcDbSearchStack: 16 olcDbMaxEntrySize: 0 olcDbRtxnSize: 10000
As you can see, olcDbNoSync has the value FALSE, because there was no "dbnosync" option in slapd.conf, however, performance testing shows a dramatic increase in write speed after slapd.d migration. Which seems odd to me. It seems like the MDB database was not syncing to disk anymore despite olcDbNoSync being FALSE
Removing olcDbNoSync: FALSE from cn=config did restore previous performance and syncing behavior
Looking at servers/slapd/back-mdb/config.c:723 I found this:
case MDB_DBNOSYNC: if ( c->value_int ) mdb->mi_dbenv_flags |= MDB_NOSYNC; else mdb->mi_dbenv_flags ^= MDB_NOSYNC;
The else case seems wrong, I replaced it with
case MDB_DBNOSYNC: if ( c->value_int ) mdb->mi_dbenv_flags |= MDB_NOSYNC; else mdb->mi_dbenv_flags &= ~MDB_NOSYNC;
And it solves the issue on my system.
Reproduced on master, and 2.4.48, on Debian