todo: 调试

This commit is contained in:
huangsimin 2022-08-01 00:27:00 +08:00
parent d1429e8114
commit 52a6169323
4 changed files with 64 additions and 21 deletions

44
.vscode/launch.json vendored
View File

@ -10,9 +10,18 @@
"request": "launch", "request": "launch",
"mainClass": "com.yuandian.dataflow.Server", "mainClass": "com.yuandian.dataflow.Server",
"projectName": "dataflow", "projectName": "dataflow",
"console": "integratedTerminal",
"args": [ "args": [
"0" "0"
], ],
"preLaunchTask": "rename",
"presentation": {
"reveal": "always",
"plane": "new",
"hidden": false,
"group": "",
"order": 1
}
}, },
{ {
"type": "java", "type": "java",
@ -20,9 +29,17 @@
"request": "launch", "request": "launch",
"mainClass": "com.yuandian.dataflow.Server", "mainClass": "com.yuandian.dataflow.Server",
"projectName": "dataflow", "projectName": "dataflow",
"console": "integratedTerminal",
"args": [ "args": [
"1" "1"
], ],
"presentation": {
"reveal": "always",
"plane": "new",
"hidden": false,
"group": "",
"order": 2
}
}, },
{ {
"type": "java", "type": "java",
@ -30,29 +47,28 @@
"request": "launch", "request": "launch",
"mainClass": "com.yuandian.dataflow.Server", "mainClass": "com.yuandian.dataflow.Server",
"projectName": "dataflow", "projectName": "dataflow",
"console": "integratedTerminal",
"args": [ "args": [
"2" "2"
], ],
"presentation": {
"reveal": "always",
"plane": "new",
"hidden": false,
"group": "",
"order": 3
}
}, },
// {
// "type": "java",
// "name": "Launch Server",
// "request": "launch",
// "mainClass": "com.yuandian.dataflow.Server",
// "projectName": "dataflow",
// "args": [
// "2"
// ],
// "preLaunchTask": "restart",
// "postDebugTask": "stopall"
// }
], ],
"compounds": [ "compounds": [
{ {
"name": "Rafts-Server", "name": "Rafts-Server",
"configurations": ["Raft-0","Raft-1", "Raft-2"] "configurations": ["Raft-0","Raft-1", "Raft-2"],
"preLaunchTask": "clear old data"
} }
] ]
} }

30
.vscode/tasks.json vendored
View File

@ -18,17 +18,35 @@
}, },
}, },
{ {
"label": "stopall", "label": "clear old data",
"type": "shell", "type": "shell",
"command": "sh stop.sh", "command": "sh clear_old_data.sh",
"presentation": { "presentation": {
"echo": true, "echo": true,
"reveal": "always", "reveal": "always",
"focus": false, "focus": false,
"panel": "shared", "panel": "new",
"close": true "showReuseMessage": true,
"clear": false,
"close": false
},
},
{
"label": "rename",
"type": "shell",
"command": "ehco ${workbench.action.terminal.rename}",
"args": [
"123"
]
}, },
}
]
],
} }

3
clear_old_data.sh Normal file
View File

@ -0,0 +1,3 @@
#! /bin/bash
rm raftdata/ -rf

View File

@ -29,6 +29,12 @@ public class MasterProcessor implements MasterExecute {
@Override @Override
public void loop(MasterContext cxt) { public void loop(MasterContext cxt) {
try {
Thread.sleep(3000);
} catch (InterruptedException e1) {
e1.printStackTrace();
return;
}
var alivePeers = List.copyOf(StateFactory.getRaftNode().listAlivePeers()); var alivePeers = List.copyOf(StateFactory.getRaftNode().listAlivePeers());
log.debug("master({}) execute {}", StateFactory.getServerId(), log.debug("master({}) execute {}", StateFactory.getServerId(),