Skip to content

Commit

Permalink
fix: events: sqlite db improvements
Browse files Browse the repository at this point in the history
* fix unclosed multi-row query
* tune options to limit wal growth

Ref: #12089
  • Loading branch information
rvagg committed Jun 14, 2024
1 parent 63b9577 commit a1bd8cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chain/events/filter/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ var pragmas = []string{
"PRAGMA temp_store = memory",
"PRAGMA mmap_size = 30000000000",
"PRAGMA page_size = 32768",
"PRAGMA auto_vacuum = NONE", // not useful until we implement GC
"PRAGMA auto_vacuum = NONE",
"PRAGMA automatic_index = OFF",
"PRAGMA journal_mode = WAL",
"PRAGMA read_uncommitted = ON",
"PRAGMA wal_autocheckpoint = 256", // checkpoint @ 256 pages
"PRAGMA journal_size_limit = 0", // always reset journal and wal files
}

// Any changes to this schema should be matched for the `lotus-shed indexes backfill-events` command
Expand Down Expand Up @@ -751,6 +752,7 @@ func (ei *EventIndex) prefillFilter(ctx context.Context, f *eventFilter, exclude
}
return xerrors.Errorf("exec prefill query: %w", err)
}
defer q.Close()

Check failure on line 755 in chain/events/filter/index.go

View workflow job for this annotation

GitHub Actions / Check (lint-all)

Error return value of `q.Close` is not checked (errcheck)

var ces []*CollectedEvent
var currentID int64 = -1
Expand Down Expand Up @@ -839,7 +841,6 @@ func (ei *EventIndex) prefillFilter(ctx context.Context, f *eventFilter, exclude
Codec: row.codec,
Value: row.value,
})

}

if ce != nil {
Expand Down

0 comments on commit a1bd8cf

Please sign in to comment.