Skip to content

Commit

Permalink
[feat]curvefs: change some conf on fly
Browse files Browse the repository at this point in the history
1. use gflag to change mds heartbeatMissTimeOutMs on fly
2. use gflag to change metaserver transh.expiredAfterSec on fly
3. use gflag to change metaserver transh.scanPeriodSec on fly
4. use gflag to change client fs.disableXattr on fly
5. set client s3.maxAsyncRequestInflightBytes default vale to 1GiB

Signed-off-by: Cyber-SiKu <Cyber-SiKu@outlook.com>
  • Loading branch information
Cyber-SiKu committed Oct 19, 2023
1 parent 5df3d6b commit 113aa40
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 21 deletions.
4 changes: 1 addition & 3 deletions curvefs/conf/client.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions curvefs/src/client/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions curvefs/src/client/fuse_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
21 changes: 20 additions & 1 deletion curvefs/src/mds/heartbeat/metaserver_healthy_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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. "
Expand Down
36 changes: 27 additions & 9 deletions curvefs/src/mds/heartbeat/metaserver_healthy_checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,25 @@
#ifndef CURVEFS_SRC_MDS_HEARTBEAT_METASERVER_HEALTHY_CHECKER_H_
#define CURVEFS_SRC_MDS_HEARTBEAT_METASERVER_HEALTHY_CHECKER_H_

#include <chrono> //NOLINT
#include <memory>
#include <gflags/gflags_declare.h>

#include <chrono> //NOLINT
#include <map>
#include "curvefs/src/mds/common/types.h"
#include <memory>

#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 {
Expand All @@ -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.
Expand Down Expand Up @@ -90,9 +108,9 @@ struct HeartbeatInfo {

class MetaserverHealthyChecker {
public:
MetaserverHealthyChecker(
HeartbeatOption option, const std::shared_ptr<Topology> &topo) :
option_(option), topo_(topo) {}
MetaserverHealthyChecker(const HeartbeatOption& option,
const std::shared_ptr<Topology>& topo)
: option_(option), topo_(topo) {}
~MetaserverHealthyChecker() {}

/**
Expand Down
15 changes: 13 additions & 2 deletions curvefs/src/metaserver/trash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<Configuration> 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) {
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions curvefs/src/metaserver/trash_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
namespace curvefs {
namespace metaserver {

DECLARE_uint32(trash_scanPeriodSec);

int TrashManager::Run() {
if (isStop_.exchange(false)) {
recycleThread_ =
Expand All @@ -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() {
Expand Down
5 changes: 4 additions & 1 deletion curvefs/test/client/filesystem/helper/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

namespace curvefs {
namespace client {
namespace common {
DECLARE_bool(fs_disableXattr);
}
namespace filesystem {

using ::curvefs::client::common::KernelCacheOption;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 113aa40

Please sign in to comment.