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

refactor s3compact code & workaround read failure when diskcachetype=2 #1006

Merged
merged 1 commit into from
Jan 28, 2022
Merged

refactor s3compact code & workaround read failure when diskcachetype=2 #1006

merged 1 commit into from
Jan 28, 2022

Conversation

h0hmj
Copy link
Contributor

@h0hmj h0hmj commented Jan 17, 2022

  1. refactor s3compact code
  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 request process, to keep order in s3chunkinfolist

@h0hmj
Copy link
Contributor Author

h0hmj commented Jan 21, 2022

recheck

@@ -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,
Copy link
Contributor

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

Copy link
Contributor Author

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";
Copy link
Contributor

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 ?

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
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.

capture origS3chunk only, specific it

*newList.add_s3chunks() = toAddList.s3chunks(0);
VLOG(9) << "s3compact: add chunkid "
<< toAddList.s3chunks(0).chunkid();
inserted = true;
Copy link
Contributor

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.

Copy link
Contributor Author

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
@h0hmj
Copy link
Contributor Author

h0hmj commented Jan 27, 2022

recheck

@wu-hanqing wu-hanqing merged commit 287ee2c into opencurve:master Jan 28, 2022
@h0hmj h0hmj deleted the refactor-s3compact branch May 30, 2023 07:11
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.

3 participants