Skip to content
Snippets Groups Projects
Commit 8b985b16 authored by Peter J. Keleher's avatar Peter J. Keleher
Browse files

auto

parent 2d40c0f5
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ go run cli.go -s :5001 path last E
go run cli.go -s :5001 path last EM
go run cli.go -s :5001 path last EMW
Echo
echo
echo Test 3
killall ubiserver
sleep 5
......@@ -58,10 +58,14 @@ go run cli.go -a -s :5002 put ~/down/sampledis-7.2.1
go run cli.go -s :5001 list | wc ; go run cli.go -s :5002 list | wc
go run cli.go -s :5001 list | wc ; go run cli.go -s :5002 list | wc
go run cli.go -s :5001 list | wc ; go run cli.go -s :5002 list | wc
go run cli.go -s :5001 list | wc ; go run cli.go -s :5002 list | wc
go run cli.go -s :5001 list | wc ; go run cli.go -s :5002 list | wc
killall ubiserver
echo
echo Test 7
docker compose up
go run cli.go -s :5001 list | wc; go run cli.go -s :5002 list | wc; go run cli.go -s :5003 list | wc
go run cli.go -s :5001 put sampledir
go run cli.go -s :5001 list | wc ; go run cli.go -s :5002 list | wc ; go run cli.go -s :5003 list | wc
......
# RAFT
**v1.0**
**v1.1**
## Due: Nov 19, 2023, 11:59:59 pm
## Setup
......@@ -35,7 +35,7 @@ committing client operations.
- **Slow followers:** i.e. followers that are behind and need to be
"caught up" to the leader's log state. We will implement slow
followers by "pausing" containers use the command `docker compose
pause <hostname>`, and later un-pausing them.
pause <hostname>`, and later un-pausing them.
## Command Syntax and Observable Output
......@@ -65,37 +65,27 @@ Your server may print anything with the `-d` flag. Without this flag,
however, it should print at most one line acknowledging when startup
is complete, and then only the following output:
---
At each heartbeat the leader should print:
```
AE [<match index array>] ci:<commit index>, <log len>[<term>-"<cmd>",....]
```
For example, your leader might print out:
```
AE [-1 -1] ci:4, 5[8-"L0",8-"one",8-"two",9-"L1",10-"L1"]
```
The matchindex is an integer slice described as in Figure 2. A
null/nil or "no match" is signified w/ a -1. `ci` is the current
leader commit index. The number before the left bracket ('[') is the
- `AE ci:<commit index>, <log len>[<term>-"<cmd>",....]`: Leader
should print at each heartbeat.
The number before the left bracket ('[') is the
current log length. The entire log is then printed, surrounded by
brackets. Entries have format `<term>-"<cmd>"`, and are separated by
commas.
---
Followers should print the same, but use " " instead of "AE".
---
When a follower converts to candidacy it should print out
"election" alone on a line.
---
During catchup, a server should print a single line for each time it
goes backwards:
```
lastLogIndex <index> <(address:port)
```
---
commas.<br><br>
Example: `AE ci:1, 3[2-"L-2-2",2-"one",2-"two"]`
- Followers should print the same, but use " " instead of "AE".
- `leader term <leader id>`: Should be printed alone on a line when a server becomes
leader.
<br><br>Example: `leader term 1`
- `catchup <server> trying PrevLogIndex <last log index of server>`:
Should be printed during catchup each time the leader decrements its
match for a server and retries an *AppendEntries* with a smaller log index.
Note that occasionally messages are buffered for paused containers in
docker, and then delivered when the container is unpaused. The number
of catchup messages you see might therefore be lower than expected.
<br><br>
Example: `catchup raft1:7000 trying PrevLogIndex 3`
There should be **no other output**, and this output must be followed exactly.
......@@ -103,42 +93,56 @@ There should be **no other output**, and this output must be followed exactly.
## Details
- Use whatever timeouts you want during debugging, but you should use those in the startup file when submitting.
- Use whatever timeouts you want during debugging, but you should use
those in the startup file when submitting, i.e:
- Upon becoming leader, your server should insert a "leader
announcement" command `"L<term>-<id>"`, where term is the new election
term, and id is the new leader's id.
- I am using the following timers/timeouts:
- minElectionTimeout = 3000 * time.Millisecond
- maxElectionTimeout = 6000 * time.Millisecond
- heartbeatInterval = 1000 * time.Millisecond
- `context` timeouts for RPC are one second
## Testing.
You can debug w/ local processes, your choice, but **I will just test
the servers in docker compose**. I will use **my** `Dockerfile` and
`compose.yaml` file.
Note that the following relies on your committing the "leader announcement" from above.
**Test 1 (10 pts)**
Two servers.
- Two-server election, both have to agree.
- Submit a command and verify that the client does not return until
the command has been committed and applied.
- Bring up three servers
- Election
- "leader announcement" command committed
**Test 2 (10 pts)**
Continuing the above...
- Kill the leader and immediately restart; the follower must
become the new leader because it's log is more up-to-date.
- Commit another command and power-cycle the leader again, again verifying
that the follower, with it's more up-to-date log, become leader.
- commit more commands
**Test 3 (10 pts)**
Three servers.
- pause a follower
- commit some commands
- unpause the follower and see it catch up
**Test 4 (10 pts)**
Compose w/ three servers.
- pause the leader
- new election, new leader announcement
- commit more commands
- unpause old leader, watch it catch up
**Test 5 (10 pts)**
Compose w/ three servers:
- pause a follower, verify that the commands can still be committed
- unpause the follower, verify that the follower catches up
- bring up w/ five servers
- test pausing followers, leaders as above
**Test 6 (10 pts)**
Compose w/ three servers:
- pause the leader, verify that the commands can still be committed
after new election
- unpause the previous leader, verify that it rejoins, reverts to a follower, catches up
**Test 7 (10 pts)**
Compose w/ five servers.
## Things that should not be seen
*Committed commands being lost for any reason*. This most commonly arises
when leaders change. Ensure that new leaders are at
least as up-to-date as prior leaders (**leader
selection**).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment