Gwendal Roué
361a482b1e
Enable SQLITE_ENABLE_SNAPSHOT by default and introduce SQLITE_DISABLE_SNAPSHOT
2025-10-12 14:03:09 +02:00
Gwendal Roué
b1b83abd8b
Simplify the compiler checks for the availability of SQLite snapshots
2025-10-04 14:15:13 +02:00
Gwendal Roué
4cfa692ddd
Fix race condition regarding Task cancellation
...
This complements #1797 by making sure read-only transactions complete correctly, even if the task is cancelled.
2025-09-10 07:12:11 +02:00
Gwendal Roué
8dfbbb50f6
TODO
2025-09-10 06:51:14 +02:00
Gwendal Roué
215128390d
Fix race condition: prevent cancellation from cancelling other database accesses after database accesses has completed
...
Before this change, cancelling a database access could cancel *another* database access 😱
2025-07-23 12:01:58 +02:00
Gwendal Roué
d242421862
Async methods accept a non-escaping closure
2025-07-19 16:42:17 +02:00
Gwendal Roué
7a1e65b142
Remove late cancellation checks
...
I'm slowly changing my mind about this.
2025-07-19 15:27:08 +02:00
Gwendal Roué
6069e6d683
DatabasePool.barrierWriteWithoutTransaction can access task locals
2025-07-19 15:26:44 +02:00
Gwendal Roué
cbbd0cb945
Add asserts about expected ends of transaction
2025-07-19 14:25:50 +02:00
Gwendal Roué
dd4227303a
DatabasePool unsafeRead can access task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué
e154a652dc
Don't check for reentrancy from async Pool.read
...
One can't call an async function from a database access anywau
2025-07-19 14:25:50 +02:00
Gwendal Roué
41d4f23a83
DatabasePool reads can access task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué
46e15616a7
[BREAKING] macOS 10.15+
2024-09-21 14:28:24 +02:00
Gwendal Roué
e4a4735494
[BREAKING] tvOS 13+
2024-09-21 13:57:35 +02:00
Gwendal Roué
8c40592955
[BREAKING] iOS 13+
2024-09-21 13:57:23 +02:00
Gwendal Roué
2f240fd764
[SENDING REGRET] Async database access methods return Sendable results
...
We can not tell the compiler that we can safely return `sending` results, because fetched values are in the same region as the `db` argument, according to SE-0414 (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0414-region-based-isolation.md#rules-for-merging-isolation-regions ).
```
class NotSendable { init() { } }
func fetchNotSendable(_ db: Database) -> NotSendable { fatalError() }
func notOK<T>(_ make: (Database) -> sending T) { }
func ok<T>(_ make: () -> sending T) { }
func usage() {
ok { NotSendable() }
// Returning a task-isolated 'NotSendable' value as a 'sending' result
// risks causing data races.
notOK { db in fetchNotSendable(db) }
}
```
Various attempts at modifying all fetching methods so that they have a `sending` return value have failed.
2024-09-08 16:55:25 +02:00
Gwendal Roué
5f384a4b22
ValueObservation is Sendable
2024-09-08 16:17:51 +02:00
Gwendal Roué
62d96ec544
[SENDING REGRET] Async database accesses require Sendable closures
...
We should be able to use sending closures instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:16:40 +02:00
Gwendal Roué
a7a9c75185
Place @escaping before @Sendable
2024-09-08 13:41:13 +02:00
Gwendal Roué
d6b91eec85
[BREAKING] DatabaseReader async methods support Task cancellation
2024-09-01 15:35:37 +02:00
Gwendal Roué
fa54b74eba
[BREAKING] DatabaseWriter async methods support Task cancellation
2024-09-01 15:35:37 +02:00
Gwendal Roué
b587afba0e
Pool is Sendable
2024-08-25 17:28:02 +02:00
Gwendal Roué
e72a37d7d5
Rename LockedBox to Mutex
2024-08-25 12:40:28 +02:00
Gwendal Roué
1de32c267b
[BREAKING] Remove DatabaseFuture and concurrentRead
...
That's one less DispatchSemaphore. We don't need this method anymore.
2024-08-25 11:07:05 +02:00
Gwendal Roué
451a9eb493
[BREAKING] Remove Configuration.defaultTransactionKind
...
GRDB now defaults read-only transactions to DEFERRED, and write transactions to IMMEDIATE. See https://github.com/groue/GRDB.swift/issues/1483 for some context.
2024-08-25 08:22:07 +02:00
Gwendal Roué
8caf31296f
[BREAKING] Xcode 16+, Swift 6+
2024-08-24 15:43:09 +02:00
Gwendal Roué
e79b4e25db
Apply Configuration.journalMode
2023-08-25 09:10:33 +01:00
László Kustra
788887a2b8
Remove selector-based NotificationCenter calls on Linux
2023-06-29 16:23:36 +02:00
Gwendal Roué
63d360053b
Fix typo and obsolete comments
2023-06-02 10:20:42 +02:00
Gwendal Roué
dc440d5a8f
Fix failing tests for non-empty wal files on DatabasePool creation
2023-06-02 09:44:18 +02:00
Gwendal Roué
73b279b5c1
Document methods that fail if the wal file is missing or truncated
2023-06-01 19:15:21 +02:00
Gwendal Roué
cedcfbe330
Mark opportunities for snapshot creation failure (including #1383 )
2023-06-01 17:26:04 +02:00
Gwendal Roué
5d9b9edfe1
Fix asyncWALSnapshotTransaction usage.
...
We must use its result asynchronously.
2023-03-19 12:39:48 +01:00
Gwendal Roué
449c243a36
Rename persistentReaderConnections to dbConfiguration.persistentReadOnlyConnections
2023-03-18 11:08:56 +01:00
Gwendal Roué
063877d49c
Configuration.persistentReaderConnections
2023-03-17 13:52:29 +01:00
Gwendal Roué
0a544dc0d2
Cleanup relationships between SerializedDatabase, WALSnapshotTransaction, and DatabasePool
...
SerializedDatabase hides its allowsUnsafeTransactions property, and makes it thread-safe by protecting it inside its serialized dispatch queue.
WALSnapshotTransaction always notifies when the reader connection is no longer used, and reuses the "isInsideTransaction" wording.
2023-03-17 13:52:29 +01:00
Gwendal Roué
e66dfacab8
WALSnapshotTransaction
2023-03-17 13:52:29 +01:00
Gwendal Roué
6d392f0a87
Use DatabaseError.connectionIsClosed() where appropriate
2023-03-16 13:44:08 +01:00
baegteun
557ad3d3d3
OS X -> macOS in Remake or CHANGELOG.md
2023-01-14 11:43:27 +09:00
Gwendal Roué
0dd17a9a16
Turn ValueObservationScheduler into a protocol
2022-12-29 12:38:06 +01:00
Gwendal Roué
2c5a86479a
DocC: Transactions and Savepoints
2022-12-17 10:11:36 +01:00
Gwendal Roué
10596e17bf
Cleanup snapshot configurations
2022-11-23 19:42:12 +01:00
Gwendal Roué
0ba3dff901
Rewrite availability check for WAL snapshots
...
Also, enable WAL snapshots with SQLCipher, if SQLITE_ENABLE_SNAPSHOT is set.
2022-11-18 13:33:28 +01:00
Gwendal Roué
9b663e3bcc
Pool can discard elements after use
2022-11-18 08:52:52 +01:00
Gwendal Roué
12d656d3a1
Let SQLite check if DatabaseSnapshotPool can be created
2022-11-17 20:01:17 +01:00
Gwendal Roué
0bc49460d7
DatabaseSnapshotPool uses its own pool of connections
...
In the previous implementation, the snapshot pool would use the same reader connections as the database pool. This would create problem with reentrant reads. Let's make things simple, and not share any database connection.
2022-11-17 18:36:17 +01:00
Gwendal Roué
c23b93d71b
Document that reentrant database accesses use the current database connection when possible
2022-11-14 18:38:33 +01:00
Gwendal Roué
b8bc8273a9
Turn snapshot tokens into a proper reader: DatabaseSnapshotPool
2022-11-14 18:22:13 +01:00
Gwendal Roué
eaf8dc239a
Simplify WALSnapshotToken creation
2022-11-14 10:39:48 +01:00
Gwendal Roué
a71eb3d662
Introduce WALSnapshotToken
2022-11-13 18:28:54 +01:00