Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 897e453

Browse files
committed
WAL Log rotation locks mutex
1 parent ca20a26 commit 897e453

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/wal/wal_forge.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ func (wl *walForge) rotateLogIfNeeded(entrySize uint32) error {
194194
// incrementing the current segment index, and opening a new segment file.
195195
func (wl *walForge) rotateLog() error {
196196
fmt.Println("rotating log")
197+
wl.mu.Lock()
198+
defer wl.mu.Unlock()
199+
197200
// TODO: Ideally this function should not return any error
198201
// Check for the conditions where it can return an error
199202
// and handle them gracefully.

0 commit comments

Comments
 (0)