Skip to content

Commit

Permalink
fix retry policy and remove unused code
Browse files Browse the repository at this point in the history
Change-Id: I62b93ae8fae7a4f7430a475673ee0aa6cd826956
  • Loading branch information
wu-hanqing committed Mar 31, 2020
1 parent 7077387 commit e53eefe
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 23,075 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ bazel-testlogs

#log
*.log

.clang-format
5 changes: 0 additions & 5 deletions conf/client.conf
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,3 @@ global.logPath=/data/log/curve/
############### metric 配置信息 #############
#
global.metricDummyServerStartPort=9000

#
# session map文件,存储打开文件的filename到path的映射
#
global.sessionMapPath=./session_map.json
1 change: 0 additions & 1 deletion src/client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ cc_library(
"//external:leveldb",
"//external:brpc",
"//external:braft",
"//thirdparties/mordenjson:jsonmorden",
"//external:protobuf",
"//src/common:curve_common",
"//src/common:curve_auth",
Expand Down
5 changes: 4 additions & 1 deletion src/client/chunk_closure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ void ClientClosure::PreProcessBeforeRetry(int rpcstatus, int cntlstatus) {
bthread_usleep(nextsleeptime);
return;
} else if (rpcstatus == CHUNK_OP_STATUS::CHUNK_OP_STATUS_REDIRECTED) {
LOG(WARNING) << "leader redirect, retry directly, " << *reqCtx
auto nextsleeptime = failReqOpt_.chunkserverOPRetryIntervalUS / 10;
LOG(WARNING) << "leader redirect, sleep(us) = " << nextsleeptime
<< ", " << *reqCtx
<< ", retried times = " << reqDone->GetRetriedTimes()
<< ", IO id = " << reqDone->GetIOTracker()->GetID()
<< ", request id = " << reqCtx->id_
<< ", remote side = " << remoteAddress_;
bthread_usleep(nextsleeptime);
return;
}

Expand Down
4 changes: 0 additions & 4 deletions src/client/client_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ int ClientConfig::Init(const char* configpath) {
LOG_IF(ERROR, ret == false) << "config no mds.registerToMDS info";
RETURN_IF_FALSE(ret)

ret = conf_.GetStringValue("global.sessionMapPath",
&fileServiceOption_.sessionmapOpt.sessionmap_path);
LOG_IF(ERROR, ret == false) << "config no global.sessionMapPath info";

return 0;
}

Expand Down
10 changes: 0 additions & 10 deletions src/client/config_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,6 @@ typedef struct ClientConfigOption {
MetaServerOption_t metaServerOpt;
} ClientConfigOption_t;

/**
* session id file option
* session文件用于存储当前打开文件的session信息
* @sessionmap_path: session文件的路径
*/
typedef struct SessionIDMapOption {
std::string sessionmap_path;
} SessionIDMapOption_t;

/**
* FileServiceOption是QEMU侧总体配置信息
*/
Expand All @@ -291,7 +282,6 @@ typedef struct FileServiceOption {
LeaseOption_t leaseOpt;
CommonConfigOpt_t commonOpt;
MetaServerOption_t metaServerOpt;
SessionIDMapOption_t sessionmapOpt;
} FileServiceOption_t;

#endif // SRC_CLIENT_CONFIG_INFO_H_
1 change: 0 additions & 1 deletion src/client/file_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "src/client/iomanager4file.h"
#include "src/client/request_scheduler.h"
#include "src/client/request_sender_manager.h"
#include "src/client/session_map.h"

using curve::client::ClientConfig;
using curve::common::TimeUtility;
Expand Down
178 changes: 0 additions & 178 deletions src/client/session_map.cpp

This file was deleted.

80 changes: 0 additions & 80 deletions src/client/session_map.h

This file was deleted.

6 changes: 3 additions & 3 deletions src/client/timertask_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "src/common/timeutility.h"

using curve::common::TimeUtility;
typedef std::chrono::microseconds MicroSeconds;
typedef std::chrono::steady_clock SteadyClock;
typedef std::chrono::steady_clock::time_point TimePoint;
using MicroSeconds = std::chrono::microseconds;
using SteadyClock = std::chrono::steady_clock;
using TimePoint = SteadyClock::time_point;

namespace curve {
namespace client {
Expand Down
3 changes: 2 additions & 1 deletion test/client/client_mdsclient_metacache_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,8 @@ TEST_F(MDSClientTest, GetLeaderTest) {
ASSERT_EQ(0, mc.GetLeader(1234, 1234, &ckid, &leaderep, true));

// 从1,2获取leader, 但是controller返回错误, 所以会去mds获取新的server list
ASSERT_EQ(1, cliservice1.GetInvokeTimes() + cliservice2.GetInvokeTimes());
// get server list后继续从1,2上获取leader, 结果还是失败。总共重试3次
ASSERT_EQ(3, cliservice1.GetInvokeTimes() + cliservice2.GetInvokeTimes());
ASSERT_EQ(0, cliservice3.GetInvokeTimes());

// 因为从mds获取新的copyset信息了,所以其leader信息被重置了,需要重新获取新leader
Expand Down
14 changes: 14 additions & 0 deletions test/client/client_metric_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,20 @@ TEST(MetricTest, MetricHelperTest) {
ASSERT_NO_THROW(MetricHelper::IncremIOSuspendNum(&fm2));
ASSERT_NO_THROW(MetricHelper::DecremIOSuspendNum(&fm2));
ASSERT_NO_THROW(MetricHelper::LatencyRecord(&fm2, 0, OpType::READ));

ASSERT_NO_THROW(MetricHelper::IncremGetLeaderRetryTime(nullptr));
ASSERT_NO_THROW(MetricHelper::IncremUserQPSCount(nullptr, 0, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremUserEPSCount(nullptr, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremUserRPSCount(nullptr, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremFailRPCCount(nullptr, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremTimeOutRPCCount(nullptr, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremRPCQPSCount(nullptr, 0, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremRPCRPSCount(nullptr, OpType::READ));
ASSERT_NO_THROW(MetricHelper::LatencyRecord(nullptr, 0, OpType::READ));
ASSERT_NO_THROW(MetricHelper::IncremInflightRPC(nullptr));
ASSERT_NO_THROW(MetricHelper::DecremInflightRPC(nullptr));
ASSERT_NO_THROW(MetricHelper::IncremIOSuspendNum(nullptr));
ASSERT_NO_THROW(MetricHelper::DecremIOSuspendNum(nullptr));
}

} // namespace client
Expand Down
Loading

0 comments on commit e53eefe

Please sign in to comment.