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

[feat]curvefs/client:support warmup sym link #2723

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

Cyber-SiKu
Copy link
Contributor

What problem does this PR solve?

Issue Number: #xxx

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@@ -57,7 +59,7 @@ bool WarmupManagerS3Impl::AddWarmupFilelist(fuse_ino_t key,
}
// add warmup Progress
if (AddWarmupProcess(key, type)) {
VLOG(9) << "add warmup list task:" << key;
LOG(INFO) << "add warmup list task:" << key;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this log too much?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will this log too much?

Only when preheating is added, one will be output, which feels good.

@@ -83,7 +85,7 @@ bool WarmupManagerS3Impl::AddWarmupFile(fuse_ino_t key, const std::string &path,
}
// add warmup Progress
if (AddWarmupProcess(key, type)) {
VLOG(9) << "add warmup single task:" << key;
LOG(INFO) << "add warmup single task:" << key;
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

ditto


if (!curve::common::StringStartWith(file, "/")) {
LOG(ERROR) << fmt::format("{} isn't absolute path", file);
file.erase(0, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

What if it is not an absolute path? And what is the purpose of file.erase(0, 1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if it is not an absolute path? And what is the purpose of file.erase(0, 1);

If it is not an absolute path, the warm-up task will be skipped.
There should be a problem with the latter one, it has been fixed

// skip links
std::string symLink;
CURVEFS_ERROR statusCode =
fuseOpReadLink_(0, dentry.inodeid(), &symLink);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe nullptr is more readable than 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe nullptr is more readable than 0.

fix

@@ -302,7 +297,26 @@ void WarmupManagerS3Impl::FetchChildDentry(fuse_ino_t key, fuse_ino_t ino) {
};
AddFetchDentryTask(key, task);
VLOG(9) << "FetchChildDentry: " << dentry.inodeid();
} else if (FsFileType::TYPE_SYM_LINK == dentry.type()) { // need todo
} else if (FsFileType::TYPE_SYM_LINK == dentry.type()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic of functions FetchDentry and FetchChildDentry is very similar, so you can consider abstracting the common parts.

Copy link
Contributor Author

@Cyber-SiKu Cyber-SiKu Sep 8, 2023

Choose a reason for hiding this comment

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

The logic of functions FetchDentry and FetchChildDentry is very similar, so you can consider abstracting the common parts.

can't agree with you anymore @wuhongsong

@@ -719,6 +732,74 @@ void WarmupManager::CollectMetrics(InterfaceMetric *interface, int count,
interface->latency << (butil::cpuwide_time_us() - start);
}

bool WarmupManagerS3Impl::GetInodeSubPathParent(
Copy link
Contributor

Choose a reason for hiding this comment

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

If there are source files and corresponding link files in the preheating directory, will the file be preheated multiple times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there are source files and corresponding link files in the preheating directory, will the file be preheated multiple times?

This depends on the situation:
If it is preheated to diskcache, although it will still be preheated, it will be skipped because diskcache has the logic to determine whether the cache exists.
However, there is no corresponding logic for kvcache, and it will be warmed up repeatedly.

continue;
}
std::string lastName = splitSymLink.back();
auto task = [this, key, parent, lastName]() {
Copy link
Contributor

Choose a reason for hiding this comment

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

task isn't being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

task isn't being used.

fix

* @return false: subPath isn't belong to inode
*/
bool GetInodeSubPathParent(fuse_ino_t inode,
std::vector<std::string> subPath,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::vector<std::string> subPath,
const std::vector<std::string>& subPath,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

subPath will modify in function

LOG(ERROR) << "get inode fail, inodeid = " << inode;
return false;
}
curve::common::UniqueLock lck = inodeWrapper->GetUniqueLock();
Copy link
Contributor

Choose a reason for hiding this comment

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

do we support this case, e.g.,

fsmount/
  -> A(symlink to ../fsmount/B)
  -> B

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we support this case, e.g.,

fsmount/
  -> A(symlink to ../fsmount/B)
  -> B

no

splitSymLink.end());
nextInode = inode;
} else {
nextInode = dentry.inodeid();
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to use iterative approach instead of recursion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's better to use iterative approach instead of recursion.

Here is to analyze the soft link, I don't think there will be too deep level calls. However, this can be modified. if you insist

@Cyber-SiKu Cyber-SiKu force-pushed the feat/warmup_soft_link branch 14 times, most recently from 9178a68 to 76d61c1 Compare September 13, 2023 08:28
@Cyber-SiKu
Copy link
Contributor Author

cicheck

@Cyber-SiKu
Copy link
Contributor Author

cicheck

1 similar comment
@Cyber-SiKu
Copy link
Contributor Author

cicheck

add feat support symlink by fuseOpReadLink

Signed-off-by: Cyber-SiKu <[email protected]>
@Cyber-SiKu
Copy link
Contributor Author

cicheck

5 similar comments
@Cyber-SiKu
Copy link
Contributor Author

cicheck

@Cyber-SiKu
Copy link
Contributor Author

cicheck

@Cyber-SiKu
Copy link
Contributor Author

cicheck

@Cyber-SiKu
Copy link
Contributor Author

cicheck

@Cyber-SiKu
Copy link
Contributor Author

cicheck

@Cyber-SiKu
Copy link
Contributor Author

cicheck

@wuhongsong wuhongsong merged commit cfb7b17 into opencurve:master Sep 14, 2023
2 checks passed
@Cyber-SiKu Cyber-SiKu deleted the feat/warmup_soft_link branch September 14, 2023 06:31
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