Skip to content

Commit

Permalink
Merge branch 'vault-hackweek-archiveWAL' into add-deletability
Browse files Browse the repository at this point in the history
# Conflicts:
#	wal.go
  • Loading branch information
ncabatoff committed Nov 8, 2023
2 parents c85aa91 + 774964f commit 7f40b67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion segment/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ func (w *Writer) appendIndex() error {
// Record the file offset where the index starts (the actual index data so
// after the frame header).
w.writer.indexStart = uint64(w.writer.writeOffset) + uint64(startOff+frameHeaderLen)
fmt.Println("Hamid - in appendIndex - index start of the write is: ", w.writer.indexStart)
return nil
}

Expand Down
5 changes: 2 additions & 3 deletions wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"io"
"os"
"path/filepath"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -386,12 +387,10 @@ func (w *WAL) GetSealedLogFiles(fromIndex uint64) ([]*SealedSegmentInfo, error)
for !it.Done() {
_, seg, ok := it.Prev()
if !ok {
fmt.Println("break ", seg.BaseIndex, seg.MaxIndex, seg.IndexStart)
break
}
// if the segment sealTime is zero, it means that the segment has not been sealed yet
if seg.SealTime.IsZero() {
fmt.Println("Continue....segment unseal", seg.BaseIndex, seg.MinIndex)
continue
}

Expand All @@ -400,7 +399,7 @@ func (w *WAL) GetSealedLogFiles(fromIndex uint64) ([]*SealedSegmentInfo, error)
// target index also include that.
if ok && seg.MinIndex >= fromIndex || seg.MaxIndex >= fromIndex {
sealedSegInfo = append(sealedSegInfo, &SealedSegmentInfo{
Path: seg.FileName(),
Path: filepath.Join(w.dir, seg.FileName()),
MinIndex: seg.MinIndex,
LogCount: (seg.MaxIndex - seg.MinIndex) + 1, // including the maxIndex
})
Expand Down

0 comments on commit 7f40b67

Please sign in to comment.