# distributed **Repository Path**: yumimi0103/distributed ## Basic Information - **Project Name**: distributed - **Description**: mit 6.823的lab作业 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-02-27 - **Last Updated**: 2023-04-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # README ## Raft论文 In Raft we separated **leader election, log replication, safety, and membership changes**. logs are not allowed to have holes ## Lab2 A 参考了https://blog.csdn.net/MarksSa/article/details/127429742 ```shell go test -race -run 2A #这个就是用来进行Lab 2A的测试指令 #在写go发现不支持三元表达式(a==b?true: false)这种 ``` broadcastTime≪ electionTimeout ≪MTBF 论文中称Election timeouts (700-1000ms) 心跳机制的间隔100ms ``` 专门记录问题 Q1:论文中 raft的lastApplied这个是用来干啥的?代码在raft结构体的定义中 ``` ### Timer 利用time.Timer实现了一个定时器,可以设置时间和通过start来实现定时 "crypto/rand" result, _ := rand.Int(rand.Reader, big.NewInt(128)) ### 完成TestReElection2A的一个坑 就是自己开始选举的时候记得投票给自己,还有就是如果自己是领导,就不用给自己发送心跳机制了。