Skip to content

Commit 7fe4ee2

Browse files
committed
loopdb: make sqlite sync for extra durability
1 parent ab30e0b commit 7fe4ee2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

loopdb/sqlite.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ func NewSqliteStore(cfg *SqliteConfig, network *chaincfg.Params) (*SqliteSwapSto
6868
name: "busy_timeout",
6969
value: "5000",
7070
},
71+
{
72+
// With the WAL mode, this ensures that we also do an
73+
// extra WAL sync after each transaction. The normal
74+
// sync mode skips this and gives better performance,
75+
// but risks durability.
76+
name: "synchronous",
77+
value: "full",
78+
},
79+
{
80+
// This is used to ensure proper durability for users
81+
// running on Mac OS. It uses the correct fsync system
82+
// call to ensure items are fully flushed to disk.
83+
name: "fullfsync",
84+
value: "true",
85+
},
7186
}
7287
sqliteOptions := make(url.Values)
7388
for _, option := range pragmaOptions {

0 commit comments

Comments
 (0)