Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/wal/wal_aof.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ func (wl *WALAOF) Init(t time.Time) error {
case RotationModeTime:
go wl.rotateSegmentPeriodically()
go wl.deleteSegmentPeriodically()
default:
return nil
}
return nil
}
Expand Down Expand Up @@ -163,7 +165,7 @@ func (wl *WALAOF) LogCommand(c *wire.Command) error {

// If the entry size is greater than the buffer size, we need to
// create a new buffer.
if entrySize > uint32(len(bb)) {
if entrySize > uint32(cap(bb)) {
// TODO: In this case, we can do a one time creation
// of a new buffer and proceed rather than using the
// existing buffer.
Expand All @@ -179,7 +181,7 @@ func (wl *WALAOF) LogCommand(c *wire.Command) error {
binary.LittleEndian.PutUint32(bb[4:8], uint32(len(b)))
copy(bb[8:], b)

wl.bufWriter.Write(bb)
_, _ = wl.bufWriter.Write(bb)

wl.currentSegmentSize += entrySize

Expand Down