MarkLogic 10 and Data Hub 5.0

Latest MarkLogic releases provide a smarter, simpler, and more secure way to integrate data.

Read Blog →


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up →

Rebalancing, replication and forest reordering
26 May 2016 12:23 PM


This KB article talks specifically about how the Rebalancer interacts with database replication, and how to solve the issues that may arise if not configured correctly.

For a general discussion on how rebalancing works in MarkLogic, refer to this article and the server documentation.

Rebalancing and replication

When database replication is configured for a database, rebalancing will not take place on Replica until database replication is broken. Until the time when the primary is available, forest to forest mapping will remain.

It is important to make sure that the assignment policy on the Replica is the same as the Master - so that in a DR situation, when the Replica takes over as the Primary, rebalancing is not triggered.

Forest order mismatch can cause Rebalancing

Forest order is the order in which forests are attached the the database. When the document assignment policy is set to either 'Legacy' or 'Bucket', it is required that the Replica database configuration should have the same forest order as the Master to ensure rebalancing does not occur if or when replication is deconfigured.

If there is a difference in forest orders between the Master and the Replica, a Warning level message is logged on the Replica, which looks like this:

2015-10-21 13:34:59.359 Warning: forest order mismatch: local forest Test_12 is at position 15 
while foreign master forest 2108358988113530610 (cluster=8893136914265436826) is at position 12

In this state, when replication is broken, and the Replica takes over as the primary, then rebalancing starts off and it could take variable amount of time depending on how many documents need to be rebalanced.

Fixing the forest order:

The following steps help in removing the mismatch and making the forest order same on both Master and Replica:

i. Break/deconfigure replication

ii. Disable rebalancing on both clusters for the database in question.

iii. Obtain the forest order from the Master cluster - below is the query: