-
Notifications
You must be signed in to change notification settings - Fork 70
Clear shared files map upon flush #513
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
Conversation
| "Test flushing clears shared files", | ||
| "[flush]") | ||
| { | ||
| std::string relativePath = "flush-test.txt"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactor the test to use the FileLoader API rather than modify the host filesystem manually.
| REQUIRE(storage::SharedFiles::syncSharedFile(syncSharedPath, "") == 0); | ||
| std::string realPath = | ||
| storage::SharedFiles::realPathForSharedFile(syncSharedPath); | ||
| REQUIRE(::open(realPath.c_str(), O_RDONLY) > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the check that would fail without the patch, returning a fd of -1.
| REQUIRE(boost::filesystem::exists(funcFile)); | ||
|
|
||
| // Now flush | ||
| storage::FileLoader& loader = storage::getFileLoader(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this, and thought I'd commit the change as well.
Shillaker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
Previously we were not clearing the
SharedFilesmap upon flush. As a consequence, when opening a shared file that had been (1) synced, and (2) flushed, the filesystem implementation would act as if the file was cached, and try to::openit.In more detail,
SharedFiles::syncSharedFilewould not sync back the file after flush.This PR fixes it and adds a regression test.