Modifying distributed infobase node structure
In conclusion, we need to point out that the distributed infobase feature includes software tools for reconfiguring the node structure.
The SetMasterNode() method of the ExchangePlansManager object is used for this purpose.
A reference to the exchange plan node of a distributed infobase that becomes the master for the current infobase is passed as a method parameter. You can pass the Undefined value to indicate that the current infobase has no master node.
Suppose you need to move one of the subordinate nodes to the root (fig. 24.33).
Fig. 24.33. Reconfiguring node structure
To do so, you have to run the script shown in listing 24.34.
Listing 24.34. Moving Node2 to the tree root
// In the Node2 infobase ExchangePlansManager.SetMasterNode(Undefined); // In the Node1 infobase ExchangePlansManager.SetMasterNode(Node2);
This script deletes all the Node1 configuration change records for Node2 because after its execution the transfer of configuration changes is only allowed from Node2 to Node1. Data change records are not deleted because data exchange between these nodes is still allowed.
In a similar manner you can use the Undefined value of the method parameter to detach an individual infobase or a subtree from the tree structure (fig. 24.34, listing 24.35).
Fig. 24.34. Detaching a subtree from a distributed infobase
Listing 24.35. Detaching a subtree
// In the Node1 infobase ExchangePlansManager.SetMasterNode(Undefined);
In addition, you can assemble a distributed infobase from individual infobases with identical configurations (fig. 24.35, listing 24.36).
Fig. 24.35. Infobase composed of individual infobases with identical configurations
Listing 24.36. Assembling a distributed infobase from infobases with identical configurations
// In the infobases of Node2, Node3, and Node4 ExchangePlansManager.SetMasterNode(Node1);