diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 99c8c37e4d9b..972706c08998 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -19,5 +19,6 @@ "ghcr.io/devcontainers/features/docker-from-docker:1": { "version": "latest" } - } + }, + "postCreateCommand": "DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install gdb -y" } diff --git a/.vscode/launch.json b/.vscode/launch.json index b45c53c037e3..a09f5ae99a3a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -124,6 +124,25 @@ "postRunCommands": [ "process handle --pass true --stop false --notify true SIGILL" ] + }, + { + "name": "Debug Raft Test Scenarios (gdb)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/raft_driver", + "args": ["${file}"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/tests/raft_scenarios/", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] } ] } diff --git a/src/consensus/aft/test/logging_stub.h b/src/consensus/aft/test/logging_stub.h index 46962ce4332b..6a6d83520e7a 100644 --- a/src/consensus/aft/test/logging_stub.h +++ b/src/consensus/aft/test/logging_stub.h @@ -294,6 +294,7 @@ namespace aft { auto configuration = consensus->get_latest_configuration_unsafe(); std::unordered_set retired_nodes; + std::list itrs; // Remove and track retired nodes for (auto it = configuration.begin(); it != configuration.end(); ++it) @@ -301,9 +302,13 @@ namespace aft if (new_configuration.find(it->first) == new_configuration.end()) { retired_nodes.emplace(it->first); - it = configuration.erase(it); + itrs.push_back(it); } } + for (auto it : itrs) + { + configuration.erase(it); + } // Add new node to configuration for (const auto& [node_id, _] : new_configuration)