Add WAL overrun validation

Under high write load, it is possible for write transactions from
another process to overrun the WAL between the time when Litestream
performs a RESTART checkpoint and when it obtains the write lock
immediately after. This change adds validation that an overrun has
not occurred and, if it has, it will start a new generation.
This commit is contained in:
Ben Johnson
2022-02-06 11:17:31 -07:00
parent 76e53dc6ea
commit 30a8d07a81
3 changed files with 97 additions and 17 deletions

View File

@@ -302,7 +302,7 @@ func (p Pos) String() string {
if p.IsZero() {
return ""
}
return fmt.Sprintf("%s/%08x:%d", p.Generation, p.Index, p.Offset)
return fmt.Sprintf("%s/%08x:%08x", p.Generation, p.Index, p.Offset)
}
// IsZero returns true if p is the zero value.