patch-servers_slapd_back-mdb_init_c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. $OpenBSD: patch-servers_slapd_back-mdb_init_c,v 1.2 2016/02/25 00:45:43 sthen Exp $
  2. XXX maintaining the patch here, but MDB is disabled because last time
  3. it was enabled there were still problems even with this.
  4. --- servers/slapd/back-mdb/init.c.orig Fri Feb 5 23:57:45 2016
  5. +++ servers/slapd/back-mdb/init.c Fri Feb 12 13:38:28 2016
  6. @@ -159,6 +159,32 @@ mdb_db_open( BackendDB *be, ConfigReply *cr )
  7. dbhome = mdb->mi_dbenv_home;
  8. #endif
  9. +#ifdef __OpenBSD__
  10. + /*
  11. + * Enforce that MDB_WRITEMAP is set.
  12. + *
  13. + * MDB assumes a unified buffer cache.
  14. + *
  15. + * See http://www.openldap.org/pub/hyc/mdm-paper.pdf section 3.1,
  16. + * references 17, 18, and 19.
  17. + *
  18. + * From Howard Chu: "This requirement can be relaxed in the
  19. + * current version of the library. If you create the environment
  20. + * with the MDB_WRITEMAP option then all reads and writes are
  21. + * performed using mmap, so the file buffer cache is irrelevant.
  22. + * Of course then you lose the protection that the read-only
  23. + * map offers."
  24. + */
  25. +
  26. + if ( !(flags & MDB_WRITEMAP) ) {
  27. + Debug( LDAP_DEBUG_ANY,
  28. + LDAP_XSTRING(mdb_db_open) ": database \"%s\" does not have writemap. "
  29. + "This is required on systems without unified buffer cache.\n",
  30. + be->be_suffix[0].bv_val, rc, 0 );
  31. + goto fail;
  32. + }
  33. +#endif
  34. +
  35. Debug( LDAP_DEBUG_TRACE,
  36. LDAP_XSTRING(mdb_db_open) ": database \"%s\": "
  37. "dbenv_open(%s).\n",