2.5 Partition and Replica Tasks

This section provides procedures for reading information about partitions and replicas and for managing them (adding, moving, joining, splitting, and deleting).

2.5.1 Adding a Replica

To add a replica of an existing partition to a server, complete the following step.

  1. Call NWDSAddReplica with the name of the partition's root object.

    This function adds replicas only of type secondary or read-only. You identify the partition to be replicated by supplying the name of the partition’s root object.

See Also:

2.5.2 Changing the Type of a Replica

To change a replica’s type, complete the following step.

  1. Call NWDSChangeReplicaType.

    You identify the replica by passing in the name of the server containing the replica and the name of the partition’s root object. If you change a replica’s type to master, the current master replica will be changed to a secondary replica.

See Also:

2.5.3 Joining Partitions

To join a subordinate partition to its parent, complete the following step.

  1. Call NWDSJoinPartitions.

    You can perform this operation only on master replicas residing on the same server. You can join two partitions if no secondary or read-only replicas of either partition exist. The two partitions joined must be a subordinate partition and its parent.

See Also:

2.5.4 Listing Partitions and Retrieving Partition Information

To obtain information about the partitions stored on a specified server, complete the following steps.

  1. Allocate a result buffer to receive the results by calling NWDSAllocBuf. (The buffer does not need to be initialized since it is a result buffer.)

  2. Set the iteration handle to NO_MORE_ITERATIONS.

  3. Obtain the partition information by calling NWDSListPartitions.

  4. Determine the number of partitions whose information is stored in the result buffer by calling NWDSGetServerName.

  5. For each partition whose information is stored in the buffer, retrieve the partition name and type by calling NWDSGetPartitionInfo.

  6. If the iteration handle is set to NO_MORE_ITERATIONS, go to Step 7; otherwise, loop to Step 3.

  7. Free the buffer when it is no longer needed by calling NWDSFreeBuf.

If you decide to stop retrieving partition information before iterationHandle is set to NO_MORE_ITERATIONS, call NWDSCloseIteration to free memory and state information associated with the partition listing operation.

See Also:

2.5.5 Removing Partitions

To delete a partition, complete the following step.

  1. Call NWDSRemovePartition.

    You can remove a partition only if there are no secondary or read-only replicas of the partition. The partition must also be empty, containing no other objects except the root container object.

See Also:

2.5.6 Removing Replicas

To delete a replica of a partition, complete the following step.

  1. Call NWDSRemoveReplica.

    You identify the replica by supplying the name of the server and the name of the partition’s root object. This function can remove only secondary and read-only replicas.

NOTE:NWDSJoinPartitions removes the master replica of the subordinate partition.

See Also:

2.5.7 Splitting Partitions

To divide a partition at a specified object, complete the following step.

  1. Call NWDSSplitPartition.

    The specified object becomes the root object of the subordinate partition. Split operations are always performed on the master replica.

See Also: