userauth: don't register no-op auth functions and unify public API#1308
Open
charlievieth wants to merge 2 commits intomattn:masterfrom
Open
userauth: don't register no-op auth functions and unify public API#1308charlievieth wants to merge 2 commits intomattn:masterfrom
charlievieth wants to merge 2 commits intomattn:masterfrom
Conversation
This commit fixes a bug where the db connection would not always be closed when an error occurred in Open. Additionally, it makes sure that we always unregister any callbacks associated with the connection, which previously did not always happen. This change consolidates the error handling logic (previously, it had to be done for each return statement) which should make it more difficult to introduce this type of bug in the future.
This commit changes Open to not register any of the auth functions when
userauth is disabled. It also unifies the public API of this library for
when userauth is enabled/disabled.
goos: darwin
goarch: arm64
pkg: github.com/charlievieth/go-sqlite3
cpu: Apple M4 Pro
│ y1.txt │ y3.txt │
│ sec/op │ sec/op vs base │
Suite/BenchmarkOpen-14 13.76µ ± 1% 12.37µ ± 1% -10.11% (p=0.000 n=10)
│ y1.txt │ y3.txt │
│ B/op │ B/op vs base │
Suite/BenchmarkOpen-14 712.0 ± 0% 111.0 ± 1% -84.41% (p=0.000 n=10)
│ y1.txt │ y3.txt │
│ allocs/op │ allocs/op vs base │
Suite/BenchmarkOpen-14 20.000 ± 0% 3.000 ± 0% -85.00% (p=0.000 n=10)
Contributor
Author
Owner
|
Looks good to me. @rittneje What do you think? |
Collaborator
Contributor
Author
Correct, we should ideally merge #1302 before this PR (it's not strictly necessary since this PR contains the commit 83213c4 from PR but for the sake of documentation and having commits tied to GH PRs it would probably best to merge that one first). Thank you both for taking the time to review this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit changes Open to not register any of the auth functions when
userauth is disabled. It also unifies the public API of this library for
when userauth is enabled/disabled.
NOTE: This PR builds on and includes #1302