Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
7002d101
Commit
7002d101
authored
Jan 09, 2013
by
Quanah Gibson-Mount
Browse files
Merge remote branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
parents
9ae057ea
cd80a154
Changes
3
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/Makefile
View file @
7002d101
...
...
@@ -38,7 +38,6 @@ mtest3: mtest3.o liblmdb.a
mtest4
:
mtest4.o liblmdb.a
mtest5
:
mtest5.o liblmdb.a
mtest6
:
mtest6.o liblmdb.a
mfree
:
mfree.o liblmdb.a
mdb.o
:
mdb.c lmdb.h midl.h
$(CC)
$(CFLAGS)
-fPIC
$(CPPFLAGS)
-c
mdb.c
...
...
libraries/liblmdb/mdb.c
View file @
7002d101
...
...
@@ -1338,7 +1338,7 @@ none:
MDB_oldpages
*
mop
=
txn
->
mt_env
->
me_pghead
;
if
(
num
>
1
)
{
MDB_cursor
m2
;
int
retry
=
6
0
,
readit
=
0
,
n2
=
num
-
1
;
int
retry
=
50
0
,
readit
=
0
,
n2
=
num
-
1
;
unsigned
int
i
,
j
,
k
;
/* If current list is too short, must fetch more and coalesce */
...
...
@@ -1347,11 +1347,14 @@ none:
mdb_cursor_init
(
&
m2
,
txn
,
FREE_DBI
,
NULL
);
do
{
/* bail out if we're operating on the freelist.
/* If on freelist, don't try to read more. If what we have
* right now isn't enough just use new pages.
* TODO: get all of this working. Many circular dependencies...
*/
if
(
mc
->
mc_dbi
==
FREE_DBI
)
break
;
if
(
mc
->
mc_dbi
==
FREE_DBI
)
{
retry
=
0
;
readit
=
0
;
}
if
(
readit
)
{
MDB_val
key
,
data
;
MDB_oldpages
*
mop2
;
...
...
@@ -2124,7 +2127,7 @@ mdb_txn_commit(MDB_txn *txn)
mdb_cursor_init
(
&
mc
,
txn
,
FREE_DBI
,
NULL
);
/* should only be one record now */
if
(
env
->
me_pghead
)
{
if
(
env
->
me_pghead
||
env
->
me_pgfirst
)
{
/* make sure first page of freeDB is touched and on freelist */
rc
=
mdb_page_search
(
&
mc
,
NULL
,
MDB_PS_MODIFY
);
if
(
rc
&&
rc
!=
MDB_NOTFOUND
)
{
...
...
libraries/liblmdb/mfree.c
deleted
100644 → 0
View file @
9ae057ea
/* mfree.c - memory-mapped database freelist scanner */
/*
* Copyright 2011 Howard Chu, Symas Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in the file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
#define _XOPEN_SOURCE 500
/* srandom(), random() */
#include
<stdio.h>
#include
<stdlib.h>
#include
<time.h>
#include
"lmdb.h"
#include
"midl.h"
int
main
(
int
argc
,
char
*
argv
[])
{
int
rc
;
MDB_env
*
env
;
MDB_dbi
dbi
;
MDB_val
key
,
data
;
MDB_txn
*
txn
;
MDB_stat
mst
;
MDB_cursor
*
cursor
;
MDB_ID
i
,
j
,
*
iptr
;
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"usage: %s <pathname>
\n
"
,
argv
[
0
]);
exit
(
1
);
}
rc
=
mdb_env_create
(
&
env
);
rc
=
mdb_env_open
(
env
,
argv
[
1
],
MDB_RDONLY
,
0664
);
rc
=
mdb_txn_begin
(
env
,
NULL
,
MDB_RDONLY
,
&
txn
);
dbi
=
0
;
rc
=
mdb_cursor_open
(
txn
,
dbi
,
&
cursor
);
while
((
rc
=
mdb_cursor_get
(
cursor
,
&
key
,
&
data
,
MDB_NEXT
))
==
0
)
{
printf
(
"key: %p %zu, data: %p
\n
"
,
key
.
mv_data
,
*
(
MDB_ID
*
)
key
.
mv_data
,
data
.
mv_data
);
iptr
=
data
.
mv_data
;
j
=
*
iptr
++
;
for
(
i
=
0
;
i
<
j
;
i
++
)
printf
(
" %zu
\n
"
,
iptr
[
i
]);
}
mdb_cursor_close
(
cursor
);
mdb_txn_abort
(
txn
);
mdb_env_close
(
env
);
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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