ports/databases/openldap/patches/patch-servers_slapd_back-mdb_init_c

38 lines
1.2 KiB
Text

yes, we're still non-coherent for mmap/file io
Index: servers/slapd/back-mdb/init.c
--- servers/slapd/back-mdb/init.c.orig
+++ servers/slapd/back-mdb/init.c
@@ -170,6 +170,32 @@ mdb_db_open( BackendDB *be, ConfigReply *cr )
flags = mdb->mi_dbenv_flags;
+#ifdef __OpenBSD__
+ /*
+ * Enforce that MDB_WRITEMAP is set.
+ *
+ * MDB assumes a unified buffer cache.
+ *
+ * See http://www.openldap.org/pub/hyc/mdm-paper.pdf section 3.1,
+ * references 17, 18, and 19.
+ *
+ * From Howard Chu: "This requirement can be relaxed in the
+ * current version of the library. If you create the environment
+ * with the MDB_WRITEMAP option then all reads and writes are
+ * performed using mmap, so the file buffer cache is irrelevant.
+ * Of course then you lose the protection that the read-only
+ * map offers."
+ */
+
+ if ( !(flags & MDB_WRITEMAP) ) {
+ flags |= MDB_WRITEMAP;
+ Debug( LDAP_DEBUG_ANY,
+ LDAP_XSTRING(mdb_db_open) ": forcing writemap for database \"%s\". "
+ "This is required on systems without unified buffer cache.\n",
+ be->be_suffix[0].bv_val, rc, 0 );
+ }
+#endif
+
if ( slapMode & SLAP_TOOL_QUICK )
flags |= MDB_NOSYNC|MDB_WRITEMAP;