Skip to content

Commit

Permalink
[fix] curvefs: mds: createfs error
Browse files Browse the repository at this point in the history
Signed-off-by: swj <1186093704@qq.com>
  • Loading branch information
201341 committed Oct 24, 2023
1 parent 7819a31 commit ac73df0
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions curvefs/src/mds/fs_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,15 +808,29 @@ int FsManager::IsExactlySameOrCreateUnComplete(const std::string& fsName,
return google::protobuf::util::MessageDifferencer::Equals(lhs, rhs);
};

auto checkFsInfo = [fsType, volumeInfoComparator](const FsDetail& lhs,
const FsDetail& rhs) {
auto s3InfoComparator = [](common::S3Info lhs, common::S3Info rhs) {
// for compatible with old clients
if (lhs.has_objectprefix() && !rhs.has_objectprefix() &&
lhs.objectprefix() != 0) {
return false;
}
if (rhs.has_objectprefix() && !lhs.has_objectprefix() &&
rhs.objectprefix() != 0) {
return false;
}

return google::protobuf::util::MessageDifferencer::Equals(lhs, rhs);
};

auto checkFsInfo = [fsType, volumeInfoComparator, s3InfoComparator](
const FsDetail& lhs, const FsDetail& rhs) {
switch (fsType) {
case curvefs::common::FSType::TYPE_S3:
return MessageDifferencer::Equals(lhs.s3info(), rhs.s3info());
return s3InfoComparator(lhs.s3info(), rhs.s3info());
case curvefs::common::FSType::TYPE_VOLUME:
return volumeInfoComparator(lhs.volume(), rhs.volume());
case curvefs::common::FSType::TYPE_HYBRID:
return MessageDifferencer::Equals(lhs.s3info(), rhs.s3info()) &&
return s3InfoComparator(lhs.s3info(), rhs.s3info()) &&
volumeInfoComparator(lhs.volume(), rhs.volume());
}

Expand Down

0 comments on commit ac73df0

Please sign in to comment.