-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Support running without DIRECT IO #47
Comments
What was the original reason for having the software fail on lack of O_DIRECT? Was it merely to save time implementing the fallback, or are there things that fail when the file is opened without it? |
Let me rephrase that so that it doesn't sound like I don't know the importance of O_DIRECT for a database. What was the original reason for not allowing a bypass? Was it effort required to implement the fallback in disk.cc, things that broke elsewhere, or fear of cache crowding and other serious system performance problems? |
Basically, we just didn't think about it :) |
So the low-level support in disk.cc seems to be present after all, just not commented. The argument is_really_direct to linux_file_t::linux_file_t (which is not Linux-specific anymore) controls whether one requests O_DIRECT or F_NOCACHE. All that we need to do is to implement a choice between the typedefs direct_file_t and nondirect_file_t in log_serializer.cc. We could pass the information to that point (from command_line stuff) via extra function arguments (either a session object or a simple flag for this option) or via a global variable. What would be preferable here? |
I haven't looked at this stuff in a while, but here are two problems that I can think of off the top of my head:
|
|
As it turns out, O_DIRECT does not provide guarantees about data commits like O_SYNC. Would we also want to provide an O_SYNC option? |
We want O_DSYNC (which Linux allegedly treats O_SYNC as, anyway). We warn the user when O_DIRECT doesn't work and pass O_DSYNC in any case. This is currently in code review 134. |
What do we do in OSX for sync? |
Nothing yet. If we want proper syncing in OS X we can follow up each write() call with |
@srh -- presumably we'd only need to do it twice -- once before writing the metablock, and once after. |
@coffeemug - I'm going to do |
This is fixed, with F_FULLFSYNC and O_DSYNC options enabled. |
@srh -- could you please specify review number and commit number? |
@srh -- ping -- could you specify review number and commit number? What is the warning message the users get if DIRECT_IO isn't available? |
Running with direct io makes sense in production, but when developers try the product, they often have encrypted/journaled file systems that don't support direct io. We should implement an alternative code path that opens the files without direct io and warns devs that it's a compatibility mode.
The text was updated successfully, but these errors were encountered: