Skip to content

Commit

Permalink
Fix WALSnapshotTransaction so that it clears its schema cache if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed Mar 17, 2024
1 parent 0a97565 commit c7dec55
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion GRDB/Core/WALSnapshotTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class WALSnapshotTransaction {
// Open a long-lived transaction, and enter snapshot isolation
self.walSnapshot = try reader.sync(allowingLongLivedTransaction: true) { db in
try db.beginTransaction(.deferred)
try db.execute(sql: "SELECT rootpage FROM sqlite_master LIMIT 1")
// This also acquires snapshot isolation because checking
// database schema performs a read access.
try db.clearSchemaCacheIfNeeded()
return try WALSnapshot(db)
}
self.reader = reader
Expand Down

0 comments on commit c7dec55

Please sign in to comment.