2 Commits

Author SHA1 Message Date
jdl
875957f662 Fixed WAL gc age bug 2023-12-05 09:54:41 +01:00
jdl
b251368b09 Cleanup, no logic changes. 2023-12-04 20:25:37 +01:00
3 changed files with 4 additions and 4 deletions

View File

@@ -15,7 +15,7 @@ func (rep *Replicator) runWALGC() {
select {
case <-ticker.C:
state := rep.getState()
before := time.Now().Unix() - rep.conf.WALSegMaxAgeSec
before := time.Now().Unix() - rep.conf.WALSegGCAgeSec
if err := rep.wal.DeleteBefore(before, state.SeqNum); err != nil {
log.Printf("[WAL-GC] failed to delete wal segments: %v", err)
}

View File

@@ -13,13 +13,13 @@ type Index struct {
}
func NewIndex(f *File) (*Index, error) {
maxPage, err := f.maxPage()
firstPage, err := f.pageCount()
if err != nil {
return nil, err
}
idx := &Index{
fList: newFreeList(maxPage),
fList: newFreeList(firstPage),
aList: *newAllocList(),
seen: map[[2]uint64]struct{}{},
mask: []bool{},

View File

@@ -134,7 +134,7 @@ func (pf *File) writePage(page dataPage, id uint64) error {
// Reading
// ----------------------------------------------------------------------------
func (pf *File) maxPage() (uint64, error) {
func (pf *File) pageCount() (uint64, error) {
fi, err := pf.f.Stat()
if err != nil {
return 0, errs.IO.WithErr(err)