#531 loading an entry from the database should use str2entry_fast
Closed: Fixed None Opened 7 years ago by lkrispen.

When loading an entry from the backend it is known to be well formed and str2entry_fast() could be used, but always str2entry_dupcheck() is called.
The reason is that id2entry() sets the flag SLAPI_STR2ENTRY_NO_ENTRYDN and this flag is not contained in the set of flags known to be handled by str2entry_fast() although it does have code for this flag


A good catch, Ludwig. It's a bug. Thank you for finding it out!

Fix Description: This patch is adding flags SLAPI_STR2ENTRY_
NO_ENTRYDN and SLAPI_STR2ENTRY_DN_NORMALIZED to the local
macro SLAPI_STRENTRY_FLAGS_HANDLED_IN_SLAPI_STR2ENTRY,
which is used to determine the string formatted entry can be
processed by str2entry_fast or not. Also, this patch defines
a macro str2entry_can_use_fast to increase the code readability.

Reviewed by Mark (Thank you!!!).

Pushed to master: commit 7af4fc1

Would prefer that macros are in ALL CAPS to distinguish them from regular functions.

Also, the logic looks strange:
{{{
+ if (str2entry_can_use_fast(flags))
+ {
e= str2entry_dupcheck( NULL/dn/, s, flags, read_stateinfo );
- }
- else
- {
+ }
+ else
+ {
e= str2entry_fast( NULL/dn/, s, flags, read_stateinfo );
- }
}}}

It looks like if (str2entry_can_use_fast(flags)) then do not call str2entry_fast, call str2entry_dupcheck instead - is this as intended?

Description: Based upon the comments by Rich Megginson (Thanks!!),
changing the newly introduced macro to all upper case. Plus, it
was pointed out that the meaning of the macro name was opposite.
Fixing these 2 issues, this patch replaces the macro str2entry_
can_use_fast with STR2ENTRY_CANNOT_USE_FAST.

Thanks to Rich for his reviews and comments!!

Pushed to master: commit b3a0ab7

Rich Megginson wrote:

And if we know that all teh entries will be read from disk, we should ensure that their version is not exposed to #531 and str2entry_fast is used.
I don't think that fix is in 1.2.11 - I suppose we could consider a backport to 6.5

This patch is in 1.3.0 and newer, but not in 1.2.11.

I set 1.2.11.22 to milestone.

Pushed to 389-ds-base-1.2.11: commit b5dc3db

Note: 389-ds-base-1.3.0 was branched after this patch is pushed to master. Thus, 389-ds-base-1.3.0 as well as 1.3.1 include this fix.

Metadata Update from @rmeggins:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.2.11.22

2 years ago

Login to comment on this ticket.

Metadata