-
Notifications
You must be signed in to change notification settings - Fork 71
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
@@ -47,21 +51,39 @@ TEST_CASE_METHOD(FlushingTestFixture, | |||
"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
.
@@ -115,7 +115,6 @@ TEST_CASE_METHOD(FileLoaderTestFixture, | |||
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.
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
SharedFiles
map 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::open
it.In more detail,
SharedFiles::syncSharedFile
would not sync back the file after flush.This PR fixes it and adds a regression test.