Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Term

Description

CSN

Change Sequence Number

MMR

Multi-Master Replication

UUID

Universally Unique IDentifier

...

Replication analysis

Base operations

Replication is meant to transpose a modification done on one server into the associated servers. We should also insure that a modification done on an entry in more than one server does not lead to inconsistencies.

...

  • if the remote server is also starting, but has not yet established is listener, we won't be able to establish the connection
  • if the servers are not time synchronized, we may not be able to correctly replicate a time based operation.

...

Network initialization

When a server starts, after having initialized the internal LDAP service, it has to start the network layer. The following algorithm is used :

...

Note

Another approach would be to rely on a asynchronous system (Messages) to handle the server to server communication. The biggest advantage would be to rely on an proven system to manage connection and retries, instead of coding our own system inside ADS, with all the burden it brings. ActiveMQ could be a good option.

Store

We use a Database to store pending operations.

Database structure

We use 3 tables : REPLICATION_METADATA, REPLICATION_UUID and REPLICATION_LOG.

Note

The "REPLICATION_" prefix can be configured, for instance if one want to define more than one ADS locally. It would make more sense to use the replicaID instead of this prefix, though.

REPLICATION_METADATA structure

field

type

Primary key

description

M_KEY

VARCHAR(30) NOT NULL

Yes

 

M_VALUE

VARCHAR(100) NOT NULL

No

 

REPLICATION_UUID structure

field

type

Primary key

description

UUID

CHAR(36) NOT NULL

Yes

The entry UUID

DN

CLOB NOT NULL

No

The entry DN

REPLICATION_LOG structure

field

type

Primary key

description

CSN_REPLICA_ID

VARCHAR(16) NOT NULL

Yes

The replica ID

CSN_TIMESTAMP

BIGINT NOT NULL

Yes

The Timestamp

CSN_OP_SEQ

INTEGER NOT NULL

Yes

The op sequence

OPERATION

BLOB NOT NULL

no

The replication operation

Configuration

The replication system is a Multi-Master replication, ie, each server can update any server it is connected to. The way you tell a server to replicate to others is simple :

...

Here, for the server instance_a" we have associated two replicas : *instance_b and instance_c. Basically, you just give the list of remote server you want to be connected to.

The replication interceptor

The MITOSIS service is implemented as an interceptor in the current version (1.5.4). The following operations are handled :

...

The hasEntry, list, lookup and search operations are only handled to prevent tombstoned (deleted) entries being returned.

Interceptor initialization

When the interceptor is injected into the chain, its init() method is called, and it will initialize the full replication system. Here are the steps the init() method goes through :

  1. Validate the replication configuration
  2. Initialize the store
  3. Start the CSNFactory
  4. Start the networking sub-system
  5. Purge the aged data from the store

Then the service is ready to process new operations.

Warning

The purge of old data is not done atm unless the server is restarted. It has to be completed.

Operations classes

We are using Operation objects to manage replications inside the interceptor. Here is the Operation classes hierarchy :

...

Note

As we may receive a Add request from a remote server - per replication activation -, we currently create so called glue-entries. There are necessary if we consider that an entry is added when the underlaying tree is absent. It does not make a lot of sense either, because the tree have necessarily been created on the remote server, and the associated created entries have already been transmitted to the local server, thus we don't have to create a glue entryThis can happen in a MMR scenario where those missing entries have not been received yet, but the leaves have been.

Delete operation

It creates a CompositeOperation object, which contains a ReplaceAttributeOperation, as the entry is not deleted, but instead a entryDeleted AttributeType is added to the entry, and a ReplaceAttributeOperation containing the injection of a entryCSN AttributeType, with a newly created CSN.

...