From 106a550c03641e98ebf516a35709cb6abef973ba Mon Sep 17 00:00:00 2001 From: swj <1186093704@qq.com> Date: Sun, 6 Aug 2023 22:45:22 +0800 Subject: [PATCH] [feat]: curvefs: merge two rpc into one rpc when makenode Signed-off-by: swj <1186093704@qq.com> --- curvefs/proto/metaserver.proto | 4 + curvefs/src/client/dentry_cache_manager.cpp | 10 +- curvefs/src/client/dentry_cache_manager.h | 12 +- curvefs/src/client/fuse_client.cpp | 140 ++++-------------- .../client/rpcclient/metaserver_client.cpp | 9 +- .../src/client/rpcclient/metaserver_client.h | 10 +- .../metaserverclient/metaserver_client.cpp | 4 + curvefs/src/metaserver/inode_manager.cpp | 74 +++++++-- curvefs/src/metaserver/inode_manager.h | 9 +- curvefs/src/metaserver/metastore.cpp | 7 +- curvefs/src/metaserver/partition.cpp | 12 +- curvefs/src/metaserver/partition.h | 6 +- .../test/client/mock_dentry_cache_mamager.h | 5 +- curvefs/test/client/mock_metaserver_client.h | 5 +- .../rpcclient/metaserver_client_test.cpp | 13 +- .../test/client/test_dentry_cache_manager.cpp | 19 ++- curvefs/test/client/test_fuse_s3_client.cpp | 113 -------------- .../test/client/test_fuse_volume_client.cpp | 14 +- .../test/metaserver/partition_clean_test.cpp | 6 +- curvefs/test/metaserver/partition_test.cpp | 7 +- .../test/metaserver/recycle_cleaner_test.cpp | 16 +- .../test/metaserver/recycle_manager_test.cpp | 6 +- 22 files changed, 211 insertions(+), 290 deletions(-) diff --git a/curvefs/proto/metaserver.proto b/curvefs/proto/metaserver.proto index 4340d638cc..bc21f6c2de 100644 --- a/curvefs/proto/metaserver.proto +++ b/curvefs/proto/metaserver.proto @@ -114,6 +114,10 @@ message CreateDentryRequest { required uint32 copysetId = 2; required uint32 partitionId = 3; required Dentry dentry = 4; + required bool enableSumInDir = 5; + required uint64 length = 6; + required uint64 time = 7; + required uint32 time_ns = 8; } message CreateDentryResponse { diff --git a/curvefs/src/client/dentry_cache_manager.cpp b/curvefs/src/client/dentry_cache_manager.cpp index afb5e49eef..f5bd202cdf 100644 --- a/curvefs/src/client/dentry_cache_manager.cpp +++ b/curvefs/src/client/dentry_cache_manager.cpp @@ -63,10 +63,16 @@ CURVEFS_ERROR DentryCacheManagerImpl::GetDentry(uint64_t parent, return CURVEFS_ERROR::OK; } -CURVEFS_ERROR DentryCacheManagerImpl::CreateDentry(const Dentry &dentry) { +CURVEFS_ERROR DentryCacheManagerImpl::CreateDentry(const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now) { std::string key = GetDentryCacheKey(dentry.parentinodeid(), dentry.name()); NameLockGuard lock(nameLock_, key); - MetaStatusCode ret = metaClient_->CreateDentry(dentry); + MetaStatusCode ret = metaClient_->CreateDentry(dentry, + enableSumInDir, + length, + now); if (ret != MetaStatusCode::OK) { LOG(ERROR) << "metaClient_ CreateDentry failed, MetaStatusCode = " << ret diff --git a/curvefs/src/client/dentry_cache_manager.h b/curvefs/src/client/dentry_cache_manager.h index 84f9f20f53..1925df0681 100644 --- a/curvefs/src/client/dentry_cache_manager.h +++ b/curvefs/src/client/dentry_cache_manager.h @@ -60,7 +60,11 @@ class DentryCacheManager { virtual CURVEFS_ERROR GetDentry(uint64_t parent, const std::string &name, Dentry *out) = 0; - virtual CURVEFS_ERROR CreateDentry(const Dentry &dentry) = 0; + virtual CURVEFS_ERROR CreateDentry( + const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now) = 0; virtual CURVEFS_ERROR DeleteDentry(uint64_t parent, const std::string &name, @@ -86,7 +90,11 @@ class DentryCacheManagerImpl : public DentryCacheManager { CURVEFS_ERROR GetDentry(uint64_t parent, const std::string &name, Dentry *out) override; - CURVEFS_ERROR CreateDentry(const Dentry &dentry) override; + CURVEFS_ERROR CreateDentry( + const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now) override; CURVEFS_ERROR DeleteDentry(uint64_t parent, const std::string &name, diff --git a/curvefs/src/client/fuse_client.cpp b/curvefs/src/client/fuse_client.cpp index b67d0faa66..b7ce8f194e 100644 --- a/curvefs/src/client/fuse_client.cpp +++ b/curvefs/src/client/fuse_client.cpp @@ -440,8 +440,12 @@ CURVEFS_ERROR FuseClient::MakeNode( if (type == FsFileType::TYPE_FILE || type == FsFileType::TYPE_S3) { dentry.set_flag(DentryFlag::TYPE_FILE_FLAG); } - - ret = dentryManager_->CreateDentry(dentry); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + ret = dentryManager_->CreateDentry(dentry, + enableSumInDir_.load(), + inodeWrapper->GetLength(), + now); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "dentryManager_ CreateDentry fail, ret = " << ret << ", parent = " << parent << ", name = " << name @@ -456,37 +460,10 @@ CURVEFS_ERROR FuseClient::MakeNode( return ret; } - ret = UpdateParentMCTimeAndNlink(parent, type, NlinkChange::kAddOne); - if (ret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentMCTimeAndNlink failed" - << ", parent: " << parent - << ", name: " << name - << ", type: " << type; - return ret; - } - VLOG(6) << "dentryManager_ CreateDentry success" << ", parent = " << parent << ", name = " << name - << ", mode = " << mode; - - if (enableSumInDir_.load()) { - // update parent summary info - XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); - if (type == FsFileType::TYPE_DIRECTORY) { - xattr.mutable_xattrinfos()->insert({XATTRSUBDIRS, "1"}); - } else { - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); - } - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); - auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true); - if (tret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentInodeXattr failed," - << " inodeId = " << parent - << ", xattr = " << xattr.DebugString(); - } - } + << ", mode = " << mode << " , length:"<< inodeWrapper->GetLength() + << " , sumIndir:" << enableSumInDir_.load(); return ret; } @@ -620,8 +597,12 @@ CURVEFS_ERROR FuseClient::CreateManageNode(fuse_req_t req, if (type == FsFileType::TYPE_FILE || type == FsFileType::TYPE_S3) { dentry.set_flag(DentryFlag::TYPE_FILE_FLAG); } - - ret = dentryManager_->CreateDentry(dentry); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + ret = dentryManager_->CreateDentry(dentry, + enableSumInDir_.load(), + inodeWrapper->GetLength(), + now); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "dentryManager_ CreateDentry fail, ret = " << ret << ", parent = " << parent << ", name = " << name @@ -636,38 +617,10 @@ CURVEFS_ERROR FuseClient::CreateManageNode(fuse_req_t req, return ret; } - ret = UpdateParentMCTimeAndNlink(parent, type, NlinkChange::kAddOne); - if (ret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentMCTimeAndNlink failed" - << ", parent: " << parent - << ", name: " << name - << ", type: " << type; - return ret; - } - VLOG(6) << "dentryManager_ CreateDentry success" << ", parent = " << parent << ", name = " << name << ", mode = " << mode; - if (enableSumInDir_.load()) { - // update parent summary info - XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); - if (type == FsFileType::TYPE_DIRECTORY) { - xattr.mutable_xattrinfos()->insert({XATTRSUBDIRS, "1"}); - } else { - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); - } - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); - auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true); - if (tret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentInodeXattr failed," - << " inodeId = " << parent - << ", xattr = " << xattr.DebugString(); - } - } - inodeWrapper->GetInodeAttrLocked(&entryOut->attr); return ret; } @@ -1216,7 +1169,12 @@ CURVEFS_ERROR FuseClient::FuseOpSymlink(fuse_req_t req, dentry.set_parentinodeid(parent); dentry.set_name(name); dentry.set_type(inodeWrapper->GetType()); - ret = dentryManager_->CreateDentry(dentry); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + ret = dentryManager_->CreateDentry(dentry, + enableSumInDir_.load(), + inodeWrapper->GetLength(), + now); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "dentryManager_ CreateDentry fail, ret = " << ret << ", parent = " << parent << ", name = " << name @@ -1231,32 +1189,6 @@ CURVEFS_ERROR FuseClient::FuseOpSymlink(fuse_req_t req, return ret; } - ret = UpdateParentMCTimeAndNlink(parent, FsFileType::TYPE_SYM_LINK, - NlinkChange::kAddOne); - if (ret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentMCTimeAndNlink failed" - << ", link:" << link - << ", parent: " << parent - << ", name: " << name - << ", type: " << FsFileType::TYPE_SYM_LINK; - return ret; - } - - if (enableSumInDir_.load()) { - // update parent summary info - XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); - auto tret = xattrManager_->UpdateParentInodeXattr(parent, xattr, true); - if (tret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentInodeXattr failed," - << " inodeId = " << parent - << ", xattr = " << xattr.DebugString(); - } - } - inodeWrapper->GetInodeAttr(&entryOut->attr); return ret; } @@ -1290,7 +1222,12 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, dentry.set_parentinodeid(newparent); dentry.set_name(newname); dentry.set_type(inodeWrapper->GetType()); - ret = dentryManager_->CreateDentry(dentry); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + ret = dentryManager_->CreateDentry(dentry, + enableSumInDir_.load(), + inodeWrapper->GetLength(), + now); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "dentryManager_ CreateDentry fail, ret = " << ret << ", parent = " << newparent << ", name = " << newname; @@ -1303,31 +1240,6 @@ CURVEFS_ERROR FuseClient::FuseOpLink(fuse_req_t req, return ret; } - ret = UpdateParentMCTimeAndNlink(newparent, type, NlinkChange::kAddOne); - if (ret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentMCTimeAndNlink failed" - << ", parent: " << newparent - << ", name: " << newname - << ", type: " << type; - return ret; - } - - if (enableSumInDir_.load()) { - // update parent summary info - XAttr xattr; - xattr.mutable_xattrinfos()->insert({XATTRENTRIES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFILES, "1"}); - xattr.mutable_xattrinfos()->insert({XATTRFBYTES, - std::to_string(inodeWrapper->GetLength())}); - auto tret = xattrManager_->UpdateParentInodeXattr( - newparent, xattr, true); - if (tret != CURVEFS_ERROR::OK) { - LOG(ERROR) << "UpdateParentInodeXattr failed," - << " inodeId = " << newparent - << ", xattr = " << xattr.DebugString(); - } - } - inodeWrapper->GetInodeAttr(&entryOut->attr); return ret; } diff --git a/curvefs/src/client/rpcclient/metaserver_client.cpp b/curvefs/src/client/rpcclient/metaserver_client.cpp index 0422436981..7adce28268 100644 --- a/curvefs/src/client/rpcclient/metaserver_client.cpp +++ b/curvefs/src/client/rpcclient/metaserver_client.cpp @@ -237,7 +237,10 @@ MetaStatusCode MetaServerClientImpl::ListDentry(uint32_t fsId, uint64_t inodeid, return ConvertToMetaStatusCode(excutor.DoRPCTask()); } -MetaStatusCode MetaServerClientImpl::CreateDentry(const Dentry &dentry) { +MetaStatusCode MetaServerClientImpl::CreateDentry(const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now) { auto task = RPCTask { (void)taskExecutorDone; metric_.createDentry.qps.count << 1; @@ -255,6 +258,10 @@ MetaStatusCode MetaServerClientImpl::CreateDentry(const Dentry &dentry) { d->set_txid(txId); d->set_type(dentry.type()); request.set_allocated_dentry(d); + request.set_enablesumindir(enableSumInDir); + request.set_length(length); + request.set_time(now.tv_sec); + request.set_time_ns(now.tv_nsec); curvefs::metaserver::MetaServerService_Stub stub(channel); stub.CreateDentry(cntl, &request, &response, nullptr); diff --git a/curvefs/src/client/rpcclient/metaserver_client.h b/curvefs/src/client/rpcclient/metaserver_client.h index cd2a233da3..2f4c23ba5a 100644 --- a/curvefs/src/client/rpcclient/metaserver_client.h +++ b/curvefs/src/client/rpcclient/metaserver_client.h @@ -92,7 +92,10 @@ class MetaServerClient { bool onlyDir, std::list *dentryList) = 0; - virtual MetaStatusCode CreateDentry(const Dentry &dentry) = 0; + virtual MetaStatusCode CreateDentry(const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now) = 0; virtual MetaStatusCode DeleteDentry(uint32_t fsId, uint64_t inodeid, const std::string &name, @@ -200,7 +203,10 @@ class MetaServerClientImpl : public MetaServerClient { bool onlyDir, std::list *dentryList) override; - MetaStatusCode CreateDentry(const Dentry &dentry) override; + MetaStatusCode CreateDentry(const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now) override; MetaStatusCode DeleteDentry(uint32_t fsId, uint64_t inodeid, const std::string &name, diff --git a/curvefs/src/mds/metaserverclient/metaserver_client.cpp b/curvefs/src/mds/metaserverclient/metaserver_client.cpp index 0fb40eac30..f7ee18a285 100644 --- a/curvefs/src/mds/metaserverclient/metaserver_client.cpp +++ b/curvefs/src/mds/metaserverclient/metaserver_client.cpp @@ -274,6 +274,10 @@ FSStatusCode MetaserverClient::CreateDentry( d->set_txid(0); d->set_type(FsFileType::TYPE_DIRECTORY); request.set_allocated_dentry(d); + request.set_enablesumindir(false); + request.set_length(0); + request.set_time(0); + request.set_time_ns(0); auto fp = &MetaServerService_Stub::CreateDentry; LeaderCtx ctx; diff --git a/curvefs/src/metaserver/inode_manager.cpp b/curvefs/src/metaserver/inode_manager.cpp index be56544034..3b0e654513 100644 --- a/curvefs/src/metaserver/inode_manager.cpp +++ b/curvefs/src/metaserver/inode_manager.cpp @@ -36,6 +36,7 @@ using ::curve::common::TimeUtility; using ::curve::common::NameLockGuard; +using ::curvefs::client::common::AddUllStringToFirst; using ::google::protobuf::util::MessageDifferencer; namespace curvefs { @@ -471,50 +472,93 @@ MetaStatusCode InodeManager::PaddingInodeS3ChunkInfo(int32_t fsId, } MetaStatusCode InodeManager::UpdateInodeWhenCreateOrRemoveSubNode( - uint32_t fsId, uint64_t inodeId, FsFileType type, bool isCreate) { + Dentry dentry, + bool enableSumInDir, + uint64_t length, + uint64_t now, + uint32_t now_ns, + bool isCreate) { + uint64_t fsId = dentry.fsid(); + uint64_t parentInodeId = dentry.parentinodeid(); + FsFileType type = dentry.type(); + MetaStatusCode ret = MetaStatusCode::OK; + Inode parentInode; VLOG(6) << "UpdateInodeWhenCreateOrRemoveSubNode, fsId = " << fsId - << ", inodeId = " << inodeId + << ", inodeId = " << parentInodeId << ", isCreate = " << isCreate; - NameLockGuard lg(inodeLock_, GetInodeLockName(fsId, inodeId)); - - Inode inode; - MetaStatusCode ret = inodeStorage_->Get( - Key4Inode(fsId, inodeId), &inode); + NameLockGuard lg(inodeLock_, GetInodeLockName(fsId, parentInodeId)); + ret = inodeStorage_->Get( + Key4Inode(fsId, parentInodeId), &parentInode); if (ret != MetaStatusCode::OK) { - LOG(ERROR) << "GetInode fail, " << inode.ShortDebugString() + LOG(ERROR) << "GetInode fail, " << parentInode.ShortDebugString() << ", ret = " << MetaStatusCode_Name(ret); return ret; } - uint32_t oldNlink = inode.nlink(); + uint32_t oldNlink = parentInode.nlink(); if (oldNlink == 0) { LOG(ERROR) << "UpdateInodeWhenCreateOrRemoveSubNode already be deleted!" << " fsId: " << fsId - << ", inodeId: " << inodeId + << ", inodeId: " << parentInodeId << ", type: " << type << ", isCreate: " << isCreate; // already be deleted return MetaStatusCode::OK; } + if (enableSumInDir) { + if (!(AddUllStringToFirst( + &(parentInode.mutable_xattr()->find(XATTRENTRIES)->second), + 1, isCreate) && + AddUllStringToFirst( + &(parentInode.mutable_xattr()->find(XATTRFBYTES)->second), + length, isCreate))) { + return MetaStatusCode::UNKNOWN_ERROR; + } + if (FsFileType::TYPE_DIRECTORY == type) { + if (!AddUllStringToFirst( + &(parentInode.mutable_xattr()->find(XATTRSUBDIRS)->second), + 1, isCreate)) { + return MetaStatusCode::UNKNOWN_ERROR; + } + } else { + if (!AddUllStringToFirst( + &(parentInode.mutable_xattr()->find(XATTRFILES)->second), + 1, isCreate)) { + return MetaStatusCode::UNKNOWN_ERROR; + } + } + } + if (FsFileType::TYPE_DIRECTORY == type) { if (isCreate) { - inode.set_nlink(++oldNlink); + parentInode.set_nlink(++oldNlink); } else { - inode.set_nlink(--oldNlink); + parentInode.set_nlink(--oldNlink); } } - ret = inodeStorage_->Update(inode); + // update mctime and changetime + if (now != 0) { + parentInode.set_mtime(now); + parentInode.set_ctime(now); + } + + if (now_ns != 0) { + parentInode.set_mtime_ns(now_ns); + parentInode.set_ctime_ns(now_ns); + } + + ret = inodeStorage_->Update(parentInode); if (ret != MetaStatusCode::OK) { - LOG(ERROR) << "UpdateInode fail, " << inode.ShortDebugString() + LOG(ERROR) << "UpdateInode fail, " << parentInode.ShortDebugString() << ", ret = " << MetaStatusCode_Name(ret); return ret; } VLOG(9) << "UpdateInodeWhenCreateOrRemoveSubNode success, " - << inode.ShortDebugString(); + << parentInode.ShortDebugString(); return MetaStatusCode::OK; } diff --git a/curvefs/src/metaserver/inode_manager.h b/curvefs/src/metaserver/inode_manager.h index eedc3c807d..1ced1c2692 100644 --- a/curvefs/src/metaserver/inode_manager.h +++ b/curvefs/src/metaserver/inode_manager.h @@ -103,8 +103,13 @@ class InodeManager { S3ChunkInfoMap* m, uint64_t limit = 0); - MetaStatusCode UpdateInodeWhenCreateOrRemoveSubNode(uint32_t fsId, - uint64_t inodeId, FsFileType type, bool isCreate); + MetaStatusCode UpdateInodeWhenCreateOrRemoveSubNode( + Dentry dentry, + bool enableSumInDir, + uint64_t length, + uint64_t now, + uint32_t now_ns, + bool isCreate); MetaStatusCode InsertInode(const Inode &inode); diff --git a/curvefs/src/metaserver/metastore.cpp b/curvefs/src/metaserver/metastore.cpp index d927ca8c37..cf5e581eba 100644 --- a/curvefs/src/metaserver/metastore.cpp +++ b/curvefs/src/metaserver/metastore.cpp @@ -359,7 +359,12 @@ MetaStatusCode MetaStoreImpl::CreateDentry(const CreateDentryRequest *request, std::shared_ptr partition; GET_PARTITION_OR_RETURN(partition); - MetaStatusCode status = partition->CreateDentry(request->dentry()); + MetaStatusCode status = + partition->CreateDentry(request->dentry(), + request->enablesumindir(), + request->length(), + request->time(), + request->time_ns()); response->set_statuscode(status); return status; } diff --git a/curvefs/src/metaserver/partition.cpp b/curvefs/src/metaserver/partition.cpp index 1cb4266759..eeb7e0b079 100644 --- a/curvefs/src/metaserver/partition.cpp +++ b/curvefs/src/metaserver/partition.cpp @@ -108,15 +108,18 @@ Partition::Partition(PartitionInfo partition, } \ } while (0) -MetaStatusCode Partition::CreateDentry(const Dentry& dentry) { +MetaStatusCode Partition::CreateDentry(const Dentry& dentry, + bool enableSumInDir, + uint64_t length, + uint64_t now, + uint32_t now_ns) { PRECHECK(dentry.fsid(), dentry.parentinodeid()); MetaStatusCode ret = dentryManager_->CreateDentry(dentry); if (MetaStatusCode::OK == ret) { if (dentry.has_type()) { return inodeManager_->UpdateInodeWhenCreateOrRemoveSubNode( - dentry.fsid(), dentry.parentinodeid(), - dentry.type(), true); + dentry, enableSumInDir, length, now, now_ns, true); } else { LOG(ERROR) << "CreateDentry does not have type, " << dentry.ShortDebugString(); @@ -149,8 +152,7 @@ MetaStatusCode Partition::DeleteDentry(const Dentry& dentry) { if (MetaStatusCode::OK == ret) { if (dentry.has_type()) { return inodeManager_->UpdateInodeWhenCreateOrRemoveSubNode( - dentry.fsid(), dentry.parentinodeid(), - dentry.type(), false); + dentry, false, 0, 0, 0, false); } else { LOG(ERROR) << "DeleteDentry does not have type, " << dentry.ShortDebugString(); diff --git a/curvefs/src/metaserver/partition.h b/curvefs/src/metaserver/partition.h index 7d307b3a39..f6f677c0f2 100644 --- a/curvefs/src/metaserver/partition.h +++ b/curvefs/src/metaserver/partition.h @@ -56,7 +56,11 @@ class Partition { Partition() = default; // dentry - MetaStatusCode CreateDentry(const Dentry& dentry); + MetaStatusCode CreateDentry(const Dentry& dentry, + bool enableSumInDir, + uint64_t length, + uint64_t now, + uint32_t now_ns); MetaStatusCode LoadDentry(const DentryVec& vec, bool merge); diff --git a/curvefs/test/client/mock_dentry_cache_mamager.h b/curvefs/test/client/mock_dentry_cache_mamager.h index 2e5e8ac41e..ac749429d9 100644 --- a/curvefs/test/client/mock_dentry_cache_mamager.h +++ b/curvefs/test/client/mock_dentry_cache_mamager.h @@ -40,7 +40,10 @@ class MockDentryCacheManager : public DentryCacheManager { MOCK_METHOD3(GetDentry, CURVEFS_ERROR(uint64_t parent, const std::string &name, Dentry *out)); - MOCK_METHOD1(CreateDentry, CURVEFS_ERROR(const Dentry &dentry)); + MOCK_METHOD4(CreateDentry, CURVEFS_ERROR(const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now)); MOCK_METHOD3(DeleteDentry, CURVEFS_ERROR(uint64_t parent, const std::string &name, diff --git a/curvefs/test/client/mock_metaserver_client.h b/curvefs/test/client/mock_metaserver_client.h index b0fac7b1fe..c65cacce6d 100644 --- a/curvefs/test/client/mock_metaserver_client.h +++ b/curvefs/test/client/mock_metaserver_client.h @@ -62,7 +62,10 @@ class MockMetaServerClient : public MetaServerClient { const std::string &last, uint32_t count, bool onlyDir, std::list *dentryList)); - MOCK_METHOD1(CreateDentry, MetaStatusCode(const Dentry &dentry)); + MOCK_METHOD4(CreateDentry, MetaStatusCode(const Dentry &dentry, + bool enableSumInDir, + uint64_t length, + const struct timespec &now)); MOCK_METHOD4(DeleteDentry, MetaStatusCode( uint32_t fsId, uint64_t inodeid, const std::string &name, diff --git a/curvefs/test/client/rpcclient/metaserver_client_test.cpp b/curvefs/test/client/rpcclient/metaserver_client_test.cpp index 4fdae51576..8068805233 100644 --- a/curvefs/test/client/rpcclient/metaserver_client_test.cpp +++ b/curvefs/test/client/rpcclient/metaserver_client_test.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -316,7 +317,9 @@ TEST_F(MetaServerClientImplTest, test_CreateDentry_rpc_error) { .Times(1 + opt_.maxRetry) .WillRepeatedly(Return(true)); - MetaStatusCode status = metaserverCli_.CreateDentry(d); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + auto status = metaserverCli_.CreateDentry(d, false, 0, now); ASSERT_EQ(MetaStatusCode::RPC_ERROR, status); } @@ -343,7 +346,9 @@ TEST_F(MetaServerClientImplTest, test_CreateDentry_create_dentry_ok) { EXPECT_CALL(*mockMetacache_.get(), GetTarget(_, _, _, _)) .WillOnce(DoAll(SetArgPointee<2>(target_), Return(true))); - auto status = metaserverCli_.CreateDentry(d); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + auto status = metaserverCli_.CreateDentry(d, false, 0, now); ASSERT_EQ(MetaStatusCode::OK, status); } @@ -380,7 +385,9 @@ TEST_F(MetaServerClientImplTest, test_CreateDentry_copyset_not_exist) { EXPECT_CALL(*mockMetacache_.get(), GetTargetLeader(_, _)) .WillOnce(Return(true)); - auto status = metaserverCli_.CreateDentry(d); + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + auto status = metaserverCli_.CreateDentry(d, false, 0, now); ASSERT_EQ(MetaStatusCode::OK, status); } diff --git a/curvefs/test/client/test_dentry_cache_manager.cpp b/curvefs/test/client/test_dentry_cache_manager.cpp index 12230f451f..fd3efefdeb 100644 --- a/curvefs/test/client/test_dentry_cache_manager.cpp +++ b/curvefs/test/client/test_dentry_cache_manager.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "curvefs/test/client/mock_metaserver_client.h" #include "curvefs/src/client/dentry_cache_manager.h" @@ -124,6 +125,8 @@ TEST_F(TestDentryCacheManager, CreateAndGetDentry) { uint64_t inodeid = 100; const std::string name = "test"; Dentry out; + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); Dentry dentryExp; dentryExp.set_fsid(fsId_); @@ -131,7 +134,7 @@ TEST_F(TestDentryCacheManager, CreateAndGetDentry) { dentryExp.set_parentinodeid(parent); dentryExp.set_inodeid(inodeid); - EXPECT_CALL(*metaClient_, CreateDentry(_)) + EXPECT_CALL(*metaClient_, CreateDentry(_, _, _, _)) .WillOnce(Return(MetaStatusCode::UNKNOWN_ERROR)) .WillOnce(Return(MetaStatusCode::OK)); @@ -139,10 +142,10 @@ TEST_F(TestDentryCacheManager, CreateAndGetDentry) { .WillOnce(DoAll(SetArgPointee<3>(dentryExp), Return(MetaStatusCode::OK))); - CURVEFS_ERROR ret = dCacheManager_->CreateDentry(dentryExp); + CURVEFS_ERROR ret = dCacheManager_->CreateDentry(dentryExp, false, 0, now); ASSERT_EQ(CURVEFS_ERROR::UNKNOWN, ret); - ret = dCacheManager_->CreateDentry(dentryExp); + ret = dCacheManager_->CreateDentry(dentryExp, false, 0, now); ASSERT_EQ(CURVEFS_ERROR::OK, ret); ret = dCacheManager_->GetDentry(parent, name, &out); @@ -155,13 +158,13 @@ TEST_F(TestDentryCacheManager, CreateAndGetDentry) { fsId_, parent, name, FsFileType::TYPE_FILE)) .WillOnce(Return(MetaStatusCode::OK)); dCacheManager_->DeleteDentry(parent, name, FsFileType::TYPE_FILE); - EXPECT_CALL(*metaClient_, CreateDentry(_)) + EXPECT_CALL(*metaClient_, CreateDentry(_, _, _, _)) .WillOnce(Return(MetaStatusCode::OK)); EXPECT_CALL(*metaClient_, GetDentry(fsId_, parent, name, _)) .WillOnce( DoAll(SetArgPointee<3>(dentryExp), Return(MetaStatusCode::OK))); - ret = dCacheManager_->CreateDentry(dentryExp); + ret = dCacheManager_->CreateDentry(dentryExp, false, 0, now); ASSERT_EQ(CURVEFS_ERROR::OK, ret); ret = dCacheManager_->GetDentry(parent, name, &out); ASSERT_EQ(CURVEFS_ERROR::OK, ret); @@ -244,6 +247,8 @@ TEST_F(TestDentryCacheManager, GetTimeOutDentry) { uint64_t inodeid = 100; const std::string name = "test"; Dentry out; + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); Dentry dentryExp; dentryExp.set_fsid(fsId_); @@ -251,14 +256,14 @@ TEST_F(TestDentryCacheManager, GetTimeOutDentry) { dentryExp.set_parentinodeid(parent); dentryExp.set_inodeid(inodeid); - EXPECT_CALL(*metaClient_, CreateDentry(_)) + EXPECT_CALL(*metaClient_, CreateDentry(_, _, _, _)) .WillOnce(Return(MetaStatusCode::OK)); EXPECT_CALL(*metaClient_, GetDentry(fsId_, parent, name, _)) .WillOnce(DoAll(SetArgPointee<3>(dentryExp), Return(MetaStatusCode::OK))); - auto ret = dCacheManager_->CreateDentry(dentryExp); + auto ret = dCacheManager_->CreateDentry(dentryExp, false, 0, now); ASSERT_EQ(CURVEFS_ERROR::OK, ret); // get form dcache directly diff --git a/curvefs/test/client/test_fuse_s3_client.cpp b/curvefs/test/client/test_fuse_s3_client.cpp index aeb641badb..d39655af39 100644 --- a/curvefs/test/client/test_fuse_s3_client.cpp +++ b/curvefs/test/client/test_fuse_s3_client.cpp @@ -1516,73 +1516,6 @@ TEST_F(TestFuseS3Client, FuseOpGetXattr_EnableSumInDir_Failed) { ASSERT_EQ(CURVEFS_ERROR::INTERNAL, ret); } -TEST_F(TestFuseS3Client, FuseOpCreate_EnableSummary) { - client_->SetEnableSumInDir(true); - - fuse_req fakeReq; - fuse_ctx fakeCtx; - fakeReq.ctx = &fakeCtx; - fuse_req_t req = &fakeReq; - fuse_ino_t parent = 1; - const char* name = "xxx"; - mode_t mode = 1; - struct fuse_file_info fi; - fi.flags = 0; - - fuse_ino_t ino = 2; - Inode inode; - inode.set_fsid(fsId); - inode.set_inodeid(ino); - inode.set_length(4096); - inode.set_type(FsFileType::TYPE_FILE); - inode.set_openmpcount(0); - auto inodeWrapper = std::make_shared(inode, metaClient_); - - EXPECT_CALL(*inodeManager_, CreateInode(_, _)) - .WillOnce( - DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); - - EXPECT_CALL(*dentryManager_, CreateDentry(_)) - .WillOnce(Return(CURVEFS_ERROR::OK)); - - Inode parentInode; - parentInode.set_fsid(fsId); - parentInode.set_inodeid(parent); - parentInode.set_type(FsFileType::TYPE_DIRECTORY); - parentInode.set_nlink(2); - parentInode.mutable_xattr()->insert({XATTRFILES, "1"}); - parentInode.mutable_xattr()->insert({XATTRSUBDIRS, "1"}); - parentInode.mutable_xattr()->insert({XATTRENTRIES, "2"}); - parentInode.mutable_xattr()->insert({XATTRFBYTES, "100"}); - - auto parentInodeWrapper = std::make_shared( - parentInode, metaClient_); - EXPECT_CALL(*inodeManager_, GetInode(_, _)) - .WillOnce( - DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))) - .WillOnce( - DoAll(SetArgReferee<1>(parentInodeWrapper), - Return(CURVEFS_ERROR::OK))); - - EXPECT_CALL(*metaClient_, UpdateInodeAttrWithOutNlink(_, _, _, _, _)) - .WillRepeatedly(Return(MetaStatusCode::OK)); - - EXPECT_CALL(*inodeManager_, ShipToFlush(_)) - .Times(1); // update mtime directly - - EntryOut entryOut; - CURVEFS_ERROR ret = client_->FuseOpCreate(req, parent, name, mode, &fi, - &entryOut); - ASSERT_EQ(CURVEFS_ERROR::OK, ret); - - auto p = parentInodeWrapper->GetInodeLocked(); - ASSERT_EQ(p->xattr().find(XATTRFILES)->second, "2"); - ASSERT_EQ(p->xattr().find(XATTRSUBDIRS)->second, "1"); - ASSERT_EQ(p->xattr().find(XATTRENTRIES)->second, "3"); - ASSERT_EQ(p->xattr().find(XATTRFBYTES)->second, "4196"); -} - TEST_F(TestFuseS3Client, FuseOpWrite_EnableSummary) { client_->SetEnableSumInDir(true); @@ -1638,52 +1571,6 @@ TEST_F(TestFuseS3Client, FuseOpWrite_EnableSummary) { ASSERT_EQ(p->xattr().find(XATTRFBYTES)->second, std::to_string(size)); } -TEST_F(TestFuseS3Client, FuseOpLink_EnableSummary) { - client_->SetEnableSumInDir(true); - - fuse_req_t req = nullptr; - fuse_ino_t ino = 1; - fuse_ino_t newparent = 2; - const char* newname = "xxxx"; - - Inode inode; - inode.set_inodeid(ino); - inode.set_length(100); - inode.add_parent(0); - inode.set_nlink(1); - auto inodeWrapper = std::make_shared(inode, metaClient_); - - Inode pinode; - pinode.set_inodeid(0); - pinode.set_length(0); - pinode.mutable_xattr()->insert({XATTRFILES, "0"}); - pinode.mutable_xattr()->insert({XATTRSUBDIRS, "0"}); - pinode.mutable_xattr()->insert({XATTRENTRIES, "0"}); - pinode.mutable_xattr()->insert({XATTRFBYTES, "0"}); - auto pinodeWrapper = std::make_shared(pinode, metaClient_); - - EXPECT_CALL(*inodeManager_, GetInode(_, _)) - .WillOnce( - DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))) - .WillRepeatedly( - DoAll(SetArgReferee<1>(pinodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*metaClient_, UpdateInodeAttr(_, _, _)) - .WillRepeatedly(Return(MetaStatusCode::OK)); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) - .WillOnce(Return(CURVEFS_ERROR::OK)); - EXPECT_CALL(*inodeManager_, ShipToFlush(_)) - .Times(1); - EntryOut entryOut; - CURVEFS_ERROR ret = client_->FuseOpLink(req, ino, newparent, newname, - &entryOut); - ASSERT_EQ(CURVEFS_ERROR::OK, ret); - auto p = pinodeWrapper->GetInode(); - ASSERT_EQ(p.xattr().find(XATTRFILES)->second, "1"); - ASSERT_EQ(p.xattr().find(XATTRSUBDIRS)->second, "0"); - ASSERT_EQ(p.xattr().find(XATTRENTRIES)->second, "1"); - ASSERT_EQ(p.xattr().find(XATTRFBYTES)->second, "100"); -} - TEST_F(TestFuseS3Client, FuseOpUnlink_EnableSummary) { client_->SetEnableSumInDir(true); diff --git a/curvefs/test/client/test_fuse_volume_client.cpp b/curvefs/test/client/test_fuse_volume_client.cpp index 8c9e0869fc..74275cfc1a 100644 --- a/curvefs/test/client/test_fuse_volume_client.cpp +++ b/curvefs/test/client/test_fuse_volume_client.cpp @@ -435,7 +435,7 @@ TEST_F(TestFuseVolumeClient, FuseOpCreate) { .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::OK)); Inode parentInode; @@ -476,7 +476,7 @@ TEST_F(TestFuseVolumeClient, FuseOpMkDir) { .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::OK)); Inode parentInode; @@ -519,7 +519,7 @@ TEST_F(TestFuseVolumeClient, FuseOpCreateFailed) { .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::INTERNAL)); EntryOut entryOut; @@ -1472,7 +1472,7 @@ TEST_F(TestFuseVolumeClient, FuseOpSymlink) { .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::OK)); Inode parentInode; @@ -1519,7 +1519,7 @@ TEST_F(TestFuseVolumeClient, FuseOpSymlinkFailed) { .WillOnce( DoAll(SetArgReferee<1>(inodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::INTERNAL)) .WillOnce(Return(CURVEFS_ERROR::INTERNAL)); @@ -1592,7 +1592,7 @@ TEST_F(TestFuseVolumeClient, FuseOpLink) { .WillOnce(DoAll(SetArgReferee<1>(parentInodeWrapper), Return(CURVEFS_ERROR::OK))); - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::OK)); EXPECT_CALL(*metaClient_, GetInodeAttr(_, _, _)) @@ -1648,7 +1648,7 @@ TEST_F(TestFuseVolumeClient, FuseOpLinkFailed) { .WillOnce(Return(MetaStatusCode::OK)) // unlink .WillOnce(Return(MetaStatusCode::UNKNOWN_ERROR)); // unlink - EXPECT_CALL(*dentryManager_, CreateDentry(_)) + EXPECT_CALL(*dentryManager_, CreateDentry(_, _, _, _)) .WillOnce(Return(CURVEFS_ERROR::INTERNAL)) .WillOnce(Return(CURVEFS_ERROR::INTERNAL)); diff --git a/curvefs/test/metaserver/partition_clean_test.cpp b/curvefs/test/metaserver/partition_clean_test.cpp index d6dedd6234..cca2ecf99a 100644 --- a/curvefs/test/metaserver/partition_clean_test.cpp +++ b/curvefs/test/metaserver/partition_clean_test.cpp @@ -137,8 +137,10 @@ TEST_F(PartitionCleanManagerTest, test1) { dentry.set_txid(0); dentry.set_type(FsFileType::TYPE_DIRECTORY); ASSERT_EQ(partition->CreateRootInode(param), MetaStatusCode::OK); - ASSERT_EQ(partition->CreateDentry(dentry), MetaStatusCode::OK); - ASSERT_EQ(partition->CreateDentry(dentry), MetaStatusCode::OK); + ASSERT_EQ(partition->CreateDentry(dentry, false, 0, 0, 0), + MetaStatusCode::OK); + ASSERT_EQ(partition->CreateDentry(dentry, false, 0, 0, 0), + MetaStatusCode::OK); Inode inode1; param.type = FsFileType::TYPE_S3; diff --git a/curvefs/test/metaserver/partition_test.cpp b/curvefs/test/metaserver/partition_test.cpp index 9f1f15e480..b2a726e606 100644 --- a/curvefs/test/metaserver/partition_test.cpp +++ b/curvefs/test/metaserver/partition_test.cpp @@ -268,7 +268,8 @@ TEST_F(PartitionTest, dentrynum) { dentry.set_name("name"); dentry.set_txid(0); dentry.set_type(FsFileType::TYPE_DIRECTORY); - ASSERT_EQ(partition1.CreateDentry(dentry), MetaStatusCode::OK); + ASSERT_EQ(partition1.CreateDentry(dentry, false, 0, 0, 0), + MetaStatusCode::OK); ASSERT_EQ(partition1.GetDentryNum(), 1); ASSERT_EQ(partition1.DeleteDentry(dentry), MetaStatusCode::OK); @@ -295,9 +296,9 @@ TEST_F(PartitionTest, PARTITION_ID_MISSMATCH_ERROR) { dentry2.set_parentinodeid(200); // test CreateDentry - ASSERT_EQ(partition1.CreateDentry(dentry1), + ASSERT_EQ(partition1.CreateDentry(dentry1, false, 0, 0, 0), MetaStatusCode::PARTITION_ID_MISSMATCH); - ASSERT_EQ(partition1.CreateDentry(dentry2), + ASSERT_EQ(partition1.CreateDentry(dentry2, false, 0, 0, 0), MetaStatusCode::PARTITION_ID_MISSMATCH); // test DeleteDentry diff --git a/curvefs/test/metaserver/recycle_cleaner_test.cpp b/curvefs/test/metaserver/recycle_cleaner_test.cpp index 89321fc97d..23b79f229f 100644 --- a/curvefs/test/metaserver/recycle_cleaner_test.cpp +++ b/curvefs/test/metaserver/recycle_cleaner_test.cpp @@ -104,7 +104,8 @@ class RecycleCleanerTest : public testing::Test { dentry.set_parentinodeid(ROOTINODEID); dentry.set_type(FsFileType::TYPE_DIRECTORY); dentry.set_txid(0); - ASSERT_EQ(partition_->CreateDentry(dentry), MetaStatusCode::OK); + ASSERT_EQ(partition_->CreateDentry(dentry, false, 0, 0, 0), + MetaStatusCode::OK); } void TearDown() override { @@ -173,7 +174,8 @@ TEST_F(RecycleCleanerTest, dir_time_out_test) { EXPECT_CALL(*mdsclient_, GetFsInfo(2, _)) .WillOnce(DoAll(SetArgPointee<1>(fsInfo), Return(FSStatusCode::UNKNOWN_ERROR))) - .WillOnce(DoAll(SetArgPointee<1>(fsInfo), Return(FSStatusCode::OK))); + .WillOnce(DoAll(SetArgPointee<1>(fsInfo), + Return(FSStatusCode::OK))); ASSERT_FALSE(cleaner_->UpdateFsInfo()); ASSERT_TRUE(cleaner_->UpdateFsInfo()); @@ -354,8 +356,8 @@ TEST_F(RecycleCleanerTest, scan_recycle_test5) { dentry2.set_inodeid(2001); dentry2.set_txid(0); dentry2.set_type(FsFileType::TYPE_DIRECTORY); - partition_->CreateDentry(dentry1); - partition_->CreateDentry(dentry2); + partition_->CreateDentry(dentry1, false, 0, 0, 0); + partition_->CreateDentry(dentry2, false, 0, 0, 0); LOG(INFO) << "create dentry1 " << dentry1.ShortDebugString(); LOG(INFO) << "create dentry2 " << dentry2.ShortDebugString(); @@ -384,8 +386,10 @@ TEST_F(RecycleCleanerTest, scan_recycle_test6) { dentry2.set_inodeid(2001); dentry2.set_txid(0); dentry2.set_type(FsFileType::TYPE_DIRECTORY); - ASSERT_EQ(partition_->CreateDentry(dentry1), MetaStatusCode::OK); - ASSERT_EQ(partition_->CreateDentry(dentry2), MetaStatusCode::OK); + ASSERT_EQ(partition_->CreateDentry(dentry1, false, 0, 0, 0), + MetaStatusCode::OK); + ASSERT_EQ(partition_->CreateDentry(dentry2, false, 0, 0, 0), + MetaStatusCode::OK); LOG(INFO) << "create dentry1 " << dentry1.ShortDebugString(); LOG(INFO) << "create dentry2 " << dentry2.ShortDebugString(); diff --git a/curvefs/test/metaserver/recycle_manager_test.cpp b/curvefs/test/metaserver/recycle_manager_test.cpp index 51b64d491d..baeb4c88bb 100644 --- a/curvefs/test/metaserver/recycle_manager_test.cpp +++ b/curvefs/test/metaserver/recycle_manager_test.cpp @@ -172,7 +172,8 @@ TEST_F(RecycleManangeTest, test_empty_recycle) { dentry.set_parentinodeid(ROOTINODEID); dentry.set_type(FsFileType::TYPE_DIRECTORY); dentry.set_txid(0); - ASSERT_EQ(partition->CreateDentry(dentry), MetaStatusCode::OK); + ASSERT_EQ(partition->CreateDentry(dentry, false, 0, 0, 0), + MetaStatusCode::OK); // create recycle time dir InodeParam param; @@ -189,7 +190,8 @@ TEST_F(RecycleManangeTest, test_empty_recycle) { dentry1.set_inodeid(2001); dentry1.set_txid(0); dentry1.set_type(FsFileType::TYPE_DIRECTORY); - ASSERT_EQ(partition->CreateDentry(dentry1), MetaStatusCode::OK); + ASSERT_EQ(partition->CreateDentry(dentry1, false, 0, 0, 0), + MetaStatusCode::OK); // wait clean recycle sleep(3);