-
Notifications
You must be signed in to change notification settings - Fork 526
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
refactor s3compact code & workaround read failure when diskcachetype=2 #1006
Conversation
recheck |
curvefs/src/metaserver/s3compact.h
Outdated
@@ -35,20 +35,20 @@ using curvefs::common::PartitionInfo; | |||
// one S3Compact per partition | |||
class S3Compact { | |||
public: | |||
explicit S3Compact(std::shared_ptr<InodeStorage> inodeStorage, | |||
explicit S3Compact(std::shared_ptr<InodeManager> inodeManager, |
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.
explicit
is duplicate, and make first parameter as const reference
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.
done
<< inode->inodeid(); | ||
auto checkWithLog = [&](bool cond) { | ||
if (!cond) | ||
LOG(ERROR) << "s3compact: bad GetOrModifyS3ChunkInfo request"; |
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.
is WARNING log enough for this case ?
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.
yes
Inode* inode) { | ||
VLOG(9) << "s3compact: request from s3compaction, inodeId:" | ||
<< inode->inodeid(); | ||
auto checkWithLog = [&](bool cond) { |
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.
capture by reference is unnecessary.
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.
done
const auto& toRemoveS3chunks = toRemoveList.s3chunks(); | ||
auto s3chunkIt = | ||
std::find_if(toRemoveS3chunks.begin(), toRemoveS3chunks.end(), | ||
[&](const S3ChunkInfo& toRemoveS3chunk) { |
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.
ditto
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.
capture origS3chunk only, specific it
*newList.add_s3chunks() = toAddList.s3chunks(0); | ||
VLOG(9) << "s3compact: add chunkid " | ||
<< toAddList.s3chunks(0).chunkid(); | ||
inserted = true; |
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.
if the compacted s3chunkinfo is inserted, does it means all behind s3chunkinfos in origList is newer ? if so, you can just add all newer s3chunkinfos into newList once.
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.
yes, add a fastpath for the left ones
2. with diskcache write cache enable, metadata may be newer than data in s3. so we will meet s3 read failure, add retry to workaround this situation. 3. change GetOrModifyS3ChunkInfo to keep order
recheck |
newer than data in s3. so we will meet s3 read failure,
add retry to workaround this situation.