Hi oo4load,
Where did you sent it to? Through this site or directly sent to my email?
I received your pseudo codes last week just like this shown below:
buildDatacenterAndServerModel(configurationFile) {
enum zookeeperRole PARTICIPANT, OBSERVER, NONE, DOWN
object datacenter has servers
object server has zookeeperRole configuredRole, zookeeperRole activeRole
parse(configurationFile) into (datacenter, servers);
}
shiftMajority(designatedSurvivorDatacenter) {
designatedSurvivorDatacenter.someObserver.dynamicReconfigure(server=PARTICIPANT)
otherDatacenter.someParticipant.dynamicReconfigure(server=OBSERVER)
}
balanceServerRoles() {
if (designatedSurvivorDatacenter.hasMinimumQuorum)
someParticipant.dynamicReconfigure(server=OBSERVER)
if (quorumSize.aboveSafeLimit)
someObserver.dynamicReconfigure(server=PARTICIPANT)
//This is a lot more complicated than 2 simple commands, you need an
algorithm or define several scenarios.
}
main() {
buildDatacenterAndServerModel(configurationFile);
while (IamLeader) {
parse(zk.getData(“/zookeeper/config”)) into servers.configuredRole;
foreach(server) getServerRole(“server:8081/commands/stat”) into
servers.activeRole;
foreach(server.activeRole=DOWN) dynamicReconfigure(server=OBSERVER);
server.setConfiguredRole(OBSERVER);
if(designatedSurvivorDatacenter != datacenter.hasMajority)
shiftMajority(designatedSurvivorDatacenter);
balanceServerRoles();
}
}
If this above is not what you mean, would you please send it again?
Really appreciate for your kindness!
--
Sent from: http://zookeeper-user.578899.n2.nabble.com/