New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Size returned by slapi_entry_size is not accurate #1014
Comments
Comment from nhosoi (@nhosoi) at 2014-01-18 06:47:13 git patch file (master) |
Comment from rmeggins (@richm) at 2014-01-20 22:57:42 I notice that slapi_dn_size does not include the sizeof(Slapi_DN) but slapi_sdn_get_size() does. Is this intentional? It seems to me that including sizeof(Slapi_DN) is correct but I don't know if slapi_entry_size had some reason for not including it. Also, I'm not sure if sizeof(Slapi_RWLock) is the total amount of memory allocated by slapi_rwlock_new(). I think it is, but if it isn't, we don't have an easy way to calculate it. I also note that slapi_entry_size does not take into consideration the following fields: But I think we should investigate this in another ticket. |
Comment from nhosoi (@nhosoi) at 2014-01-25 05:40:38 Ticket has been cloned to Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1057805 |
Comment from nhosoi (@nhosoi) at 2014-02-11 04:07:52 Description: slapi_entry_size calculating the entry size had issues. |
Comment from nhosoi (@nhosoi) at 2014-02-11 04:08:59 git patch file (master; take 2) -- added the size of e_extension |
Comment from rmeggins (@richm) at 2014-02-11 04:12:29 Replying to [comment:7 nhosoi]:
If we want an accurate size in memory, then I think we need to account for that. Let's say someone creates the entry in the cache with the "raw" DN. The size is calculated at the time it is added to the cache, without the normalized DN. Sometime later, someone calls slapi_sdn_get_ndn() on that entry which changes the entry. Now, the size of the cache is not correct because the cache size does not take into account the size of the normalized dn.
|
Comment from nhosoi (@nhosoi) at 2014-02-11 04:19:33 Replying to [comment:8 richm]:
It makes sense. On the other hand, we want to avoid calling malloc as much as possible... :) I could add a function slapi_sdn_get_maxsize, which returns 3 * existing DN (regardless of normalized or raw). Do we prefer that way? |
Comment from rmeggins (@richm) at 2014-02-11 05:50:34 Replying to [comment:9 nhosoi]:
I don't know. Worst case, you have 10 million entries that you overestimate by 100 bytes each. That's a lot of memory that cannot be used. In most cases, we are going to have to use the normalized DN, right? So, better to take the malloc hit when adding to the cache rather than later. |
Comment from nhosoi (@nhosoi) at 2014-02-11 06:12:16 Replying to [comment:10 richm]:
Right. And it looks I did not have to emphasize the loose ndn generation... Before adding an entry to the entry cache, it anyway generates the ndn (line 1261), then calculates the size (line 1261). So, it's guaranteed ndn exists before calling slapi_entry_size via cache_entry_size.
|
Comment from nhosoi (@nhosoi) at 2014-02-11 08:03:53 Reviewed by Rich (Thank you!!) Pushed to master: Pushed to 389-ds-base-1.3.2: Pushed to 389-ds-base-1.3.1: Pushed to 389-ds-base-1.2.11: |
Comment from nhosoi (@nhosoi) at 2017-02-11 23:10:22 Metadata Update from @nhosoi:
|
Cloned from Pagure issue: https://pagure.io/389-ds-base/issue/47677
It can be replaced with a slapi api slapi_sdn_get_size.
The text was updated successfully, but these errors were encountered: