Issue 9150 - olcDbNoSync: FALSE has the same effect as olcDbNoSync: TRUE
Summary: olcDbNoSync: FALSE has the same effect as olcDbNoSync: TRUE
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.48
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-09 20:46 UTC by maxime.besson@worteks.com
Modified: 2020-04-08 07:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description maxime.besson@worteks.com 2020-01-09 20:46:10 UTC
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
Comment 1 Howard Chu 2020-01-11 04:26:09 UTC
maxime.besson@worteks.com wrote:
> 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

Thanks for the report, fixed now in git master.
> 
> 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
> 
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 2 Howard Chu 2020-01-11 04:26:52 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 3 Quanah Gibson-Mount 2020-01-11 23:20:09 UTC
changed notes
changed state Test to Release
Comment 4 OpenLDAP project 2020-01-30 18:34:04 UTC
fixed in master
Fixed in RE24 (2.4.49)
Comment 5 Quanah Gibson-Mount 2020-01-30 18:34:04 UTC
changed notes
changed state Release to Closed