Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmsc818fall2023projects
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Keleher
cmsc818fall2023projects
Commits
8b985b16
Commit
8b985b16
authored
1 year ago
by
Peter J. Keleher
Browse files
Options
Downloads
Patches
Plain Diff
auto
parent
2d40c0f5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
p4cmds.txt
+5
-1
5 additions, 1 deletion
p4cmds.txt
p5.md
+57
-53
57 additions, 53 deletions
p5.md
with
62 additions
and
54 deletions
p4cmds.txt
+
5
−
1
View file @
8b985b16
...
...
@@ -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
E
cho
e
cho
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
...
...
This diff is collapsed.
Click to expand it.
p5.md
+
57
−
53
View file @
8b985b16
# 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
**
).
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment