Skip to content

Commit

Permalink
Merge pull request #200 from hjrbill/bugfix_20241025_lock_append
Browse files Browse the repository at this point in the history
fix: Fixed the issue of traversal without locking during log append.
  • Loading branch information
LLiuJJ authored Nov 9, 2024
2 parents 3183ea2 + edbc59c commit 56cf6c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions raftcore/persistent_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ func (rfLog *RaftLog) LogItemCount() int {
//
// append a new entry to raft logs, put it to storage engine
func (rfLog *RaftLog) Append(newEnt *pb.Entry) {
// rfLog.mu.Lock()
// defer rfLog.mu.Unlock()
rfLog.mu.Lock()
defer rfLog.mu.Unlock()
logIdLast, err := rfLog.dbEng.SeekPrefixKeyIdMax(RaftLogPrefix)
if err != nil {
panic(err)
Expand Down

0 comments on commit 56cf6c2

Please sign in to comment.