Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
orbea -
OpenLDAP
Commits
1f33a6d9
Commit
1f33a6d9
authored
Jun 22, 2018
by
Howard Chu
Browse files
ITS
#8756
remove loose pg from dirty list in freelist_save
parent
9e859dd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/mdb.c
View file @
1f33a6d9
...
...
@@ -3094,10 +3094,41 @@ mdb_freelist_save(MDB_txn *txn)
* we may be unable to return them to me_pghead.
*/
MDB_page
*
mp
=
txn
->
mt_loose_pgs
;
MDB_ID2
*
dl
=
txn
->
mt_u
.
dirty_list
;
unsigned
x
;
if
((
rc
=
mdb_midl_need
(
&
txn
->
mt_free_pgs
,
txn
->
mt_loose_count
))
!=
0
)
return
rc
;
for
(;
mp
;
mp
=
NEXT_LOOSE_PAGE
(
mp
))
for
(;
mp
;
mp
=
NEXT_LOOSE_PAGE
(
mp
))
{
mdb_midl_xappend
(
txn
->
mt_free_pgs
,
mp
->
mp_pgno
);
/* must also remove from dirty list */
if
(
txn
->
mt_flags
&
MDB_TXN_WRITEMAP
)
{
for
(
x
=
1
;
x
<=
dl
[
0
].
mid
;
x
++
)
if
(
dl
[
x
].
mid
==
mp
->
mp_pgno
)
break
;
mdb_tassert
(
txn
,
x
<=
dl
[
0
].
mid
);
}
else
{
x
=
mdb_mid2l_search
(
dl
,
mp
->
mp_pgno
);
mdb_tassert
(
txn
,
dl
[
x
].
mid
==
mp
->
mp_pgno
);
}
dl
[
x
].
mptr
=
NULL
;
mdb_dpage_free
(
env
,
mp
);
}
{
/* squash freed slots out of the dirty list */
unsigned
y
;
for
(
y
=
1
;
dl
[
y
].
mptr
&&
y
<=
dl
[
0
].
mid
;
y
++
);
if
(
y
<=
dl
[
0
].
mid
)
{
for
(
x
=
y
,
y
++
;;)
{
while
(
!
dl
[
y
].
mptr
&&
y
<=
dl
[
0
].
mid
)
y
++
;
if
(
y
>
dl
[
0
].
mid
)
break
;
dl
[
x
++
]
=
dl
[
y
++
];
}
dl
[
0
].
mid
=
x
-
1
;
}
else
{
/* all slots freed */
dl
[
0
].
mid
=
0
;
}
}
txn
->
mt_loose_pgs
=
NULL
;
txn
->
mt_loose_count
=
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