Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
rvagg committed Jun 14, 2024

Verified

This commit was signed with the committer’s verified signature.
rvagg Rod Vagg
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
@@ -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
@@ -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

GitHub Actions / Check (lint-all)

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

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

}

if ce != nil {

0 comments on commit a1bd8cf

Please sign in to comment.