Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
Open
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
8 changes: 4 additions & 4 deletions internal/wal/wal_forge.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,14 @@ func (wl *walForge) segments() ([]string, error) {
return nil, err
}

fullSegmentPrefix := filepath.Join(config.Config.WALDir, segmentPrefix)

sort.Slice(files, func(i, j int) bool {
s1, _ := strconv.Atoi(strings.Split(strings.TrimPrefix(files[i], segmentPrefix), ".")[0])
s2, _ := strconv.Atoi(strings.Split(strings.TrimPrefix(files[i], segmentPrefix), ".")[0])
s1, _ := strconv.Atoi(strings.Split(strings.TrimPrefix(files[i], fullSegmentPrefix), ".")[0])
s2, _ := strconv.Atoi(strings.Split(strings.TrimPrefix(files[j], fullSegmentPrefix), ".")[0])
return s1 < s2
})

// TODO: Check that the segment files are returned in the correct order
// The order has to be in ascending order of the segment index.
return files, nil
}

Expand Down