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
Joe Martin
OpenLDAP
Commits
9d821c26
Commit
9d821c26
authored
Sep 03, 2011
by
Howard Chu
Browse files
Fix mdb_split, fix MDB_GET_BOTH
parent
e91dae3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/libmdb/mdb.c
View file @
9d821c26
...
...
@@ -2580,6 +2580,7 @@ set2:
int
ex2
,
*
ex2p
;
if
(
op
==
MDB_GET_BOTH
)
{
ex2p
=
&
ex2
;
ex2
=
0
;
}
else
{
ex2p
=
NULL
;
}
...
...
@@ -3662,34 +3663,32 @@ mdb_split(MDB_txn *txn, MDB_dbi dbi, MDB_page **mpp, unsigned int *newindxp,
/* Maximum free space in an empty page */
pmax
=
txn
->
mt_env
->
me_psize
-
PAGEHDRSZ
;
nsize
=
mdb_leaf_size
(
txn
->
mt_env
,
newkey
,
newdata
);
if
(
newindx
<=
split_indx
)
{
split1:
if
(
newindx
<
split_indx
)
{
psize
=
nsize
;
for
(
i
=
0
;
i
<
split_indx
;
i
++
)
{
node
=
NODEPTR
(
&
mdp
->
p
,
i
);
psize
+=
NODESIZE
+
NODEKSZ
(
node
);
psize
+=
NODESIZE
+
NODEKSZ
(
node
)
+
sizeof
(
indx_t
)
;
if
(
F_ISSET
(
node
->
mn_flags
,
F_BIGDATA
))
psize
+=
sizeof
(
pgno_t
);
else
psize
+=
NODEDSZ
(
node
);
if
(
psize
>
pmax
)
{
split_indx
--
;
goto
split1
;
split_indx
=
i
;
break
;
}
}
}
else
{
split2:
psize
=
nsize
;
for
(
i
=
split_indx
;
i
<
nkeys
;
i
++
)
{
for
(
i
=
nkeys
-
1
;
i
>=
split_indx
;
i
--
)
{
node
=
NODEPTR
(
&
mdp
->
p
,
i
);
psize
+=
NODESIZE
+
NODEKSZ
(
node
);
psize
+=
NODESIZE
+
NODEKSZ
(
node
)
+
sizeof
(
indx_t
)
;
if
(
F_ISSET
(
node
->
mn_flags
,
F_BIGDATA
))
psize
+=
sizeof
(
pgno_t
);
else
psize
+=
NODEDSZ
(
node
);
if
(
psize
>
pmax
)
{
split_indx
++
;
goto
split2
;
split_indx
=
i
+
1
;
break
;
}
}
}
...
...
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