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 the POSIX semaphore feature from LMDB #140

Closed
wants to merge 2 commits into from
Closed

Add the POSIX semaphore feature from LMDB #140

wants to merge 2 commits into from

Conversation

GregoryConrad
Copy link
Contributor

Before looking at this PR, please see meilisearch/lmdb-rs#13. It is required before this PR can be merged.

This PR adds LMDB's POSIX semaphore feature to heed. This change allows iOS and macOS builds to be compliant with Apple's App Sandbox (necessary for distribution in the App Store), in addition to possible speed improvements brought upon by the POSIX semaphores.

You could investigate using POSIX semaphores within milli/meilisearch as well for the possible speed improvements they bring, but that is outside the scope of this PR.

@GregoryConrad
Copy link
Contributor Author

GregoryConrad commented Dec 24, 2022

Also not sure whether this PR should be made to main or v0.12; if I should switch it to v0.12 (to be used with milli) please let me know.

Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

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

You could investigate using POSIX semaphores within milli/meilisearch as well for the possible speed improvements they bring, but that is outside the scope of this PR.

This comment from Howard can be very interesting! Using POSIX semaphores can bring new issues. There are information about the C defines that we can use with LMDB in the Makefile (more in the mdb.c).

Also not sure whether this PR should be made to main or v0.12; if I should switch it to v0.12 (to be used with milli) please let me know.

Yes, you must start from the branch meilisearch and milli uses which is v0.12.

Comment on lines +42 to +46
# Whether to tell LMDB to use POSIX semaphores during compilation
# (instead of System V semaphores).
# POSIX semaphores are required for Apple's App Sandbox on iOS & macOS,
# and are possibly faster and more appropriate for single-process use.
posix-sem = ["lmdb-rkv-sys/posix-sem"]
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to change the documentation a little bit here? Could you add a link to this section in the doc, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like I am going to have to recreate the PR because changing the base didn't work as I wanted. Will update the docs in the new PR.

@GregoryConrad
Copy link
Contributor Author

GregoryConrad commented Jan 4, 2023

This comment from Howard can be very interesting! Using POSIX semaphores can bring new issues. There are information about the C defines that we can use with LMDB in the Makefile (more in the mdb.c).

Very true. I will note that if building meili into a Docker image, however, I would imagine that it would make sense to use POSIX semaphores even with that drawback (specifically, not cleaning up on a crash) since the container would just be restarted and the semaphore(s) would consequently be closed/reset as soon as the container exits and restarts. However, if building meili into just an executable, and not in a container, it would still make sense to use SysV semaphores (at least not on iOS/macOS). All just depends on the target platform/use case.

Yes, you must start from the branch meilisearch and milli uses which is v0.12.

Noted; will switch this PR over to v0.12 if I can. Otherwise, I will open a new PR and close this one.

@GregoryConrad GregoryConrad changed the base branch from main to v0.12 January 4, 2023 17:24
@GregoryConrad GregoryConrad changed the base branch from v0.12 to main January 4, 2023 17:24
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.

None yet

2 participants