Skip to content
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

curvefs/client: add feature of warmup #1793

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

wuhongsong
Copy link
Contributor

@wuhongsong wuhongsong commented Aug 8, 2022

Signed-off-by: hzwuhongsong hzwuhongsong@corp.netease.com

Issue Number: #1802

Problem Summary:

Added warmup function, then we can warmup the file to local cache directory before we need it.

@wuhongsong wuhongsong force-pushed the add_warmup branch 2 times, most recently from 94bdd7b to c570cbd Compare August 8, 2022 08:48
@skypexu
Copy link
Member

skypexu commented Aug 8, 2022

should not pull in boost for simple problem

@wuhongsong wuhongsong force-pushed the add_warmup branch 7 times, most recently from d696e7c to 11ae6bc Compare August 10, 2022 08:20
@wuhongsong
Copy link
Contributor Author

recheck

@wuhongsong wuhongsong force-pushed the add_warmup branch 2 times, most recently from 7228204 to 457d5d0 Compare August 11, 2022 09:15
@wuhongsong wuhongsong force-pushed the add_warmup branch 2 times, most recently from 8953e23 to 6ae1335 Compare August 12, 2022 04:17
curvefs/src/client/fuse_client.cpp Show resolved Hide resolved
curvefs/src/client/fuse_client.cpp Outdated Show resolved Hide resolved
curvefs/src/client/fuse_client.h Show resolved Hide resolved
curvefs/src/client/fuse_client.cpp Show resolved Hide resolved
curvefs/src/client/fuse_client.cpp Show resolved Hide resolved
std::string pDelimiter = "\n";
char* pToken = nullptr;
char* pSave = nullptr;
pToken = strtok_r(const_cast<char*>(file.c_str()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

GetTaskFetchPool().Enqueue(task);
}

void FuseS3Client::travelChunk(fuse_ino_t ino, S3ChunkInfoList chunkInfo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this function for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

travel and download all objs belong to the chunk. and i have commnted.

}

void FuseS3Client::WarmUpAllObjs(
const std::list<std::pair<std::string, uint64_t>> &prefetchObjs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These logics are very similar to FileCacheManager::PrefetchS3Objs, try to merge as much as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

year, there are many similars, and i have added todo.

@@ -92,6 +101,18 @@ class FuseS3Client : public FuseClient {
private:
// s3 adaptor
std::shared_ptr<S3ClientAdaptor> s3Adaptor_;

Thread bgFetchThread_;
std::atomic<bool> bgFetchStop_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not define private members and functions together; use a new class to manage them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

};

TEST_F(TestFuseS3Client, warmUp_dentryNotexist) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a note for the test scene

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

@wuhongsong
Copy link
Contributor Author

recheck

@ilixiaocui
Copy link
Contributor

Code still needs to be optimized

@wuhongsong wuhongsong merged commit d4be817 into opencurve:master Aug 15, 2022
@wuhongsong wuhongsong deleted the add_warmup branch March 23, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants