Skip to content

AveryQi115/6.824

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

6.824(sp 2022).

Lab2D的心得

  • chanApply是一个不带缓冲区的channel,test在收满SnapshotInterval个Apply Command之后调用SnapshotapplyLog中对于chanApply的写入阻塞

    所以如果在请求了锁的区域中写chanApply会导致锁迟迟不释放,test又调用Snapshot请求锁,导致死锁(go-deadlock debug出来的)

  • test调用Snapshot,Snapshot生成快照写Apply msg,test接收到会将该server的lastApplied设置为快照的lastIncludedIndex,如果applyLog和Snapshot并发,在快照前发送的Apply command会被test丢弃,在快照后发送的apply command需要按照lastIncludedIndex+1的顺序往后

    • 试过用select case chanApply<-xx写,但这会导致微小的阻塞也会使applyLog return,整体速度减慢,无法通过测试
    • 试过用Snapshot发送停止applyLog信号,但是信号的延迟导致不定期产生apply out of order
  • 最后的做法是test的代码本质是clerk,SnapshotInterval应该clerk和raft server都能感知,所以raft server主动发送到SnapshotInterval个command就停止

    • 这样的话原来的applyLog设计(每次更改CommitIndex调用applyLog就太慢了)需要改成一个goroutine定时发现applyLog

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published