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
f9cdc4f0
Commit
f9cdc4f0
authored
Apr 09, 2016
by
Howard Chu
Browse files
mdb_drop optimization
If we know there are no sub-DBs and no overflow pages, skip leaf scan.
parent
08204319
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/mdb.c
View file @
f9cdc4f0
...
...
@@ -9660,8 +9660,11 @@ mdb_drop0(MDB_cursor *mc, int subs)
/* DUPSORT sub-DBs have no ovpages/DBs. Omit scanning leaves.
* This also avoids any P_LEAF2 pages, which have no nodes.
* Also if the DB doesn't have sub-DBs and has no overflow
* pages, omit scanning leaves.
*/
if
(
mc
->
mc_flags
&
C_SUB
)
if
((
mc
->
mc_flags
&
C_SUB
)
||
(
!
subs
&&
!
mc
->
mc_db
->
md_overflow_pages
))
mdb_cursor_pop
(
mc
);
mdb_cursor_copy
(
mc
,
&
mx
);
...
...
@@ -9683,6 +9686,9 @@ mdb_drop0(MDB_cursor *mc, int subs)
pg
,
omp
->
mp_pages
);
if
(
rc
)
goto
done
;
mc
->
mc_db
->
md_overflow_pages
-=
omp
->
mp_pages
;
if
(
!
mc
->
mc_db
->
md_overflow_pages
&&
!
subs
)
break
;
}
else
if
(
subs
&&
(
ni
->
mn_flags
&
F_SUBDATA
))
{
mdb_xcursor_init1
(
mc
,
ni
);
rc
=
mdb_drop0
(
&
mc
->
mc_xcursor
->
mx_cursor
,
0
);
...
...
@@ -9690,6 +9696,8 @@ mdb_drop0(MDB_cursor *mc, int subs)
goto
done
;
}
}
if
(
!
subs
&&
!
mc
->
mc_db
->
md_overflow_pages
)
goto
pop
;
}
else
{
if
((
rc
=
mdb_midl_need
(
&
txn
->
mt_free_pgs
,
n
))
!=
0
)
goto
done
;
...
...
@@ -9711,6 +9719,7 @@ mdb_drop0(MDB_cursor *mc, int subs)
/* no more siblings, go back to beginning
* of previous level.
*/
pop:
mdb_cursor_pop
(
mc
);
mc
->
mc_ki
[
0
]
=
0
;
for
(
i
=
1
;
i
<
mc
->
mc_snum
;
i
++
)
{
...
...
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