diff --git a/.vscode/launch.json b/.vscode/launch.json index 42668ae..097b04c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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" } ] + } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 029d8f2..97231cc 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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" + ] - } - ] + }, + + + + ], + + + + } \ No newline at end of file diff --git a/clear_old_data.sh b/clear_old_data.sh new file mode 100644 index 0000000..ebdeccf --- /dev/null +++ b/clear_old_data.sh @@ -0,0 +1,3 @@ +#! /bin/bash +rm raftdata/ -rf + \ No newline at end of file diff --git a/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java b/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java index 28c4f2e..f865a58 100644 --- a/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java +++ b/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java @@ -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(),