Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
support balance data reset plan (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
critical27 authored Dec 24, 2020
1 parent 63c6aa3 commit 76def26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/common/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2469,14 +2469,18 @@ MetaClient::getUserRoles(std::string account) {


folly::Future<StatusOr<int64_t>> MetaClient::balance(std::vector<HostAddr> hostDel,
bool isStop) {
bool isStop,
bool isReset) {
cpp2::BalanceReq req;
if (!hostDel.empty()) {
req.set_host_del(std::move(hostDel));
}
if (isStop) {
req.set_stop(isStop);
}
if (isReset) {
req.set_reset(isReset);
}

folly::Promise<StatusOr<int64_t>> promise;
auto future = promise.getFuture();
Expand Down
2 changes: 1 addition & 1 deletion src/common/clients/meta/MetaClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ class MetaClient {

// Operations for admin
folly::Future<StatusOr<int64_t>>
balance(std::vector<HostAddr> hostDel, bool isStop = false);
balance(std::vector<HostAddr> hostDel, bool isStop, bool isReset);

folly::Future<StatusOr<std::vector<cpp2::BalanceTask>>>
showBalance(int64_t balanceId);
Expand Down
2 changes: 2 additions & 0 deletions src/common/interface/meta.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum ErrorCode {
E_NO_RUNNING_BALANCE_PLAN = -36,
E_NO_VALID_HOST = -37,
E_CORRUPTTED_BALANCE_PLAN = -38,
E_NO_INVALID_BALANCE_PLAN = -39,

// Authentication Failure
E_INVALID_PASSWORD = -41,
Expand Down Expand Up @@ -755,6 +756,7 @@ struct BalanceReq {
2: optional i64 id,
3: optional list<common.HostAddr> host_del,
4: optional bool stop,
5: optional bool reset,
}

enum TaskResult {
Expand Down

0 comments on commit 76def26

Please sign in to comment.