*/
int mdb_env_set_mapsize(MDB_env *env, mdb_size_t size);
+
+ /** @brief Set the size of DB pages in bytes.
+ *
+ * The size defaults to the OS page size. Smaller or larger values may be
+ * desired depending on the size of keys and values being used. Also, an
+ * explicit size may need to be set when using filesystems like ZFS which
+ * don't use the OS page size.
+ */
+int mdb_env_set_pagesize(MDB_env *env, int size);
+
/** @brief Set the maximum number of threads/reader slots for the environment.
*
* This defines the number of slots in the lock table that is used to track readers in the
env->me_mapsize &= ~(VM_ALIGN-1);
env->me_psize = env->me_os_psize;
rc = mdb_env_map(env, NULL);
+ if (rc)
+ return rc;
p = (MDB_page *)env->me_map;
for (i=0; i<NUM_METAS; i++) {
if (!F_ISSET(p->mp_flags, P_META))
return MDB_SUCCESS;
}
+int ESECT
+mdb_env_set_pagesize(MDB_env *env, int size)
+{
+ if (!env || env->me_map)
+ return EINVAL;
+ if (size > MAX_PAGESIZE || size < 256)
+ return EINVAL;
+ if (size & (size-1))
+ return EINVAL;
+ env->me_os_psize = size;
+ return MDB_SUCCESS;
+}
+
/** Common code for #mdb_stat() and #mdb_env_stat().
* @param[in] env the environment to operate in.
* @param[in] db the #MDB_db record containing the stats to return.
E(mdb_env_create(&env));
E(mdb_env_set_maxreaders(env, 1));
E(mdb_env_set_mapsize(env, 10485760));
+ E(mdb_env_set_pagesize(env, 1024));
E(mdb_env_open(env, "./testdb", MDB_FIXEDMAP /*|MDB_NOSYNC*/, 0664));
E(mdb_txn_begin(env, NULL, 0, &txn));