-
Notifications
You must be signed in to change notification settings - Fork 20
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
protect sync with a lock #309
Merged
Merged
Conversation
This file contains 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
This avoid multiple readers modifying the state concurrently.
icristescu
approved these changes
Apr 28, 2021
samoht
added a commit
to samoht/opam-repository
that referenced
this pull request
Apr 29, 2021
CHANGES: ## Fixed - Reduce allocations during merge (mirage/index#274, mirage/index#277) - Protect concurrent syncs with a lock (mirage/index#309) - Fixed a performance issue for `Index.sync` when there is a blocking merge in progress: the `log_async` file was not cached properly and fully reloaded from disk every time. (mirage/index#310) - Release the merge lock if a merge raises an exception (mirage/index#312) - Added fsync after `Index.clear` to signal more quickly to read-only instances than something has changed in the file (mirage/index#308) ## Changed - Specialise `IO.v` to create read-only or read-write instances. (mirage/index#291) - `clear` removes the files on disks and opens new ones containing only the header. (mirage/index#288, mirage/index#307, mirage/index#317)
samoht
added a commit
to samoht/opam-repository
that referenced
this pull request
Apr 29, 2021
CHANGES: ## Fixed - Reduce allocations during merge (mirage/index#274, mirage/index#277) - Protect concurrent syncs with a lock (mirage/index#309) - Fixed a performance issue for `Index.sync` when there is a blocking merge in progress: the `log_async` file was not cached properly and fully reloaded from disk every time. (mirage/index#310) - Release the merge lock if a merge raises an exception (mirage/index#312) - Added fsync after `Index.clear` to signal more quickly to read-only instances than something has changed in the file (mirage/index#308) ## Changed - Specialise `IO.v` to create read-only or read-write instances. (mirage/index#291) - `clear` removes the files on disks and opens new ones containing only the header. (mirage/index#288, mirage/index#307, mirage/index#317)
samoht
added a commit
to samoht/opam-repository
that referenced
this pull request
Apr 29, 2021
CHANGES: ## Fixed - Reduce allocations during merge (mirage/index#274, mirage/index#277) - Protect concurrent syncs with a lock (mirage/index#309) - Fixed a performance issue for `Index.sync` when there is a blocking merge in progress: the `log_async` file was not cached properly and fully reloaded from disk every time. (mirage/index#310) - Release the merge lock if a merge raises an exception (mirage/index#312) - Added fsync after `Index.clear` to signal more quickly to read-only instances than something has changed in the file (mirage/index#308) ## Changed - Specialise `IO.v` to create read-only or read-write instances. (mirage/index#291) - `clear` removes the files on disks and opens new ones containing only the header. (mirage/index#288, mirage/index#307, mirage/index#317)
samoht
added a commit
to samoht/opam-repository
that referenced
this pull request
Apr 29, 2021
CHANGES: - Reduce allocations during merge (mirage/index#274, mirage/index#277) - Protect concurrent syncs with a lock (mirage/index#309) - Fixed a performance issue for `Index.sync` when there is a blocking merge in progress: the `log_async` file was not cached properly and fully reloaded from disk every time. (mirage/index#310) - Release the merge lock if a merge raises an exception (mirage/index#312) - Added fsync after `Index.clear` to signal more quickly to read-only instances than something has changed in the file (mirage/index#308) - Specialise `IO.v` to create read-only or read-write instances. (mirage/index#291) - `clear` removes the files on disks and opens new ones containing only the header. (mirage/index#288, mirage/index#307, mirage/index#317)
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 avoid multiple readers modifying the state concurrently.
Note: I am not sure it's a real issue, but as this is the only function modifying
t.generation
t.log
andt.log_async
for read-only instances, so it's probably a good idea to make sure we do this safely. We need to see the performance implication as now all the concurrent sync calls will be gated on that lock.