Simulating a multi-master scenario

A multi-master scenario can be simulated using the administrator command or an API. This provides a mechanism for testing an application running in, and restoring from, a multi-master scenario.

[Warning]

Multi-master scenario simulation should only be used in a test environment. It should not be used in a production cluster.

A multi-master simulation is triggered using the broadcast updates partition property. When this property is set to false, any changes in a partition definition are not broadcast to the other nodes in a cluster when the partition is enabled. This allows a partition to be active on multiple nodes in a cluster. The broadcast updates property can be set using the Partition.Properties API or the define partition administrative command.

[Warning]

The broadcast updates property must be explicitly reset to true to re-enable normal cluster operation.

A multi-master scenario can only be simulated when redefining a partition on a node that is not currently in a partition's node list as either the active or a replica node. Example 7.18, “Multi-master simulation” demonstrates the administrator commands to create a multi-master scenario.

Example 7.18. Multi-master simulation

//
//  Define and enable partition X
//
administrator servicename=A define partition name=X activenode=A replicas=B
administrator servicename=A enable partition name=X 

//
//  Partition X status on active node A
//
administrator servicename=A display partition name=X 
Partition Name = X
Partition State = Active
Partition Status = LocalEnabled
Last State Change Time = 2014-05-28 08:53:34
Active Node = A
Replica Nodes = B:synchronous
Replicate To Existing = false
Object Batch Size = 1000
Number Of Threads = 1
Restore From Node = 
Mapped Types = 
Broadcast Definition Updates = true

//
//  Partition X status on replica node B
//
administrator servicename=B display partition name=X 
Partition Name = X
Partition State = Active
Partition Status = RemoteEnabled
Last State Change Time = 2014-05-28 08:53:34
Active Node = A
Replica Nodes = B:synchronous
Replicate To Existing = false
Object Batch Size = 1000
Number Of Threads = 1
Restore From Node = 
Mapped Types = 
Broadcast Definition Updates = true

//
// Redefine partition X on node C with broadcast updates disabled
//
administrator servicename=C define partition name=X activenode=C replicas=B broadcastupdates=false
administrator servicename=C enable partition name=X

//
// Partition X is now active on node C with a replica of B
//
administrator servicename=C display partition name=X 
Partition Name = X
Partition State = Active
Partition Status = LocalEnabled
Last State Change Time = 2014-05-28 09:00:05
Active Node = C
Replica Nodes = B:synchronous
Replicate To Existing = false
Object Batch Size = 1000
Number Of Threads = 1
Restore From Node = 
Mapped Types = 
Broadcast Definition Updates = false

//
//  Partition X remains active on node A since
//  broadcast updates were disabled
//
administrator servicename=A display partition name=X 
Partition Name = X
Partition State = Active
Partition Status = LocalEnabled
Last State Change Time = 2014-05-28 08:57:25
Active Node = A
Replica Nodes = B:synchronous
Replicate To Existing = false
Object Batch Size = 1000
Number Of Threads = 1
Restore From Node = 
Mapped Types = 
Broadcast Definition Updates = true

//
//  Node B is now a replica for node C
//                                           
administrator servicename=B display partition name=X 
Partition Name = X
Partition State = Active
Partition Status = LocalEnabled
Last State Change Time = 2014-05-28 09:00:05
Active Node = C
Replica Nodes = B:synchronous
Replicate To Existing = false
Object Batch Size = 1000
Number Of Threads = 1
Restore From Node = 
Mapped Types = 
Broadcast Definition Updates = true