1
0
Fork 0

Make it clearer why checksum checks not needed

master
Philip O'Toole 10 months ago
parent 4c31c480f5
commit ab3671d66c

@ -40,6 +40,8 @@ const (
numETx = "execute_transactions"
numQTx = "query_transactions"
numRTx = "request_transactions"
CheckpointQuery = "PRAGMA wal_checkpoint(TRUNCATE)" // rqlite WAL compaction requires truncation
)
var (
@ -485,7 +487,7 @@ func (db *DB) CheckpointWithTimeout(dur time.Duration) (err error) {
var nMoved int
f := func() error {
err := db.rwDB.QueryRow("PRAGMA wal_checkpoint(TRUNCATE)").Scan(&ok, &nPages, &nMoved)
err := db.rwDB.QueryRow(CheckpointQuery).Scan(&ok, &nPages, &nMoved)
stats.Add(numCheckpointedPages, int64(nPages))
stats.Add(numCheckpointedMoves, int64(nMoved))
if err != nil {

@ -49,7 +49,8 @@ func NewFastCompactingScanner(r io.ReadSeeker) (*CompactingScanner, error) {
// If fullScan is true, the scanner will perform a full scan of the WAL file, performing
// a checksum on each frame. If fullScan is false, the scanner will only scan the file
// sufficiently to find the last valid frame for each page. This is faster when the
// caller knows that the WAL file is valid and does not need to be checked.
// caller knows that the entire WAL file is valid, and will not contain pages from a
// previous checkpointing operation.
func NewCompactingScanner(r io.ReadSeeker, fullScan bool) (*CompactingScanner, error) {
walReader := NewReader(r)
err := walReader.ReadHeader()

Loading…
Cancel
Save