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

curve-fuse: update attr and extent in single rpc (#1779) #1784

Merged
merged 2 commits into from
Aug 5, 2022

Conversation

wu-hanqing
Copy link
Contributor

Signed-off-by: Hanqing Wu wuhanqing@corp.netease.com

What problem does this PR solve?

Issue Number: #1779

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

@wu-hanqing
Copy link
Contributor Author

recheck

1 similar comment
@wu-hanqing
Copy link
Contributor Author

recheck

@wu-hanqing
Copy link
Contributor Author

recheck

@wu-hanqing
Copy link
Contributor Author

recheck

@wu-hanqing
Copy link
Contributor Author

recheck

3 similar comments
@wu-hanqing
Copy link
Contributor Author

recheck

@wu-hanqing
Copy link
Contributor Author

recheck

@wu-hanqing
Copy link
Contributor Author

recheck

@@ -960,11 +960,46 @@ void MetaServerClientImpl::UpdateInodeAttrAsync(
UpdateInodeAsync(request, done);
}

namespace {
UpdateInodeRequest BuildUpdateInodeRequest(const Inode& inode,
Copy link
Contributor

Choose a reason for hiding this comment

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

This function may can reuse BuileUpdateInodeAttrWithOutNlinkRequest after modify it.

  1. maybe the name may change to "BuileUpdateInodeWithOutNlinkRequest"
  2. change param 's3chunkinfo' to 'DataIndices'

After this the interface maybe more abstract and unified

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix

@@ -159,6 +164,12 @@ class InodeWrapper : public std::enable_shared_from_this<InodeWrapper> {
return inode_.length();
}

// Get inode's length.
// REQUIRES: |mtx_| is held
uint64_t GetLengthLocked() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of Locked and Unlocked is mismatch with existing code. You can think how to deal with.

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 deleted.

I see this problem, and this is because we don't have a coding style, even though we claim that our code is adhering to google c++ coding style, but is not, we broke many rules.

About this problem, the suffix Locked means the caller must hold the lock. This convention is adopted by many famous open source projects, like rocksdb example, chromium example.

@@ -141,6 +109,10 @@ InodeCacheManagerImpl::GetInode(uint64_t inodeId,
bool ok = iCache_->Get(inodeId, &out);
if (ok) {
curve::common::UniqueLock lgGuard = out->GetUniqueLock();
if (out->GetType() == FsFileType::TYPE_FILE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If volumeExtentList may becomes too large like s3chunkinfo in inode, You can add a TODO here and refresh later.

Copy link
Contributor Author

@wu-hanqing wu-hanqing Aug 5, 2022

Choose a reason for hiding this comment

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

It's problem but they have different logic, random write will not generate new extent lists, and volume doesn't have compaction now.

@@ -154,7 +126,10 @@ InodeCacheManagerImpl::GetInode(uint64_t inodeId,
option_.refreshDataIntervalSec);

// refresh data
REFRESH_DATA_REMOTE(out, streaming);
{
curve::common::UniqueLock lgGuard = out->GetUniqueLock();
Copy link
Contributor

Choose a reason for hiding this comment

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

The lock here maybe useless, because this inodeWapper just created and not be used outside.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix

@@ -294,6 +294,7 @@ message UpdateInodeRequest {
map<string, string> xattr = 20;
repeated uint64 parent = 21;
map<uint64, S3ChunkInfoList> s3ChunkInfoAdd = 22;
optional VolumeExtentList extents = 23;
Copy link
Contributor

Choose a reason for hiding this comment

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

extents -> volumeExtents

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix

@wu-hanqing
Copy link
Contributor Author

recheck

1 similar comment
@wu-hanqing
Copy link
Contributor Author

recheck

Signed-off-by: Hanqing Wu <wuhanqing@corp.netease.com>
Signed-off-by: Hanqing Wu <wuhanqing@corp.netease.com>
@wu-hanqing
Copy link
Contributor Author

recheck

@wu-hanqing wu-hanqing merged commit bb9ee7f into opencurve:master Aug 5, 2022
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