Skip to content

Implement file locking in SQLite on Posix #1938

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

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

BCSharp
Copy link
Member

@BCSharp BCSharp commented Apr 3, 2025

The file locking strategy in SQLite was basically Windows-oriented, with some provisions for limited-trust environment like Silverlight, WinRT, and Windows Mobile. These are obsolete but somebody repurposed the limited-trust strategy to work on Unix. This worked on Linux (sort of, shared locks were seemingly emulated in a way that only SQLite respected), but wasn't working at all on macOS.

This PR implements proper locking on Linux and macOS through a fcntl syscall via Mono.Unix. Locking on Windows is unchanged.

I resisted the temptation to start cleaning up the code (it is even badly formatted), because there would be no end to it, and it is better to replace it by a modern SQLite implementation in a longer run anyway.

Copy link
Contributor

@slozier slozier left a comment

Choose a reason for hiding this comment

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

LGTM!

it is better to replace it by a modern SQLite implementation in a longer run anyway.

I agree trying to maintain this is not a good long term solution. Although I do like having a purely managed implementation...

@BCSharp BCSharp merged commit 9d6fa23 into IronLanguages:main Apr 4, 2025
17 checks passed
@BCSharp BCSharp deleted the sqlite_locking branch April 4, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants