Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orbea -
OpenLDAP
Commits
44504848
Commit
44504848
authored
11 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
ITS#7329 optimize index update for simple add ops
Don't need to reindex all the attr values if there were no deletes.
parent
c350b51a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
servers/slapd/back-bdb/modify.c
+42
-4
42 additions, 4 deletions
servers/slapd/back-bdb/modify.c
servers/slapd/back-mdb/modify.c
+42
-4
42 additions, 4 deletions
servers/slapd/back-mdb/modify.c
with
84 additions
and
8 deletions
servers/slapd/back-bdb/modify.c
+
42
−
4
View file @
44504848
...
...
@@ -228,7 +228,9 @@ int bdb_modify_internal(
mod
->
sm_op
=
SLAP_MOD_SOFTDEL
;
if
(
err
==
LDAP_NO_SUCH_ATTRIBUTE
)
{
if
(
err
==
LDAP_SUCCESS
)
{
got_delete
=
1
;
}
else
if
(
err
==
LDAP_NO_SUCH_ATTRIBUTE
)
{
err
=
LDAP_SUCCESS
;
}
...
...
@@ -338,6 +340,9 @@ int bdb_modify_internal(
if
(
a2
)
{
/* need to detect which values were deleted */
int
i
,
j
;
/* let add know there were deletes */
if
(
a2
->
a_flags
&
SLAP_ATTR_IXADD
)
a2
->
a_flags
|=
SLAP_ATTR_IXDEL
;
vals
=
op
->
o_tmpalloc
(
(
ap
->
a_numvals
+
1
)
*
sizeof
(
struct
berval
),
op
->
o_tmpmemctx
);
j
=
0
;
...
...
@@ -375,9 +380,42 @@ int bdb_modify_internal(
for
(
ap
=
e
->
e_attrs
;
ap
!=
NULL
;
ap
=
ap
->
a_next
)
{
if
(
ap
->
a_flags
&
SLAP_ATTR_IXADD
)
{
ap
->
a_flags
&=
~
SLAP_ATTR_IXADD
;
rc
=
bdb_index_values
(
op
,
tid
,
ap
->
a_desc
,
ap
->
a_nvals
,
e
->
e_id
,
SLAP_INDEX_ADD_OP
);
if
(
ap
->
a_flags
&
SLAP_ATTR_IXDEL
)
{
/* if any values were deleted, we must readd index
* for all remaining values.
*/
ap
->
a_flags
&=
~
SLAP_ATTR_IXDEL
;
rc
=
bdb_index_values
(
op
,
tid
,
ap
->
a_desc
,
ap
->
a_nvals
,
e
->
e_id
,
SLAP_INDEX_ADD_OP
);
}
else
{
/* if this was only an add, we only need to index
* the added values.
*/
for
(
ml
=
modlist
;
ml
!=
NULL
;
ml
=
ml
->
sml_next
)
{
struct
berval
*
vals
;
if
(
ml
->
sml_desc
!=
ap
->
a_desc
||
!
ml
->
sml_numvals
)
continue
;
switch
(
ml
->
sml_op
)
{
case
LDAP_MOD_ADD
:
case
LDAP_MOD_REPLACE
:
case
LDAP_MOD_INCREMENT
:
case
SLAP_MOD_SOFTADD
:
case
SLAP_MOD_ADD_IF_NOT_PRESENT
:
if
(
ml
->
sml_op
==
LDAP_MOD_INCREMENT
)
vals
=
ap
->
a_nvals
;
else
if
(
ml
->
sml_nvalues
)
vals
=
ml
->
sml_nvalues
;
else
vals
=
ml
->
sml_values
;
rc
=
bdb_index_values
(
op
,
tid
,
ap
->
a_desc
,
vals
,
e
->
e_id
,
SLAP_INDEX_ADD_OP
);
break
;
}
if
(
rc
)
break
;
}
}
if
(
rc
!=
LDAP_SUCCESS
)
{
Debug
(
LDAP_DEBUG_ANY
,
"%s: attribute
\"
%s
\"
index add failure
\n
"
,
...
...
This diff is collapsed.
Click to expand it.
servers/slapd/back-mdb/modify.c
+
42
−
4
View file @
44504848
...
...
@@ -228,7 +228,9 @@ int mdb_modify_internal(
mod
->
sm_op
=
SLAP_MOD_SOFTDEL
;
if
(
err
==
LDAP_NO_SUCH_ATTRIBUTE
)
{
if
(
err
==
LDAP_SUCCESS
)
{
got_delete
=
1
;
}
else
if
(
err
==
LDAP_NO_SUCH_ATTRIBUTE
)
{
err
=
LDAP_SUCCESS
;
}
...
...
@@ -338,6 +340,9 @@ int mdb_modify_internal(
if
(
a2
)
{
/* need to detect which values were deleted */
int
i
,
j
;
/* let add know there were deletes */
if
(
a2
->
a_flags
&
SLAP_ATTR_IXADD
)
a2
->
a_flags
|=
SLAP_ATTR_IXDEL
;
vals
=
op
->
o_tmpalloc
(
(
ap
->
a_numvals
+
1
)
*
sizeof
(
struct
berval
),
op
->
o_tmpmemctx
);
j
=
0
;
...
...
@@ -375,9 +380,42 @@ int mdb_modify_internal(
for
(
ap
=
e
->
e_attrs
;
ap
!=
NULL
;
ap
=
ap
->
a_next
)
{
if
(
ap
->
a_flags
&
SLAP_ATTR_IXADD
)
{
ap
->
a_flags
&=
~
SLAP_ATTR_IXADD
;
rc
=
mdb_index_values
(
op
,
tid
,
ap
->
a_desc
,
ap
->
a_nvals
,
e
->
e_id
,
SLAP_INDEX_ADD_OP
);
if
(
ap
->
a_flags
&
SLAP_ATTR_IXDEL
)
{
/* if any values were deleted, we must readd index
* for all remaining values.
*/
ap
->
a_flags
&=
~
SLAP_ATTR_IXDEL
;
rc
=
mdb_index_values
(
op
,
tid
,
ap
->
a_desc
,
ap
->
a_nvals
,
e
->
e_id
,
SLAP_INDEX_ADD_OP
);
}
else
{
/* if this was only an add, we only need to index
* the added values.
*/
for
(
ml
=
modlist
;
ml
!=
NULL
;
ml
=
ml
->
sml_next
)
{
struct
berval
*
vals
;
if
(
ml
->
sml_desc
!=
ap
->
a_desc
||
!
ml
->
sml_numvals
)
continue
;
switch
(
ml
->
sml_op
)
{
case
LDAP_MOD_ADD
:
case
LDAP_MOD_REPLACE
:
case
LDAP_MOD_INCREMENT
:
case
SLAP_MOD_SOFTADD
:
case
SLAP_MOD_ADD_IF_NOT_PRESENT
:
if
(
ml
->
sml_op
==
LDAP_MOD_INCREMENT
)
vals
=
ap
->
a_nvals
;
else
if
(
ml
->
sml_nvalues
)
vals
=
ml
->
sml_nvalues
;
else
vals
=
ml
->
sml_values
;
rc
=
mdb_index_values
(
op
,
tid
,
ap
->
a_desc
,
vals
,
e
->
e_id
,
SLAP_INDEX_ADD_OP
);
break
;
}
if
(
rc
)
break
;
}
}
if
(
rc
!=
LDAP_SUCCESS
)
{
Debug
(
LDAP_DEBUG_ANY
,
"%s: attribute
\"
%s
\"
index add failure
\n
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment