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 18, 2023
1 parent 505cc7a commit 2b103f7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions curvefs/src/mds/fs_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,15 +795,27 @@ 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()) {
return lhs.objectprefix() == 0;
}
if (rhs.has_objectprefix() && !lhs.has_objectprefix()) {
return rhs.objectprefix() == 0;
}

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 2b103f7

Please sign in to comment.