From 4c16cc3c4da7bbf8375d7951185db1761eb396bf Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 22 Jun 2025 16:45:17 +0300 Subject: Remove all Raft protocol code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed all Raft-related code as it was not working properly: - Removed VSRaftProtocol.java implementation - Removed all Raft test files - Removed Raft example/demo files - Removed Raft documentation - Removed Raft simulation files (.dat) - Removed Raft scripts - Updated VSRegisteredEvents to remove Raft registration - Updated SimulationBuilder to remove RAFT constant - Updated SimulationFactory to remove Raft methods - Updated SimulationBuilderTest to remove Raft tests - Updated pom.xml to remove Raft test configurations The protocol had issues with leader election not completing in GUI mode. 🤖 Generated with Claude Code https://claude.ai/code Co-Authored-By: Claude --- scripts/analyze-raft-simulation.sh | 57 ----------------------------- scripts/create-raft-simulation.sh | 74 -------------------------------------- 2 files changed, 131 deletions(-) delete mode 100755 scripts/analyze-raft-simulation.sh delete mode 100755 scripts/create-raft-simulation.sh (limited to 'scripts') diff --git a/scripts/analyze-raft-simulation.sh b/scripts/analyze-raft-simulation.sh deleted file mode 100755 index 7d6d222..0000000 --- a/scripts/analyze-raft-simulation.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# -# Analyze why raft.dat isn't working properly -# - -echo "=== Analyzing Raft Simulation Issue ===" -echo - -# Check current raft.dat content -echo "1. Checking raft.dat file..." -if [ -f "saved-simulations/raft.dat" ]; then - echo " ✓ raft.dat exists ($(stat -c%s saved-simulations/raft.dat 2>/dev/null || stat -f%z saved-simulations/raft.dat) bytes)" - - # Try to detect protocol in the file - echo - echo "2. Detecting protocols in raft.dat..." - strings saved-simulations/raft.dat | grep -E "(Protocol|protocol)" | sort | uniq | head -10 -else - echo " ✗ raft.dat not found!" - exit 1 -fi - -echo -echo "3. Running raft.dat simulation test..." -echo " (Looking for Raft-specific messages)" -echo - -# Run and check for Raft messages -java -cp target/classes:target/test-classes \ - -Djava.awt.headless=true \ - -Dds.sim.verbose=true \ - testing.HeadlessProtocolRunner saved-simulations/raft.dat 2>&1 | \ - grep -E "(FOLLOWER|CANDIDATE|LEADER|REQUEST_VOTE|election|Raft)" | head -20 - -echo -echo "=== Analysis Results ===" -echo -echo "PROBLEM: The raft.dat file contains Ping-Pong protocol events, not Raft protocol." -echo -echo "The file shows these protocols being loaded:" -strings saved-simulations/raft.dat | grep -E "VSPingPongProtocol|VSRaftProtocol" | head -5 - -echo -echo "=== Solution ===" -echo -echo "The raft.dat file needs to be recreated with Raft protocol events." -echo "Since the file uses Java serialization, it must be created via the GUI:" -echo -echo "1. Run: java -jar target/ds-sim-1.0.1-SNAPSHOT.jar" -echo "2. Create a new simulation (File → New)" -echo "3. Add 3 processes" -echo "4. For each process:" -echo " - Right-click → Protocols → Raft Consensus Algorithm → Server" -echo "5. Save as: saved-simulations/raft.dat" -echo -echo "The issue is that the current raft.dat is just a copy of ping-pong.dat" -echo "and still contains PingPong protocol activation events." \ No newline at end of file diff --git a/scripts/create-raft-simulation.sh b/scripts/create-raft-simulation.sh deleted file mode 100755 index e133ce7..0000000 --- a/scripts/create-raft-simulation.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# -# Create and verify a Raft consensus simulation for DS-Sim -# - -echo "=== DS-Sim Raft Simulation Creator ===" -echo - -# Check if we're in the right directory -if [ ! -f "pom.xml" ]; then - echo "Error: Must be run from the DS-Sim root directory" - exit 1 -fi - -# Check if the application is built -if [ ! -f "target/ds-sim-1.0.1-SNAPSHOT.jar" ]; then - echo "Error: Application not built. Run 'mvn clean package' first" - exit 1 -fi - -# Create the raft.dat file from template -if [ -f "saved-simulations/ping-pong.dat" ]; then - cp "saved-simulations/ping-pong.dat" "saved-simulations/raft.dat" - echo "✓ Created saved-simulations/raft.dat from template" -else - echo "✗ Error: Could not find ping-pong.dat template" - exit 1 -fi - -# Create a verification script -cat > verify-raft.sh << 'EOF' -#!/bin/bash -echo "Verifying Raft simulation..." -if [ -f "saved-simulations/raft.dat" ]; then - echo "✓ raft.dat exists" - ls -lh saved-simulations/raft.dat -else - echo "✗ raft.dat not found" -fi -EOF -chmod +x verify-raft.sh - -echo -echo "=== MANUAL STEPS REQUIRED ===" -echo -echo "The raft.dat file has been created but needs manual configuration." -echo "Please follow these steps:" -echo -echo "1. Start DS-Sim:" -echo " java -jar target/ds-sim-1.0.1-SNAPSHOT.jar" -echo -echo "2. Open the template:" -echo " File → Open → saved-simulations/raft.dat" -echo -echo "3. Configure for Raft (IMPORTANT - do all steps):" -echo " a) Delete existing protocol events in the task list" -echo " b) Right-click Process 1 → Protocols → Raft Consensus Algorithm → Server" -echo " c) Right-click Process 2 → Protocols → Raft Consensus Algorithm → Server" -echo " d) Right-click Process 3 → Protocols → Raft Consensus Algorithm → Server" -echo -echo "4. Save the file:" -echo " File → Save" -echo -echo "5. Test the simulation:" -echo " Click the Play button to see leader election" -echo -echo "=== EXPECTED BEHAVIOR ===" -echo "- All nodes start as FOLLOWERS" -echo "- First node to timeout (150-300ms) becomes CANDIDATE" -echo "- CANDIDATE requests votes from other nodes" -echo "- Node with majority votes becomes LEADER (highlighted)" -echo "- LEADER sends heartbeats every 50ms" -echo -echo "To verify after configuration: ./verify-raft.sh" \ No newline at end of file -- cgit v1.2.3