Mercurial > hg > Database > Christie
changeset 183:1bffd8151c6a
fix paxos
author | akahori |
---|---|
date | Sat, 02 Feb 2019 15:19:20 +0900 |
parents | 1559aa74dc74 |
children | a4c221542fa9 |
files | src/main/java/christie/test/topology/paxos/acceptor/AcceptCodeGear.java src/main/java/christie/test/topology/paxos/acceptor/PromiseCodeGear.java src/main/java/christie/test/topology/paxos/learner/AggregateProposalCodeGear.java src/main/java/christie/test/topology/paxos/learner/RecieveAcceptProposalCodeGear.java |
diffstat | 4 files changed, 8 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/test/topology/paxos/acceptor/AcceptCodeGear.java Sat Feb 02 15:18:17 2019 +0900 +++ b/src/main/java/christie/test/topology/paxos/acceptor/AcceptCodeGear.java Sat Feb 02 15:19:20 2019 +0900 @@ -21,8 +21,6 @@ @Take Proposal acceptProposal; - Pattern pattern = Pattern.compile("^(proposer|acceptor|learner)([0-9]+)$"); - @Take Proposal promisedProposal; @@ -36,16 +34,12 @@ acceptProposal.setAccepted(true); acceptProposal.setAcceptorName(topoDG.getNodeName()); - logger.debug("accept " + acceptProposal); - promisedProposal = acceptProposal; for (String connectionNodeName : _CLIST){ - Matcher matcher = pattern.matcher(connectionNodeName); - matcher.find(); - if(matcher.group(1).equals("learner")) { - logger.debug("send learner " + promisedProposal); - put(connectionNodeName, "acceptedProposal", promisedProposal); + if(connectionNodeName.matches("learner" + ".*")) { + logger.debug("send " + connectionNodeName + " " + promisedProposal); + getDGM(connectionNodeName).put("acceptedProposal", promisedProposal); } } }
--- a/src/main/java/christie/test/topology/paxos/acceptor/PromiseCodeGear.java Sat Feb 02 15:18:17 2019 +0900 +++ b/src/main/java/christie/test/topology/paxos/acceptor/PromiseCodeGear.java Sat Feb 02 15:19:20 2019 +0900 @@ -30,7 +30,7 @@ } } put("promisedProposal", promisedProposal); - logger.debug("promise code gear : promise " + promisedProposal); + logger.debug("promise " + promisedProposal); put(prepareProposal.getProposerName(),"receivePromise", promisedProposal); cgm.setup(new PromiseCodeGear()); }
--- a/src/main/java/christie/test/topology/paxos/learner/AggregateProposalCodeGear.java Sat Feb 02 15:18:17 2019 +0900 +++ b/src/main/java/christie/test/topology/paxos/learner/AggregateProposalCodeGear.java Sat Feb 02 15:19:20 2019 +0900 @@ -5,6 +5,7 @@ import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; import christie.test.topology.paxos.Proposal; +import christie.topology.Message; import christie.topology.node.TopologyNodeConfig; import java.util.HashMap; @@ -27,8 +28,7 @@ count++; if(count > proposal.getAcceptorNum()/2) { System.out.println("finish " + proposal); - break; - //getDGM(topologyNodeConfig.getManagerKey()).put("finish", ""); + getDGM(topologyNodeConfig.getManagerKey()).put("FINISHMESSAGE", new Message()); } proposalValueMap.replace(value, count); }else{ @@ -36,5 +36,6 @@ } } put("acceptedMap", acceptedMap); + cgm.setup(new RecieveAcceptProposalCodeGear()); } }
--- a/src/main/java/christie/test/topology/paxos/learner/RecieveAcceptProposalCodeGear.java Sat Feb 02 15:18:17 2019 +0900 +++ b/src/main/java/christie/test/topology/paxos/learner/RecieveAcceptProposalCodeGear.java Sat Feb 02 15:19:20 2019 +0900 @@ -24,6 +24,6 @@ acceptedProposal); put("acceptedMap", acceptedMap); if(acceptedMap.size() > acceptedProposal.getAcceptorNum()/2) cgm.setup(new AggregateProposalCodeGear()); - cgm.setup(new RecieveAcceptProposalCodeGear()); + else cgm.setup(new RecieveAcceptProposalCodeGear()); } }