Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
ab9b08f8
Commit
ab9b08f8
authored
Oct 12, 2013
by
Howard Chu
Browse files
ITS
#7725
add MDB_NORDAHEAD flag for env_open
parent
5a9ddfd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/lmdb.h
View file @
ab9b08f8
...
@@ -275,6 +275,8 @@ typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *rel
...
@@ -275,6 +275,8 @@ typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *rel
#define MDB_NOTLS 0x200000
#define MDB_NOTLS 0x200000
/** don't do any locking, caller must manage their own locks */
/** don't do any locking, caller must manage their own locks */
#define MDB_NOLOCK 0x400000
#define MDB_NOLOCK 0x400000
/** don't do readahead (no effect on Windows) */
#define MDB_NORDAHEAD 0x800000
/** @} */
/** @} */
/** @defgroup mdb_dbi_open Database Flags
/** @defgroup mdb_dbi_open Database Flags
...
@@ -538,6 +540,12 @@ int mdb_env_create(MDB_env **env);
...
@@ -538,6 +540,12 @@ int mdb_env_create(MDB_env **env);
* that no readers are using old transactions while a writer is
* that no readers are using old transactions while a writer is
* active. The simplest approach is to use an exclusive lock so that
* active. The simplest approach is to use an exclusive lock so that
* no readers may be active at all when a writer begins.
* no readers may be active at all when a writer begins.
* <li>#MDB_NORDAHEAD
* Turn off readahead. Most operating systems perform readahead on
* read requests by default. This option turns it off if the OS
* supports it. Turning it off may help random read performance
* when the DB is larger than RAM and system RAM is full.
* The option is not implemented on Windows.
* </ul>
* </ul>
* @param[in] mode The UNIX permissions to set on created files. This parameter
* @param[in] mode The UNIX permissions to set on created files. This parameter
* is ignored on Windows.
* is ignored on Windows.
...
...
libraries/liblmdb/mdb.c
View file @
ab9b08f8
...
@@ -3283,14 +3283,17 @@ mdb_env_map(MDB_env *env, void *addr, int newsize)
...
@@ -3283,14 +3283,17 @@ mdb_env_map(MDB_env *env, void *addr, int newsize)
env
->
me_map
=
NULL
;
env
->
me_map
=
NULL
;
return
ErrCode
();
return
ErrCode
();
}
}
/* Turn off readahead. It's harmful when the DB is larger than RAM. */
if
(
flags
&
MDB_NORDAHEAD
)
{
/* Turn off readahead. It's harmful when the DB is larger than RAM. */
#ifdef MADV_RANDOM
#ifdef MADV_RANDOM
madvise
(
env
->
me_map
,
env
->
me_mapsize
,
MADV_RANDOM
);
madvise
(
env
->
me_map
,
env
->
me_mapsize
,
MADV_RANDOM
);
#else
#else
#ifdef POSIX_MADV_RANDOM
#ifdef POSIX_MADV_RANDOM
posix_madvise
(
env
->
me_map
,
env
->
me_mapsize
,
POSIX_MADV_RANDOM
);
posix_madvise
(
env
->
me_map
,
env
->
me_mapsize
,
POSIX_MADV_RANDOM
);
#endif
/* POSIX_MADV_RANDOM */
#endif
/* POSIX_MADV_RANDOM */
#endif
/* MADV_RANDOM */
#endif
/* MADV_RANDOM */
}
#endif
/* _WIN32 */
#endif
/* _WIN32 */
/* Can happen because the address argument to mmap() is just a
/* Can happen because the address argument to mmap() is just a
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment