From 70c6f3ec4456ca11579d5e2369d4f7004a3dd363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 29 Mar 2020 12:09:24 +0200 Subject: [PATCH 1/4] Failing test for #741 --- Tests/GRDBTests/DatabaseMigratorTests.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index ce8e8d8c5..91e9cd8cd 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -553,6 +553,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() From 97a84c64707cb6c2b110441804299c404914968c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 29 Mar 2020 12:09:58 +0200 Subject: [PATCH 2/4] Fix failing test for #741 --- GRDB/Migration/DatabaseMigrator.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GRDB/Migration/DatabaseMigrator.swift b/GRDB/Migration/DatabaseMigrator.swift index 9884de4c9..64595cd12 100644 --- a/GRDB/Migration/DatabaseMigrator.swift +++ b/GRDB/Migration/DatabaseMigrator.swift @@ -160,7 +160,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 From 66989f2ff7ff799cd5db5a6f7d80de22236566d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 29 Mar 2020 17:43:49 +0200 Subject: [PATCH 3/4] v4.12.1 --- CHANGELOG.md | 11 ++++++++++- GRDB.swift.podspec | 2 +- Makefile | 4 ++-- README.md | 6 +++--- Support/Info.plist | 2 +- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14ebd92e8..9ad9cf8a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,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) @@ -69,6 +69,15 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception: ## Next Release --> +## 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 43f36d559..268f42377 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/Makefile b/Makefile index a770e0599..6c49e77bc 100644 --- a/Makefile +++ b/Makefile @@ -466,8 +466,8 @@ 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 \ diff --git a/README.md b/README.md index 52e3e1c8b..7cda20812 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ --- -**Latest release**: March 21, 2020 • version 4.12.0 • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 3 to GRDB 4](Documentation/GRDB3MigrationGuide.md) +**Latest release**: March 29, 2020 • version 4.12.1 • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 3 to GRDB 4](Documentation/GRDB3MigrationGuide.md) **Requirements**: iOS 9.0+ / macOS 10.9+ / tvOS 9.0+ / watchOS 2.0+ • Swift 4.2+ / Xcode 10.0+ | Swift version | GRDB version | | ------------- | ----------------------------------------------------------- | -| **Swift 5** | **v4.12.0** | -| **Swift 4.2** | **v4.12.0** | +| **Swift 5** | **v4.12.1** | +| **Swift 4.2** | **v4.12.1** | | 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 From c01c4d6de5c7f841b9abd0a80f266958c30eecc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 29 Mar 2020 18:49:54 +0200 Subject: [PATCH 4/4] Looks like jazzy and Xcode 11.4 go well together --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6c49e77bc..0da9e8e91 100644 --- a/Makefile +++ b/Makefile @@ -471,7 +471,7 @@ ifdef JAZZY --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