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",
"mainClass": "com.yuandian.dataflow.Server",
"projectName": "dataflow",
"console": "integratedTerminal",
"args": [
"0"
],
"preLaunchTask": "rename",
"presentation": {
"reveal": "always",
"plane": "new",
"hidden": false,
"group": "",
"order": 1
}
},
{
"type": "java",
@ -20,9 +29,17 @@
"request": "launch",
"mainClass": "com.yuandian.dataflow.Server",
"projectName": "dataflow",
"console": "integratedTerminal",
"args": [
"1"
],
"presentation": {
"reveal": "always",
"plane": "new",
"hidden": false,
"group": "",
"order": 2
}
},
{
"type": "java",
@ -30,29 +47,28 @@
"request": "launch",
"mainClass": "com.yuandian.dataflow.Server",
"projectName": "dataflow",
"console": "integratedTerminal",
"args": [
"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": [
{
"name": "Rafts-Server",
"configurations": ["Raft-0","Raft-1", "Raft-2"]
"configurations": ["Raft-0","Raft-1", "Raft-2"],
"preLaunchTask": "clear old data"
}
]
}

32
.vscode/tasks.json vendored
View File

@ -18,17 +18,35 @@
},
},
{
"label": "stopall",
"label": "clear old data",
"type": "shell",
"command": "sh stop.sh",
"command": "sh clear_old_data.sh",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"close": true
},
"panel": "new",
"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
public void loop(MasterContext cxt) {
try {
Thread.sleep(3000);
} catch (InterruptedException e1) {
e1.printStackTrace();
return;
}
var alivePeers = List.copyOf(StateFactory.getRaftNode().listAlivePeers());
log.debug("master({}) execute {}", StateFactory.getServerId(),