Re: Trying to understand entryrdn.db

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 08/02/2017 11:49 AM, Ilias Stamatis wrote:
Hello,

I would like some help in order to understand entryrdn.db. When I do "dbscan -f entryrdn.db" I get something like:

3
  ID: 3; RDN: "ou=Groups"; NRDN: "ou=groups"

C3
    ID: 6; RDN: "cn=Accounting Managers"; NRDN: "cn=accounting managers"

P6
    ID: 3; RDN: "ou=Groups"; NRDN: "ou=groups"

I understand that 3 is this entry's ID, C3 means child of entry 3 and P6 means parent of entry 6.

What I don't understand however is why those entries are repeated again and again. For example " ID: 7; RDN: "cn=HR Managers"; NRDN: "cn=hr managers" is repeated about a dozen of times in my entryrdn. And I don't mean like a parent, child, or whatever. It is repeated lots of time as ID 7 for example (but also many times as C3, etc.).

I attach the complete output of what I get when I run "dbscan -f entryrdn.db", in order to demonstrate what I mean (my db contains almost default entries only).

So my question is; how is this database filled?
Since I know that you are tying to work on ticket https://pagure.io/389-ds-base/issue/47567, here is the short answer...

This is how you use id2enty and entryrdn together to achieve the desired result...

id2entry:

id 1
    rdn: dc=example,dc=com
    objectClass: top
    ...

id 3
    rdn: ou=Groups
    ...
    ...
    parentid: 1

id 6
    rdn: cn=Accounting Managers
    ...
    ...
    parentid: 3   ----> points to ID 3 ("ou=Groups"), then "groups" parent points to ID 1 ("dc=example,dc=com").  Final result "cn=Accounting Managers, ou=Groups, dc=example,dc=com"


For the purposes of the ticket listed above you need to recreate the full DN of each entry found in id2entry and then print its LDIF format.  So you grab an entry from id2entry, find its parent id, then you recursively keep looking at each parent in entryrdn, building up the DN as you go, until there is no parent id found.


[1]  Get entry from id2entry and use its ID
[2]  Look in entryrdn for the parent of the ID
[3]  Keep looking for parents, building the DN as you go along

Example:

[1]  Get entry from id2entry:  ID 6     --> "cn=Accounting Managers"
[2]  Check entryrdn for "P<ID>".  In this case it's "P6" which is "ou=Groups" with ID 3
[3]  So find "P3", which is "dc=example,dc=com" with ID 1, and look for "P1".  But there is no P1, so we stop the process/loop.

Final result "cn=Accounting Managers, ou=Groups, dc=example,dc=com"


We just want it to be efficient, and not use a lot of memory.  This needs to work on a 100 million entry db without consuming a lot of resources.

I hope that helps.

Mark


Thank you very much,
Ilias


_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx

_______________________________________________
389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux