ncruces / go-sqlite3

Go bindings to SQLite using wazero
https://pkg.go.dev/github.com/ncruces/go-sqlite3
MIT License
402 stars 12 forks source link

Fix potential BSD locking race. #98

Closed ncruces closed 2 months ago

ncruces commented 2 months ago

In practise, this shouldn't be a big change.

osWriteLock should only fail when going from SHARED to RESERVED (or directly to EXCLUSIVE when recovering a hot journal).

Neither transition invokes the busy handler: https://github.com/sqlite/sqlite/blob/version-3.46.0/src/pager.c#L3688-L3693

And both transitions should immediately abort any transactions, and invalidate reads made under SHARED. This change is only motivated by an overabundance of caution.