Work in progress

This site is in the process of being reviewed and updated.

Partition structure

A Partition is defined by its structure, which is configured in an instance of PartitionConfiguration. All the parameters are set in the server.xml file.

Here is the hierarchy of the configuration classes :

If we need to create a PartitionConfiguration, we should instanciate one of the two classes : MutableBTreePartitionConfiguration or MutablePartitionConfiguration.

Hierarchy improvement

As only to two lower classes can be extended, it could be interesting to transform the base class - PartitionConfiguration - to an interface, and declare the BTreePartitionConfiguration to be abstract. Further more, we may have partitions which will not be BTree, so this intermediate class should be renamed to something different

Looking for a partition

We may manage more than one partition into ADS. Each partition is defined by its name (which is a valid DN) and has an underlying storage.

When we have to process a request, the first thing to do is to determinate the partition on which the request will be processed. 

A request DN as three components : <entry RDN> <context path> <partition name>. For instance, if we have defined a partition named dc=example, dc=com, then for the delete operation applied on cn=test, ou=apache, dc=example, dc=com, the DN can be decomposed in those three parts :

- <entry DN> : cn=test

- <context path> : ou=apache

- <partition name> : dc=example, dc=com.

Now, we have to find the partition for each operation, so we have to be efficient. As we may have more than one partition, this can be a costly operation.

Let's use another exemple. Suppose that we have defined the following partitions in an hypothetic server :

- dc=eee, dc=fff

- dc=ggg, dc=fff

- dc=aaa, dc= bbb

- dc=ddd

- dc=yyy, dc=xxx, dc=ccc, dc=bbb

- dc=zzz, dc=xxx, dc=ccc, dc=bbb

- dc=ttt, dc=xxx, dc=ccc, dc=bbb

Partitions must not overide : if "dc=ddd" is a partition, then "dc=eee, dc=ddd" must not be a partition.

This is quite a lot of partitions, but anyway. Here is a picture of the partition tree :

Now, if we have an operaion on cn=test, dc=xxx, dc=ccc, dc=bbb, we have to check this tree starting from the last RDN until we found the longest matching RDN chain (here, it will be dc=xxx, dc=ccc, dc=bbb). We need a data structure which allows us to find the partition fast. The basic algorihm should be something like :

for each RDN into the operation DN, starting on the rightmost RDN, do

  if the rdn string is not contained in the current tree level

    then return the gathered partition

    else

      if the current level has some children

        then add the current name to the gathered partition name, and move the current partition to the children level

        else return the gathered partition

The next picture shows which part of the tree have been matched :

Building this structure from a list of partition is quite easy. We will store data into HashMaps so that matching will be fast. Here is the algorithm

buildPartitionStructure( hashMap, partitionDN, partition ) ==>
if partitionDN.size == 1
  then hashMap.put( partition.getRdn(0), partition )
  else hashMap.put( partition.getRdn(0), buildPartitionStructure( new hashMap(), partitionDN.remove( 0 ), partition ) )

This will create the following structure in memory :

Now, if we want to find the partition a DN is associated to, we have to use this algorithm:

getPartition( DN, index, partitions ) ==>

if index > DN.size()
  then erreur : no partition found

currentPartition = partitions.get( DN.getRdn( index ) );

if currentPartition is null
  then erreur : no partition found
  else if currentPartition is pointing to another level
    then getpartition( DN, index+1, currentPartition )
    else return currentPartition

Data

Here are the data stored and managed by a PartitionConfiguration

Name

Type

Role

name

String

Partition name. This name will be used to create the directory where the files will be stored, so avoid any special chars

suffix

String

The root naming context. It should be unique, and not nested into anothe rnaming context

contextEntry

Attributes

The entry associated to this context (note : what is is good for ?)

contextPartition

Partition

Tha associated partition

indexedAttributes

Set

The set of attributes which will be indexed

cacheSize

int

The cache size, expressed as a number of entries.

System Partition

The system partition is used to store all informations related to users, groups, and administrative account. (TO BE COMPLETED)

Here are the configuration values for this partition :

name

value

name

system

suffix

ou=system

contextEntry

objectClass: top
objectClass: organizationalUnit
objectClass: extensibleObject
ou: system

indexedAttributes

1.2.6.1.4.1.18060.1.1.1.3.1 - apacheNdn (100 entries)
1.2.6.1.4.1.18060.1.1.1.3.2 - apacheUpdn (100 entries)
1.2.6.1.4.1.18060.1.1.1.3.3 - apacheExistance (100 entries)
1.2.6.1.4.1.18060.1.1.1.3.4 - apacheHierarchy (100 entries)
1.2.6.1.4.1.18060.1.1.1.3.5 - apacheOneAlias (10 entries)
1.2.6.1.4.1.18060.1.1.1.3.6 - apacheSubAlias (10 entries)
1.2.6.1.4.1.18060.1.1.1.3.7 - apacheAlias (10 entries)
ou (100 entries)
uid (100 entries)
objectClass (100 entries)

cacheSize

100 entries

  • No labels