diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cfdbb177..d237a730d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception: #### 4.x Releases -- `4.12.x` Releases - [4.12.0](#4120) +- `4.12.x` Releases - [4.12.0](#4120) | [4.12.1](#4121) - `4.11.x` Releases - [4.11.0](#4110) - `4.10.x` Releases - [4.10.0](#4100) - `4.9.x` Releases - [4.9.0](#490) @@ -93,6 +93,15 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception: - [#745](https://github.com/groue/GRDB.swift/pull/745): Explicit ValueObservation cancellation +## 4.12.1 + +Released March 29, 2020 • [diff](https://github.com/groue/GRDB.swift/compare/v4.12.0...v4.12.1) + +**Fixed** + +- [#744](https://github.com/groue/GRDB.swift/pull/744): Fix DatabaseMigrator deadlock with serial target queues + + ## 4.12.0 Released March 21, 2020 • [diff](https://github.com/groue/GRDB.swift/compare/v4.11.0...v4.12.0) diff --git a/GRDB.swift.podspec b/GRDB.swift.podspec index d76895704..ab4e46d8e 100644 --- a/GRDB.swift.podspec +++ b/GRDB.swift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'GRDB.swift' - s.version = '4.12.0' + s.version = '4.12.1' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A toolkit for SQLite databases, with a focus on application development.' diff --git a/GRDB/Migration/DatabaseMigrator.swift b/GRDB/Migration/DatabaseMigrator.swift index 39516e893..1837637bb 100644 --- a/GRDB/Migration/DatabaseMigrator.swift +++ b/GRDB/Migration/DatabaseMigrator.swift @@ -138,7 +138,9 @@ public struct DatabaseMigrator { // // Create a temporary witness database (on disk, just in case // migrations would involve a lot of data). - let witness = try DatabaseQueue(path: "", configuration: writer.configuration) + var witnessConfiguration = writer.configuration + witnessConfiguration.targetQueue = nil // Avoid deadlocks + let witness = try DatabaseQueue(path: "", configuration: witnessConfiguration) // Grab schema of migrated witness database let witnessSchema: SchemaInfo = try witness.writeWithoutTransaction { db in diff --git a/Makefile b/Makefile index a9f3ba40a..46036eda4 100644 --- a/Makefile +++ b/Makefile @@ -406,12 +406,12 @@ ifdef JAZZY --author 'Gwendal RouĂ©' \ --author_url https://github.com/groue \ --github_url https://github.com/groue/GRDB.swift \ - --github-file-prefix https://github.com/groue/GRDB.swift/tree/v4.12.0 \ - --module-version 4.12.0 \ + --github-file-prefix https://github.com/groue/GRDB.swift/tree/v4.12.1 \ + --module-version 4.12.1 \ --module GRDB \ --root-url http://groue.github.io/GRDB.swift/docs/4.12/ \ --output Documentation/Reference \ - --podspec GRDB.swift.podspec + --xcodebuild-arguments -project,GRDB.xcodeproj,-scheme,GRDBiOS else @echo Jazzy must be installed for doc @exit 1 diff --git a/README.md b/README.md index 2803a8db1..4aa91cbaa 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ | Swift version | GRDB version | | ------------- | ----------------------------------------------------------- | | **Swift 5.2** | [GRDB5 branch](https://github.com/groue/GRDB.swift/tree/GRDB5) | -| Swift 5.1 | [v4.12.0](https://github.com/groue/GRDB.swift/tree/v4.12.0) | -| Swift 5 | [v4.12.0](https://github.com/groue/GRDB.swift/tree/v4.12.0) | -| Swift 4.2 | [v4.12.0](https://github.com/groue/GRDB.swift/tree/v4.12.0) | +| Swift 5.1 | [v4.12.1](https://github.com/groue/GRDB.swift/tree/v4.12.0) | +| Swift 5 | [v4.12.1](https://github.com/groue/GRDB.swift/tree/v4.12.0) | +| Swift 4.2 | [v4.12.1](https://github.com/groue/GRDB.swift/tree/v4.12.0) | | Swift 4.1 | [v3.7.0](https://github.com/groue/GRDB.swift/tree/v3.7.0) | | Swift 4 | [v2.10.0](https://github.com/groue/GRDB.swift/tree/v2.10.0) | | Swift 3.2 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) | diff --git a/Support/Info.plist b/Support/Info.plist index a8d32d6b4..0d1771ddc 100644 --- a/Support/Info.plist +++ b/Support/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.12.0 + 4.12.1 CFBundleSignature ???? CFBundleVersion diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index 74acd8367..ad150c4da 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -348,6 +348,20 @@ class DatabaseMigratorTests : GRDBTestCase { try XCTAssertTrue(dbQueue.read(newMigrator.hasCompletedMigrations)) } + // Regression test for https://github.com/groue/GRDB.swift/issues/741 + func testEraseDatabaseOnSchemaChangeDoesNotDeadLock() throws { + dbConfiguration.targetQueue = DispatchQueue(label: "target") + let dbQueue = try makeDatabaseQueue() + + var migrator = DatabaseMigrator() + migrator.eraseDatabaseOnSchemaChange = true + migrator.registerMigration("1", migrate: { _ in }) + try migrator.migrate(dbQueue) + + migrator.registerMigration("2", migrate: { _ in }) + try migrator.migrate(dbQueue) + } + func testEraseDatabaseOnSchemaChange() throws { // 1st version of the migrator var migrator1 = DatabaseMigrator()