Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Sendable correctness, update to SQLite 3.43.1 #51

Merged
merged 14 commits into from
Sep 15, 2023

Conversation

gwynne
Copy link
Member

@gwynne gwynne commented May 19, 2023

Changes in this release:

  • We now satisfy StrictConcurrency=complete with no warnings in this package.
  • We also now satisfy ExistentialAny.
  • Update embedded SQLite from 3.43.0 to 3.43.1 (SQLite release notes)
  • The vendoring script is now an SPM command plugin. Run it with swift package --disable-sandbox vendor-sqlite. Accepts --help, --verbose, and --force options. (Users should not need to run this command.)
  • The SQLCustomFunction feature's API documentation has been heavily improved.
  • The package now requires Swift 5.7, in alignment with Vapor.
  • The options used when compiling the SQLite sources have been adjusted to better match current recommendations and usage.
  • The generated source files (the vendored libsqlite3) have been renamed for consistency.

@gwynne gwynne added the semver-patch Internal changes only label May 19, 2023
@gwynne gwynne requested a review from 0xTim May 19, 2023 06:42
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use the NIO helpers to avoid having to make stuff @unchecked Sendable but I'm not too fussed either way since this isn't as critical as Postgres/MySQL

Sources/SQLiteNIO/SQLiteConnection.swift Show resolved Hide resolved
}
extension UnsafeTransfer: Equatable where Wrapped: Equatable {}
extension UnsafeTransfer: Hashable where Wrapped: Hashable {}

final class UnsafeMutableTransferBox<Wrapped>: @unchecked Sendable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use NIOLoopBoundBox in these instances but open to keeping what we have

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gwynne either way Wrapped should be Sendable otherwise mutating it is even less safe. Since SQLLiteRow is already Sendable, you could just add the Sendable constraint.

@gwynne gwynne changed the title Add enough Sendable correctness to satisfy the compiler warnings Add basic Sendable correctness, update to SQLite 3.43.1 Sep 13, 2023
@gwynne gwynne requested a review from 0xTim September 13, 2023 22:03
@gwynne gwynne marked this pull request as ready for review September 13, 2023 22:03
…ames of the generated files to use the more consistent prefixing, and tweak the source patch to not need updating with every SQLite version.
@gwynne gwynne added semver-minor Contains new APIs and removed semver-patch Internal changes only labels Sep 13, 2023
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not going to like my comments 🤣

Some Sendable queries, might be null and void if we just use a custom executor for the next version anyway.

Love the plugin!

Sources/SQLiteNIO/SQLiteConnection.swift Outdated Show resolved Hide resolved
Sources/SQLiteNIO/SQLiteCustomFunction.swift Outdated Show resolved Hide resolved
…s not valid even to compile on non-Apple platforms.
@gwynne gwynne requested a review from 0xTim September 15, 2023 07:08
@gwynne
Copy link
Member Author

gwynne commented Sep 15, 2023

API breakage failure is spurious. Dependents check failure is fixed by vapor/sqlite-kit#105.

}
extension UnsafeTransfer: Equatable where Wrapped: Equatable {}
extension UnsafeTransfer: Hashable where Wrapped: Hashable {}

final class UnsafeMutableTransferBox<Wrapped>: @unchecked Sendable {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gwynne either way Wrapped should be Sendable otherwise mutating it is even less safe. Since SQLLiteRow is already Sendable, you could just add the Sendable constraint.

Tests/SQLiteNIOTests/SQLiteCustomFunctionTests.swift Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2023

Codecov Report

Merging #51 (6086f3f) into main (0a33df1) will not change coverage.
The diff coverage is 74.07%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #51   +/-   ##
=======================================
  Coverage   66.36%   66.36%           
=======================================
  Files           8        8           
  Lines         669      669           
=======================================
  Hits          444      444           
  Misses        225      225           
Files Changed Coverage Δ
Sources/SQLiteNIO/SQLiteData.swift 81.92% <0.00%> (ø)
Sources/SQLiteNIO/SQLiteDataType.swift 0.00% <0.00%> (ø)
Sources/SQLiteNIO/SQLiteError.swift 26.81% <ø> (ø)
Sources/SQLiteNIO/SQLiteRow.swift 92.85% <ø> (ø)
Sources/SQLiteNIO/SQLiteConnection.swift 65.97% <76.47%> (ø)
Sources/SQLiteNIO/SQLiteCustomFunction.swift 83.67% <85.71%> (ø)
Sources/SQLiteNIO/SQLiteStatement.swift 89.58% <100.00%> (ø)

@gwynne gwynne requested a review from MahdiBM September 15, 2023 18:27
@gwynne gwynne merged commit 1fcecec into main Sep 15, 2023
11 of 12 checks passed
@gwynne gwynne deleted the sendable-checking branch September 15, 2023 18:45
@penny-for-vapor
Copy link

These changes are now available in 1.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor Contains new APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants