-
Notifications
You must be signed in to change notification settings - Fork 154
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
prototype mappedfile_abort() #2245
base: master
Are you sure you want to change the base?
Conversation
d09da6b
to
7d19ebc
Compare
Another old forgotten half-finished piece of work(!). Can I please get some eyes on this to see whether it's of any value, before I finish it off? I think the intent was meant to be a way of closing a mappedfile during post-error-cleanup -- when you know the file might be dirty (and so you can't simply "close" it without it asserting) but you don't want to "commit" it, either. (The file is probably corrupt at this point, but probably was anyway due to the error you're recovering from...) I think the "WIP..." commit is called "WIP" because I meant to go and update the other places that use mappedfile to also use mappedfile_abort in their error handling, and prometheus was just where I started? So if we think this looks viable, then I'll carry on updating the rest of the mappedfile usages like what I did with the prometheus one, and get it merged. |
I think it's good to have an abort function. I'm just wondering about the API, as the abort function signature is inconsistent with the commit function. The abort function arguments is a pointer to pointer and closes the mapped file. The commit function takes a pointer and does not cIose the file. Is there any use of a mappedfile after commit? I've grepped the current codebase for use of mappedfile_commit and don't have an answer, yet. |
The commit function only fsyncs the file, and then (if that works) clears the dirty flag. It doesn't close it, or even unlock it. I don't know if we ever do this, but I think something like this would be reasonable:
In contrast though, if anything has been partially written, I had another look through the LP task that this shook out of, and the problem worked out like this (in prometheus):
If we were to skip the If we were to call
So, the goal is a dedicated "it's bad, just get the hell outta here" function.
I would expect commit/abort to have consistent signatures if this was a transactional thing (where you either get the whole change, or none of it), but it's not and can't be. Maybe "commit" is badly named, since it implies transactionality, when it's really just "flush to disk now and clear the dirty flag". |
7d19ebc
to
97ca782
Compare
I'm going to remove myself from the reviewers here. Feel free to add me again when this gets ready for review. |
Prototyping mappedfile_abort() API.