Skip to content

Commit

Permalink
Revert "mds/chunkserver: add scan feature framework code"
Browse files Browse the repository at this point in the history
This reverts commit 4dc896b.
  • Loading branch information
xu-chaojie authored and YunhuiChen committed Jun 2, 2021
1 parent 92148fa commit 1d83318
Show file tree
Hide file tree
Showing 32 changed files with 21 additions and 938 deletions.
11 changes: 0 additions & 11 deletions proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,3 @@ proto_library(
srcs = ["schedule.proto"],
)

cc_proto_library(
name = "scan_cc_proto",
visibility = ["//visibility:public"],
deps = [":scan_proto"],
)

proto_library(
name = "scan_proto",
srcs = ["scan.proto"],
)

3 changes: 1 addition & 2 deletions proto/chunk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ enum CHUNK_OP_TYPE {
CHUNK_OP_CREATE_CLONE = 5; // 创建clone chunk
CHUNK_OP_RECOVER = 6; // 恢复clone chunk
CHUNK_OP_PASTE = 7; // paste chunk 内部请求
CHUNK_OP_SCAN = 8; // scan oprequest
CHUNK_OP_UNKNOWN = 9; // 未知 Op
CHUNK_OP_UNKNOWN = 8; // 未知 Op
};

// read/write 的实际数据在 rpc 的 attachment 中
Expand Down
4 changes: 0 additions & 4 deletions proto/heartbeat.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ enum ConfigChangeType {
NONE = 4;
// 配置变更命令:change复制组一个成员
CHANGE_PEER = 5;
// Scan operator, scan chunks in copyset
START_SCAN_PEER = 6;
CANCEL_SCAN_PEER = 7;
};

message CopySetConf {
Expand All @@ -125,7 +122,6 @@ message CopySetConf {
// configchangeItem 是目标节点
// 对于TRANSFER_LEADER: 表示目标节点; 对于ADD_PEER: 表示待加入节点
// 对于REMOVE_PEER: 表示待删除节点; 对于CHANGE_PEER: 表示待加入节点
// SCAN_PEER: to scan the node
optional common.Peer configchangeItem = 6;
// oldPeer, 这个只在ConfigChangeType=对于CHANGE_PEER的情况下会赋值,
// 表示待删除节点。
Expand Down
42 changes: 0 additions & 42 deletions proto/scan.proto

This file was deleted.

11 changes: 1 addition & 10 deletions proto/schedule.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,7 @@ message QueryChunkServerRecoverStatusResponse {
map<uint32, bool> recoverStatusMap = 2;
}

message CancelScanScheduleRequest {
required uint32 logicalPoolID = 1;
}

message CancelScanScheduleResponse {
required sint32 statusCode = 1;
}

service ScheduleService {
rpc RapidLeaderSchedule(RapidLeaderScheduleRequst) returns (RapidLeaderScheduleResponse);
rpc QueryChunkServerRecoverStatus(QueryChunkServerRecoverStatusRequest) returns (QueryChunkServerRecoverStatusResponse);
rpc CancelScanSchedule(CancelScanScheduleRequest) returns (CancelScanScheduleResponse);
}
}
2 changes: 0 additions & 2 deletions src/chunkserver/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ cc_library(
"//src/fs:lfs",
"//src/client:curve_client",
"//include/client:include_client",
"//proto:scan_cc_proto",
],
)

Expand Down Expand Up @@ -118,7 +117,6 @@ cc_library(
"//src/common:curve_s3_adapter",
"//src/fs:lfs",
"//src/client:curve_client",
"//proto:scan_cc_proto",
],
)

Expand Down
3 changes: 1 addition & 2 deletions src/chunkserver/copyset_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ void CopysetNode::on_apply(::braft::Iterator &iter) {
*/
ChunkRequest request;
butil::IOBuf data;
auto opReq = ChunkOpRequest::Decode(log, &request, &data,
iter.index(), GetLeaderId());
auto opReq = ChunkOpRequest::Decode(log, &request, &data);
auto chunkId = request.chunkid();
auto task = std::bind(&ChunkOpRequest::OnApplyFromLog,
opReq,
Expand Down
4 changes: 0 additions & 4 deletions src/chunkserver/datastore/chunkserver_datastore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,5 @@ CSErrorCode CSDataStore::loadChunkFile(ChunkID id) {
return CSErrorCode::Success;
}

ChunkMap CSDataStore::GetChunkMap() {
return metaCache_.GetMap();
}

} // namespace chunkserver
} // namespace curve
2 changes: 0 additions & 2 deletions src/chunkserver/datastore/chunkserver_datastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ class CSDataStore {
*/
virtual DataStoreStatus GetStatus();

virtual ChunkMap GetChunkMap();

private:
CSErrorCode loadChunkFile(ChunkID id);
CSErrorCode CreateChunkFile(const ChunkOptions & ops,
Expand Down
41 changes: 0 additions & 41 deletions src/chunkserver/heartbeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,47 +488,6 @@ int Heartbeat::ExecTask(const HeartbeatResponse& response) {
}
break;

case curve::mds::heartbeat::START_SCAN_PEER:
{
ConfigChangeType type;
Configuration confTemp;
Peer peer;
LogicPoolID poolId = conf.logicalpoolid();
CopysetID copysetId = conf.copysetid();
int ret = 0;
// if copyset happen conf change, can't scan and wait retry
if (ret = copyset->GetConfChange(&type,
&confTemp, &peer) != 0) {
LOG(ERROR) << "Failed to get config change state of copyset"
<< ToGroupIdStr(poolId, copysetId);
return ret;
} else if (type == curve::mds::heartbeat::NONE) {
LOG(INFO) << "Scan peer "
<< conf.configchangeitem().address()
<< "to copyset "
<< ToGroupIdStr(poolId, copysetId);
if (!scanMan_->IsRepeatReq(poolId, copysetId)) {
scanMan_->Enqueue(poolId, copysetId);
} else {
LOG(INFO) << "Scan peer repeat request";
}
} else {
LOG(INFO) << "drop Scan peer, "
<<"because exist config change, ConfigChangeType:" << type;
}
}
break;

case curve::mds::heartbeat::CANCEL_SCAN_PEER:
{
// todo Abnormal scenario
int ret;
LogicPoolID poolId = conf.logicalpoolid();
CopysetID copysetId = conf.copysetid();
ret = scanMan_->CancelScanJob(poolId, copysetId);
}
break;

default:
LOG(ERROR) << "Invalid configchange type: " << conf.type();
break;
Expand Down
4 changes: 1 addition & 3 deletions src/chunkserver/heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "src/chunkserver/copyset_node_manager.h"
#include "src/common/wait_interval.h"
#include "src/common/concurrent/concurrent.h"
#include "src/chunkserver/scan_manager.h"
#include "proto/heartbeat.pb.h"

using ::curve::common::Thread;
Expand Down Expand Up @@ -187,11 +186,10 @@ class Heartbeat {

// 模块初始化时间, unix时间
uint64_t startUpTime_;

ScanManager *scanMan_;
};

} // namespace chunkserver
} // namespace curve

#endif // SRC_CHUNKSERVER_HEARTBEAT_H_

42 changes: 1 addition & 41 deletions src/chunkserver/op_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ int ChunkOpRequest::Encode(const ChunkRequest *request,

std::shared_ptr<ChunkOpRequest> ChunkOpRequest::Decode(butil::IOBuf log,
ChunkRequest *request,
butil::IOBuf *data,
uint64_t index,
PeerId GetLeaderId) {
butil::IOBuf *data) {
uint32_t metaSize = 0;
log.cutn(&metaSize, sizeof(uint32_t));
metaSize = butil::NetToHost32(metaSize);
Expand Down Expand Up @@ -169,8 +167,6 @@ std::shared_ptr<ChunkOpRequest> ChunkOpRequest::Decode(butil::IOBuf log,
return std::make_shared<PasteChunkInternalRequest>();
case CHUNK_OP_TYPE::CHUNK_OP_CREATE_CLONE:
return std::make_shared<CreateCloneChunkRequest>();
case CHUNK_OP_TYPE::CHUNK_OP_SCAN:
return std::make_shared<ScanChunkRequest>(index, GetLeaderId);
default:LOG(ERROR) << "Unknown chunk op";
return nullptr;
}
Expand Down Expand Up @@ -869,41 +865,5 @@ void PasteChunkInternalRequest::OnApplyFromLog(std::shared_ptr<CSDataStore> data
}
}

void ScanChunkRequest::OnApply(uint64_t index,
::google::protobuf::Closure *done) {
scanManager_->SetScanJobType(ScanType::BuildMap);
scanManager_->GenScanJob();
}

void ScanChunkRequest::OnApplyFromLog(std::shared_ptr<CSDataStore> datastore, //NOLINT
const ChunkRequest &request,
const butil::IOBuf &data) {
char *readBuffer = nullptr;
size_t size = request.size();
readBuffer = new(std::nothrow)char[size];
CHECK(nullptr != readBuffer)
<< "new readBuffer failed " << strerror(errno);

auto ret = datastore->ReadChunk(request.chunkid(),
request.sn(),
readBuffer,
request.offset(),
size);

BuildRepScanMap(request.logicpoolid(), request.chunkid(), index_,
request.offset(), request.size(), readBuffer);
SendScanMapToLeader();
return;
}

void ScanChunkRequest::BuildRepScanMap(LogicPoolID pollId, ChunkID chunkId,
uint64_t index, uint64_t offset,
uint64_t len, char* readBuf) {
return;
}

void ScanChunkRequest::SendScanMapToLeader() {
return;
}
} // namespace chunkserver
} // namespace curve
36 changes: 1 addition & 35 deletions src/chunkserver/op_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "include/chunkserver/chunkserver_common.h"
#include "src/chunkserver/concurrent_apply/concurrent_apply.h"
#include "src/chunkserver/datastore/define.h"
#include "src/chunkserver/scan_manager.h"

using ::google::protobuf::RpcController;
using ::curve::chunkserver::concurrent::ConcurrentApplyModule;
Expand Down Expand Up @@ -151,9 +150,7 @@ class ChunkOpRequest : public std::enable_shared_from_this<ChunkOpRequest> {
*/
static std::shared_ptr<ChunkOpRequest> Decode(butil::IOBuf log,
ChunkRequest *request,
butil::IOBuf *data,
uint64_t index,
PeerId GetLeaderId);
butil::IOBuf *data);

protected:
/**
Expand Down Expand Up @@ -360,37 +357,6 @@ class PasteChunkInternalRequest : public ChunkOpRequest {
butil::IOBuf data_;
};

class ScanChunkRequest : public ChunkOpRequest {
public:
ScanChunkRequest(uint64_t index, PeerId peer) :
ChunkOpRequest(), index_(index), peer_(peer) {}
ScanChunkRequest(std::shared_ptr<CopysetNode> nodePtr,
ScanManager* scanManager,
const ChunkRequest *request,
ChunkResponse *response,
::google::protobuf::Closure *done) :
ChunkOpRequest(nodePtr,
NULL,
request,
response,
done),
scanManager_(scanManager) {}
virtual ~ScanChunkRequest() = default;

void OnApply(uint64_t index, ::google::protobuf::Closure *done) override;
void OnApplyFromLog(std::shared_ptr<CSDataStore> datastore,
const ChunkRequest &request,
const butil::IOBuf &data) override;

private:
void BuildRepScanMap(LogicPoolID pollId, ChunkID chunkId, uint64_t index,
uint64_t offset, uint64_t len, char* readBuf);
void SendScanMapToLeader();
ScanManager* scanManager_;
uint64_t index_;
PeerId peer_;
};

} // namespace chunkserver
} // namespace curve

Expand Down
Loading

0 comments on commit 1d83318

Please sign in to comment.