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: support client mdsaddrs override #2892

Merged
merged 4 commits into from
Dec 8, 2023
Merged

curvefs: support client mdsaddrs override #2892

merged 4 commits into from
Dec 8, 2023

Conversation

h0hmj
Copy link
Contributor

@h0hmj h0hmj commented Nov 13, 2023

we need to make client alive when migrate mds to new ones. so we add online client mds addrs override to broadcast by session.

tool -> send SetClientMdsAddrsOverride to mds, will keep active mds
mds -> refresh session send to client
client -> change mds addr to override ones

use case:
client -> mds A,B,C
change to client -> mds A,B,C,D,E,F
change to client -> mds D,E,F

@h0hmj h0hmj changed the title Support mdsaddrs override curvefs: support client mdsaddrs override Nov 13, 2023
@h0hmj h0hmj marked this pull request as ready for review November 15, 2023 10:14
@h0hmj
Copy link
Contributor Author

h0hmj commented Nov 15, 2023

cicheck

@@ -1280,5 +1289,10 @@ bool FsManager::FillVolumeInfo(common::Volume* volume) {
return true;
}

void FsManager::SetClientMdsAddrsOverride(const std::string& addrs) {
WriteLockGuard lock(clientMdsAddrsOverrideMutex_);
clientMdsAddrsOverride_ = addrs;
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 do some basic verification of the IP addresses, otherwise, it may cause client exception.

Another point is that it is better to update the addresses gradually, you cannot change all addresses directly. For example, you must change from (A,B,C) -> (A,B,C,D,E,F) -> (D, E, F).

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, should you persist mds addresses into etcd? Becuase there's chance that mds exit before client get new addresses.

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 do some basic verification of the IP addresses, otherwise, it may cause client exception.

Another point is that it is better to update the addresses gradually, you cannot change all addresses directly. For example, you must change from (A,B,C) -> (A,B,C,D,E,F) -> (D, E, F).

ok i will make sure active mds is in the override ones

Copy link
Contributor Author

Choose a reason for hiding this comment

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

BTW, should you persist mds addresses into etcd? Becuase there's chance that mds exit before client get new addresses.

no. it's just a temporary online advanced setting.

@@ -550,7 +552,17 @@ MdsClientImpl::RefreshSession(const std::vector<PartitionTxId> &txIds,
FsQuotaChecker::GetInstance().UpdateQuotaCache(
response.fscapacity(), response.fsusedbytes());
}

if (response.has_mdsaddrsoverride()) {
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 not a good idea to put heavy logic in here, MdsClientImpl is just used for communicate with MDS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

curve::common::SplitString(response.mdsaddrsoverride(), ",",
&mdsAddrsOverride);
if (!mdsAddrsOverride.empty()) {
mdsOpt_.rpcRetryOpt.addrs = mdsAddrsOverride;
Copy link
Contributor

Choose a reason for hiding this comment

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

data race

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, will add safe get&set for rpcexcutor_'s retryOption

ReadLockGuard lock(retryOptLock_);
// happen when mds scaling down
if (mdsindex >= static_cast<int>(retryOpt_.addrs.size())) {
return -EHOSTDOWN;
Copy link
Contributor

Choose a reason for hiding this comment

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

return -brpc::ELOGOFF is better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@YunhuiChen
Copy link
Contributor

cicheck

4 similar comments
@h0hmj
Copy link
Contributor Author

h0hmj commented Nov 22, 2023

cicheck

@h0hmj
Copy link
Contributor Author

h0hmj commented Nov 22, 2023

cicheck

@h0hmj
Copy link
Contributor Author

h0hmj commented Nov 24, 2023

cicheck

@h0hmj
Copy link
Contributor Author

h0hmj commented Nov 30, 2023

cicheck

curvefs/proto/mds.proto Show resolved Hide resolved
curvefs/src/mds/fs_manager.cpp Show resolved Hide resolved
curvefs/src/mds/fs_manager.cpp Show resolved Hide resolved
curvefs/src/mds/mds.cpp Show resolved Hide resolved
@SeanHai
Copy link
Contributor

SeanHai commented Nov 30, 2023

New unit test cases are needed to verify the code you added.

@h0hmj
Copy link
Contributor Author

h0hmj commented Dec 8, 2023

cicheck

@h0hmj
Copy link
Contributor Author

h0hmj commented Dec 8, 2023

New unit test cases are needed to verify the code you added.

yes. new uts have been added.

@h0hmj
Copy link
Contributor Author

h0hmj commented Dec 8, 2023

cicheck

@h0hmj h0hmj merged commit c653b74 into opencurve:master Dec 8, 2023
4 checks passed
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