diff --git a/curvefs/conf/client.conf b/curvefs/conf/client.conf index c66477926c..339a08a0d2 100644 --- a/curvefs/conf/client.conf +++ b/curvefs/conf/client.conf @@ -92,8 +92,6 @@ fuseClient.enableMultiMountPointRename=true fuseClient.enableSplice=false # thread number of listDentry when get summary xattr fuseClient.listDentryThreads=10 -# disable xattr on one mountpoint can fast 'ls -l' -fuseClient.disableXattr=false # default data(s3ChunkInfo/volumeExtent) size in inode, if exceed will eliminate and try to get the merged one fuseClient.maxDataSize=1024 # default refresh data interval 30s @@ -217,7 +215,7 @@ s3.logLevel=4 s3.logPrefix=/data/logs/curvefs/aws_ # __CURVEADM_TEMPLATE__ /curvefs/client/logs/aws_ __CURVEADM_TEMPLATE__ s3.asyncThreadNum=500 # limit all inflight async requests' bytes, |0| means not limited -s3.maxAsyncRequestInflightBytes=104857600 +s3.maxAsyncRequestInflightBytes=1073741824 s3.chunkFlushThreads=5 # throttle s3.throttle.iopsTotalLimit=0 diff --git a/curvefs/src/client/common/config.cpp b/curvefs/src/client/common/config.cpp index 10d64bea9a..0b987a2cac 100644 --- a/curvefs/src/client/common/config.cpp +++ b/curvefs/src/client/common/config.cpp @@ -39,6 +39,8 @@ namespace curvefs { namespace client { namespace common { DECLARE_bool(useFakeS3); +DEFINE_bool(fs_disableXattr, false, "disable xattr"); +DEFINE_validator(fs_disableXattr, [](const char*, bool value) { return true; }); } // namespace common } // namespace client } // namespace curvefs @@ -303,6 +305,7 @@ void InitFileSystemOption(Configuration* c, FileSystemOption* option) { c->GetValueFatalIfFail("fs.cto", &option->cto); c->GetValueFatalIfFail("fs.cto", &FLAGS_enableCto); c->GetValueFatalIfFail("fs.disableXattr", &option->disableXattr); + FLAGS_fs_disableXattr = option->disableXattr; c->GetValueFatalIfFail("fs.maxNameLength", &option->maxNameLength); c->GetValueFatalIfFail("fs.accessLogging", &FLAGS_access_logging); { // kernel cache option diff --git a/curvefs/src/client/fuse_client.cpp b/curvefs/src/client/fuse_client.cpp index 3dfea2b7c4..0fe8d192da 100644 --- a/curvefs/src/client/fuse_client.cpp +++ b/curvefs/src/client/fuse_client.cpp @@ -88,6 +88,7 @@ DECLARE_uint64(fuseClientBurstReadIopsSecs); DECLARE_uint64(fuseClientAvgReadBytes); DECLARE_uint64(fuseClientBurstReadBytes); DECLARE_uint64(fuseClientBurstReadBytesSecs); +DECLARE_bool(fs_disableXattr); } // namespace common } // namespace client } // namespace curvefs @@ -1043,8 +1044,8 @@ CURVEFS_ERROR FuseClient::FuseOpGetXattr(fuse_req_t req, fuse_ino_t ino, (void)req; VLOG(9) << "FuseOpGetXattr, ino: " << ino << ", name: " << name << ", size = " << size; - if (option_.fileSystemOption.disableXattr) { - return CURVEFS_ERROR::NOSYS; + if (common::FLAGS_fs_disableXattr) { + return CURVEFS_ERROR::NODATA; } InodeAttr inodeAttr; diff --git a/curvefs/src/mds/heartbeat/metaserver_healthy_checker.cpp b/curvefs/src/mds/heartbeat/metaserver_healthy_checker.cpp index 228fba18c8..eb7cd75cba 100644 --- a/curvefs/src/mds/heartbeat/metaserver_healthy_checker.cpp +++ b/curvefs/src/mds/heartbeat/metaserver_healthy_checker.cpp @@ -30,6 +30,24 @@ using ::curvefs::mds::topology::TopoStatusCode; using ::curve::common::WriteLockGuard; using std::chrono::milliseconds; +// the maximun peroid that heartbeat is missed without +// setting the metaserver to offline status and alarm. +// scheduling will depend on this status of metaserver +DEFINE_uint64(heartbeat_offlineTimeoutMs, 1800000, + "the maximun peroid that heartbeat is missed without setting the " + "metaserver to offline status and alarm."); + +// network jitter is unavoidable, and for this reason +// background process will alarm during the inspection once it +// finds out that heartbeat is missed after heartbeatMissTimeOut peroid +DEFINE_uint64( + heartbeat_missTimeoutMs, 30000, + "background process will alarm during the inspection once it finds out " + "that heartbeat is missed after heartbeatMissTimeOut peroid"); +DEFINE_validator(heartbeat_offlineTimeoutMs, [](const char*, uint64_t value) { + return value >= FLAGS_heartbeat_missTimeoutMs; +}); + namespace curvefs { namespace mds { namespace heartbeat { @@ -68,7 +86,8 @@ bool MetaserverHealthyChecker::MetaServerStateNeedUpdate( return false; } - bool shouldUnstable = (timePass < milliseconds(option_.offLineTimeOutMs)); + bool shouldUnstable = + (timePass < milliseconds(FLAGS_heartbeat_offlineTimeoutMs)); if (shouldUnstable) { if (OnlineState::UNSTABLE != info.state) { LOG(WARNING) << "metaserver " << info.msId << " is unstable. " diff --git a/curvefs/src/mds/heartbeat/metaserver_healthy_checker.h b/curvefs/src/mds/heartbeat/metaserver_healthy_checker.h index d1428d7989..e1404342c4 100644 --- a/curvefs/src/mds/heartbeat/metaserver_healthy_checker.h +++ b/curvefs/src/mds/heartbeat/metaserver_healthy_checker.h @@ -23,19 +23,25 @@ #ifndef CURVEFS_SRC_MDS_HEARTBEAT_METASERVER_HEALTHY_CHECKER_H_ #define CURVEFS_SRC_MDS_HEARTBEAT_METASERVER_HEALTHY_CHECKER_H_ -#include //NOLINT -#include +#include + +#include //NOLINT #include -#include "curvefs/src/mds/common/types.h" +#include + +#include "curvefs/proto/topology.pb.h" #include "curvefs/src/mds/common/mds_define.h" +#include "curvefs/src/mds/common/types.h" #include "curvefs/src/mds/topology/topology.h" -#include "curvefs/proto/topology.pb.h" using ::std::chrono::steady_clock; using ::curvefs::mds::topology::MetaServerIdType; using ::curvefs::mds::topology::Topology; using ::curvefs::mds::topology::OnlineState; +DECLARE_uint64(heartbeat_offlineTimeoutMs); +DECLARE_uint64(heartbeat_missTimeoutMs); + namespace curvefs { namespace mds { namespace heartbeat { @@ -45,8 +51,20 @@ struct HeartbeatOption { uint64_t heartbeatMissTimeout, uint64_t offLineTimeout) { this->heartbeatIntervalMs = heartbeatInterval; - this->heartbeatMissTimeOutMs = heartbeatMissTimeout; - this->offLineTimeOutMs = offLineTimeout; + FLAGS_heartbeat_missTimeoutMs = this->heartbeatMissTimeOutMs = + heartbeatMissTimeout; + FLAGS_heartbeat_offlineTimeoutMs = this->offLineTimeOutMs = + offLineTimeout; + } + + explicit HeartbeatOption(const HeartbeatOption& option) + : heartbeatIntervalMs(option.heartbeatIntervalMs), + heartbeatMissTimeOutMs(option.heartbeatMissTimeOutMs), + offLineTimeOutMs(option.offLineTimeOutMs), + cleanFollowerAfterMs(option.cleanFollowerAfterMs), + mdsStartTime(option.mdsStartTime) { + FLAGS_heartbeat_offlineTimeoutMs = offLineTimeOutMs; + FLAGS_heartbeat_missTimeoutMs = heartbeatMissTimeOutMs; } // heartbeatIntervalMs: normal heartbeat interval. @@ -90,9 +108,9 @@ struct HeartbeatInfo { class MetaserverHealthyChecker { public: - MetaserverHealthyChecker( - HeartbeatOption option, const std::shared_ptr &topo) : - option_(option), topo_(topo) {} + MetaserverHealthyChecker(const HeartbeatOption& option, + const std::shared_ptr& topo) + : option_(option), topo_(topo) {} ~MetaserverHealthyChecker() {} /** diff --git a/curvefs/src/metaserver/trash.cpp b/curvefs/src/metaserver/trash.cpp index db44dea151..1175376e72 100644 --- a/curvefs/src/metaserver/trash.cpp +++ b/curvefs/src/metaserver/trash.cpp @@ -21,8 +21,10 @@ */ #include "curvefs/src/metaserver/trash.h" -#include "src/common/timeutility.h" + #include "curvefs/proto/mds.pb.h" +#include "curvefs/src/metaserver/inode_storage.h" +#include "src/common/timeutility.h" using ::curve::common::TimeUtility; @@ -32,9 +34,18 @@ namespace metaserver { using ::curvefs::mds::FsInfo; using ::curvefs::mds::FSStatusCode; +bool pass_uint32(const char*, uint32_t value) { return true; } +DEFINE_uint32(trash_expiredAfterSec, 604800, + "time to delete data in the recycle bin"); +DEFINE_uint32(trash_scanPeriodSec, 600, "recycle bin scan interval"); +DEFINE_validator(trash_expiredAfterSec, pass_uint32); +DEFINE_validator(trash_scanPeriodSec, pass_uint32); + void TrashOption::InitTrashOptionFromConf(std::shared_ptr conf) { conf->GetValueFatalIfFail("trash.scanPeriodSec", &scanPeriodSec); + FLAGS_trash_scanPeriodSec = scanPeriodSec; conf->GetValueFatalIfFail("trash.expiredAfterSec", &expiredAfterSec); + FLAGS_trash_expiredAfterSec = expiredAfterSec; } void TrashImpl::Init(const TrashOption &option) { @@ -129,7 +140,7 @@ bool TrashImpl::NeedDelete(const TrashItem &item) { // if fs recycleTimeHour is not 0, return true uint64_t recycleTimeHour = GetFsRecycleTimeHour(item.fsId); if (recycleTimeHour == 0) { - return ((now - item.dtime) >= options_.expiredAfterSec); + return ((now - item.dtime) >= FLAGS_trash_expiredAfterSec); } else { return true; } diff --git a/curvefs/src/metaserver/trash_manager.cpp b/curvefs/src/metaserver/trash_manager.cpp index 936f820218..7f6341db1c 100644 --- a/curvefs/src/metaserver/trash_manager.cpp +++ b/curvefs/src/metaserver/trash_manager.cpp @@ -27,6 +27,8 @@ namespace curvefs { namespace metaserver { +DECLARE_uint32(trash_scanPeriodSec); + int TrashManager::Run() { if (isStop_.exchange(false)) { recycleThread_ = @@ -48,9 +50,9 @@ void TrashManager::Fini() { } void TrashManager::ScanLoop() { - while (sleeper_.wait_for(std::chrono::seconds(options_.scanPeriodSec))) { - ScanEveryTrash(); - } + while (sleeper_.wait_for(std::chrono::seconds(FLAGS_trash_scanPeriodSec))) { + ScanEveryTrash(); + } } void TrashManager::ScanEveryTrash() { diff --git a/curvefs/test/client/filesystem/helper/builder.h b/curvefs/test/client/filesystem/helper/builder.h index dc7c196adb..56c4b70874 100644 --- a/curvefs/test/client/filesystem/helper/builder.h +++ b/curvefs/test/client/filesystem/helper/builder.h @@ -37,6 +37,9 @@ namespace curvefs { namespace client { +namespace common { +DECLARE_bool(fs_disableXattr); +} namespace filesystem { using ::curvefs::client::common::KernelCacheOption; @@ -197,7 +200,7 @@ class FileSystemBuilder { }; option.cto = true; - option.disableXattr = true; + common::FLAGS_fs_disableXattr = option.disableXattr = true; option.maxNameLength = 255; option.blockSize = 0x10000u; option.kernelCacheOption = kernelCacheOption;