aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-12-06 16:36:51 +0300
committerilnaz <ilnaz@ydb.tech>2023-12-06 18:23:42 +0300
commit96cf7ea8d5a67a08b44e191579b12bc5a8e80c17 (patch)
tree6c98f0c910335f43391bdd16c41d6ce25c812cfc
parent4dde1022150361af0ed3878ece9a5b387bc380bc (diff)
downloadydb-96cf7ea8d5a67a08b44e191579b12bc5a8e80c17.tar.gz
Prepare -> EvictVDisks KIKIMR-20254
-rw-r--r--ydb/core/cms/cms.cpp34
-rw-r--r--ydb/core/cms/cms_impl.h2
-rw-r--r--ydb/core/cms/cms_tx_remove_permissions.cpp2
-rw-r--r--ydb/core/cms/cms_tx_remove_request.cpp2
-rw-r--r--ydb/core/cms/cms_tx_store_permissions.cpp6
-rw-r--r--ydb/core/cms/cms_ut.cpp24
-rw-r--r--ydb/core/cms/ut_helpers.h10
-rw-r--r--ydb/core/protos/cms.proto4
8 files changed, 42 insertions, 42 deletions
diff --git a/ydb/core/cms/cms.cpp b/ydb/core/cms/cms.cpp
index 8623a2f0981..12f543aa5cc 100644
--- a/ydb/core/cms/cms.cpp
+++ b/ydb/core/cms/cms.cpp
@@ -286,11 +286,11 @@ bool TCms::CheckPermissionRequest(const TPermissionRequest &request,
TStatus::UNKNOWN,
});
bool allowPartial = request.GetPartialPermissionAllowed();
- bool schedule = (request.GetSchedule() || request.GetPrepare()) && !request.GetDryRun();
+ bool schedule = (request.GetSchedule() || request.GetEvictVDisks()) && !request.GetDryRun();
- if (request.GetPrepare() && request.ActionsSize() > 1) {
+ if (request.GetEvictVDisks() && request.ActionsSize() > 1) {
response.MutableStatus()->SetCode(TStatus::WRONG_REQUEST);
- response.MutableStatus()->SetReason("Cannot prepare more than one action at once");
+ response.MutableStatus()->SetReason("Cannot perform several actions and evict vdisks");
return false;
}
@@ -299,7 +299,7 @@ bool TCms::CheckPermissionRequest(const TPermissionRequest &request,
scheduled.SetUser(request.GetUser());
scheduled.SetPartialPermissionAllowed(allowPartial);
scheduled.SetSchedule(request.GetSchedule());
- scheduled.SetPrepare(request.GetPrepare());
+ scheduled.SetEvictVDisks(request.GetEvictVDisks());
scheduled.SetReason(request.GetReason());
if (request.HasDuration())
scheduled.SetDuration(request.GetDuration());
@@ -340,9 +340,9 @@ bool TCms::CheckPermissionRequest(const TPermissionRequest &request,
LOG_DEBUG(ctx, NKikimrServices::CMS, "Checking action: %s", action.ShortDebugString().data());
- bool prepared = !request.GetPrepare();
+ bool prepared = !request.GetEvictVDisks();
if (!prepared) {
- prepared = CheckPrepareHost(action, error);
+ prepared = CheckEvictVDisks(action, error);
}
if (prepared && CheckAction(action, opts, error, ctx)) {
@@ -496,10 +496,10 @@ bool TCms::CheckAccess(const TString &token,
return false;
}
-bool TCms::CheckPrepareHost(const TAction &action, TErrorInfo &error) const {
+bool TCms::CheckEvictVDisks(const TAction &action, TErrorInfo &error) const {
if (!State->Sentinel) {
error.Code = TStatus::ERROR;
- error.Reason = "Cannot prepare host while Sentinel (self heal) is disabled";
+ error.Reason = "Unable to evict vdisks while Sentinel (self heal) is disabled";
return false;
}
@@ -510,14 +510,14 @@ bool TCms::CheckPrepareHost(const TAction &action, TErrorInfo &error) const {
break;
default:
error.Code = TStatus::WRONG_REQUEST;
- error.Reason = TStringBuilder() << "Cannot prepare host for action: " << action.GetType();
+ error.Reason = TStringBuilder() << "Unable to evict vdisks to perform action: " << action.GetType();
return false;
}
for (const auto node : ClusterInfo->HostNodes(action.GetHost())) {
if (!node->VDisks.empty()) {
error.Code = TStatus::DISALLOW_TEMP;
- error.Reason = TStringBuilder() << "Host " << action.GetHost() << " is not prepared yet";
+ error.Reason = TStringBuilder() << "VDisks eviction from host " << action.GetHost() << " has not yet been completed";
return false;
}
}
@@ -1347,10 +1347,10 @@ void TCms::RemoveRequest(TEvCms::TEvManageRequestRequest::TPtr &ev, const TActor
resp->Record.MutableStatus()->SetReason(Sprintf("Request %s doesn't belong to %s", id.data(), user.data()));
}
- if (request.Request.GetPrepare() && request.Request.ActionsSize() < 1) {
+ if (request.Request.GetEvictVDisks() && request.Request.ActionsSize() < 1) {
resp->Record.MutableStatus()->SetCode(TStatus::WRONG_REQUEST);
resp->Record.MutableStatus()->SetReason(
- Sprintf("Request %s used to prepare action and cannot be deleted while permission is valid", id.data()));
+ Sprintf("Request %s used to evict vdisks and cannot be deleted while permission is valid", id.data()));
}
}
@@ -1844,16 +1844,16 @@ void TCms::Handle(TEvCms::TEvPermissionRequest::TPtr &ev,
}
}
- if (rec.GetPrepare()) {
+ if (rec.GetEvictVDisks()) {
for (const auto &action : rec.GetActions()) {
if (State->HostMarkers.contains(action.GetHost())) {
return ReplyWithError<TEvCms::TEvPermissionResponse>(
- ev, TStatus::WRONG_REQUEST, TStringBuilder() << "Host '" << action.GetHost() << "' is preparing", ctx);
+ ev, TStatus::WRONG_REQUEST, TStringBuilder() << "VDisks of host '" << action.GetHost() << "' are being evicted", ctx);
}
for (const auto node : ClusterInfo->HostNodes(action.GetHost())) {
if (State->HostMarkers.contains(ToString(node->NodeId))) {
return ReplyWithError<TEvCms::TEvPermissionResponse>(
- ev, TStatus::WRONG_REQUEST, TStringBuilder() << "Node '" << node->NodeId << "' is preparing", ctx);
+ ev, TStatus::WRONG_REQUEST, TStringBuilder() << "VDisks of node '" << node->NodeId << "' are being evicted", ctx);
}
}
}
@@ -1869,7 +1869,7 @@ void TCms::Handle(TEvCms::TEvPermissionRequest::TPtr &ev,
resp->Record.SetRequestId(reqId);
TAutoPtr<TRequestInfo> copy;
- if (scheduled.Request.ActionsSize() || scheduled.Request.GetPrepare()) {
+ if (scheduled.Request.ActionsSize() || scheduled.Request.GetEvictVDisks()) {
scheduled.Owner = user;
scheduled.Order = State->NextRequestId - 1;
scheduled.RequestId = reqId;
@@ -1934,7 +1934,7 @@ void TCms::Handle(TEvCms::TEvCheckRequest::TPtr &ev, const TActorContext &ctx)
auto order = request.Order;
State->ScheduledRequests.erase(it);
- if (scheduled.Request.ActionsSize() || scheduled.Request.GetPrepare()) {
+ if (scheduled.Request.ActionsSize() || scheduled.Request.GetEvictVDisks()) {
scheduled.Owner = user;
scheduled.Order = order;
scheduled.RequestId = rec.GetRequestId();
diff --git a/ydb/core/cms/cms_impl.h b/ydb/core/cms/cms_impl.h
index 7bcced14e7a..3f588599edf 100644
--- a/ydb/core/cms/cms_impl.h
+++ b/ydb/core/cms/cms_impl.h
@@ -300,7 +300,7 @@ private:
NKikimrCms::TStatus::ECode &code,
TString &error,
const TActorContext &ctx);
- bool CheckPrepareHost(const NKikimrCms::TAction &action,
+ bool CheckEvictVDisks(const NKikimrCms::TAction &action,
TErrorInfo &error) const;
bool CheckAction(const NKikimrCms::TAction &action,
const TActionOptions &opts,
diff --git a/ydb/core/cms/cms_tx_remove_permissions.cpp b/ydb/core/cms/cms_tx_remove_permissions.cpp
index 14a6869b5a5..6d726d2db21 100644
--- a/ydb/core/cms/cms_tx_remove_permissions.cpp
+++ b/ydb/core/cms/cms_tx_remove_permissions.cpp
@@ -47,7 +47,7 @@ public:
<< ", reason# " << "permission " << id << " has expired");
}
- if (it->second.Request.GetPrepare()) {
+ if (it->second.Request.GetEvictVDisks()) {
auto ret = Self->ResetHostMarkers(host, txc, ctx);
std::move(ret.begin(), ret.end(), std::back_inserter(UpdateMarkers));
diff --git a/ydb/core/cms/cms_tx_remove_request.cpp b/ydb/core/cms/cms_tx_remove_request.cpp
index c2191eec84b..6bb149dbd4e 100644
--- a/ydb/core/cms/cms_tx_remove_request.cpp
+++ b/ydb/core/cms/cms_tx_remove_request.cpp
@@ -22,7 +22,7 @@ public:
auto it = Self->State->ScheduledRequests.find(Id);
if (it != Self->State->ScheduledRequests.end()) {
- if (it->second.Request.GetPrepare()) {
+ if (it->second.Request.GetEvictVDisks()) {
for (const auto &action : it->second.Request.GetActions()) {
auto ret = Self->ResetHostMarkers(action.GetHost(), txc, ctx);
std::move(ret.begin(), ret.end(), std::back_inserter(UpdateMarkers));
diff --git a/ydb/core/cms/cms_tx_store_permissions.cpp b/ydb/core/cms/cms_tx_store_permissions.cpp
index d0967340fdf..db625f2d143 100644
--- a/ydb/core/cms/cms_tx_store_permissions.cpp
+++ b/ydb/core/cms/cms_tx_store_permissions.cpp
@@ -70,7 +70,7 @@ public:
<< ", validity# " << TInstant::MicroSeconds(deadline)
<< ", action# " << actionStr);
- if (Scheduled && Scheduled->Request.GetPrepare()) {
+ if (Scheduled && Scheduled->Request.GetEvictVDisks()) {
auto ret = Self->SetHostMarker(permission.GetAction().GetHost(), NKikimrCms::MARKER_DISK_FAULTY, txc, ctx);
std::move(ret.begin(), ret.end(), std::back_inserter(UpdateMarkers));
}
@@ -80,7 +80,7 @@ public:
auto &id = Scheduled->RequestId;
auto &owner = Scheduled->Owner;
- if (Scheduled->Request.ActionsSize() || Scheduled->Request.GetPrepare()) {
+ if (Scheduled->Request.ActionsSize() || Scheduled->Request.GetEvictVDisks()) {
ui64 order = Scheduled->Order;
TString requestStr;
google::protobuf::TextFormat::PrintToString(Scheduled->Request, &requestStr);
@@ -96,7 +96,7 @@ public:
<< ", order# " << order
<< ", body# " << requestStr);
- if (Scheduled->Request.GetPrepare()) {
+ if (Scheduled->Request.GetEvictVDisks()) {
for (const auto &action : Scheduled->Request.GetActions()) {
auto ret = Self->SetHostMarker(action.GetHost(), NKikimrCms::MARKER_DISK_FAULTY, txc, ctx);
std::move(ret.begin(), ret.end(), std::back_inserter(UpdateMarkers));
diff --git a/ydb/core/cms/cms_ut.cpp b/ydb/core/cms/cms_ut.cpp
index 01253e002f1..66eb8210a1d 100644
--- a/ydb/core/cms/cms_ut.cpp
+++ b/ydb/core/cms/cms_ut.cpp
@@ -1685,33 +1685,33 @@ Y_UNIT_TEST_SUITE(TCmsTest) {
env.DestroyDefaultCmsPipe();
}
- Y_UNIT_TEST(PrepareHostShouldFailWhileSentinelIsDisabled)
+ Y_UNIT_TEST(VDisksEvictionShouldFailWhileSentinelIsDisabled)
{
TCmsTestEnv env(TTestEnvOpts(8).WithoutSentinel());
env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::SHUTDOWN_HOST, env.GetNodeId(0), 60000000)
),
TStatus::ERROR
);
}
- Y_UNIT_TEST(PrepareHostShouldFailOnUnsupportedAction)
+ Y_UNIT_TEST(VDisksEvictionShouldFailOnUnsupportedAction)
{
TCmsTestEnv env(TTestEnvOpts(8).WithSentinel());
env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::REPLACE_DEVICES, env.GetNodeId(0), 60000000, env.PDiskName(0))
),
TStatus::WRONG_REQUEST
);
}
- Y_UNIT_TEST(PrepareHostShouldFailOnMultipleActions)
+ Y_UNIT_TEST(VDisksEvictionShouldFailOnMultipleActions)
{
TCmsTestEnv env(TTestEnvOpts(8).WithSentinel());
env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::SHUTDOWN_HOST, env.GetNodeId(0), 60000000),
MakeAction(TAction::SHUTDOWN_HOST, env.GetNodeId(1), 60000000)
),
@@ -1719,7 +1719,7 @@ Y_UNIT_TEST_SUITE(TCmsTest) {
);
}
- Y_UNIT_TEST(PrepareHost)
+ Y_UNIT_TEST(VDisksEviction)
{
auto opts = TTestEnvOpts(8).WithSentinel();
TCmsTestEnv env(opts);
@@ -1727,14 +1727,14 @@ Y_UNIT_TEST_SUITE(TCmsTest) {
// ok
auto request1 = env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::RESTART_SERVICES, env.GetNodeId(0), 600000000, "storage")
),
TStatus::DISALLOW_TEMP
);
// forbid another prepare request for same host
env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::RESTART_SERVICES, env.GetNodeId(0), 600000000, "storage")
),
TStatus::WRONG_REQUEST
@@ -1753,7 +1753,7 @@ Y_UNIT_TEST_SUITE(TCmsTest) {
// allow immediately
auto request2 = env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::RESTART_SERVICES, env.GetNodeId(0), 600000000, "storage")
),
TStatus::ALLOW
@@ -1763,7 +1763,7 @@ Y_UNIT_TEST_SUITE(TCmsTest) {
// check markers after restart
env.RestartCms();
env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::RESTART_SERVICES, env.GetNodeId(0), 600000000, "storage")
),
TStatus::WRONG_REQUEST
@@ -1778,7 +1778,7 @@ Y_UNIT_TEST_SUITE(TCmsTest) {
// prepare
auto request3 = env.CheckPermissionRequest(
- MakePermissionRequest(TRequestOptions("user").WithPrepare(),
+ MakePermissionRequest(TRequestOptions("user").WithEvictVDisks(),
MakeAction(TAction::RESTART_SERVICES, env.GetNodeId(0), 600000000, "storage")
),
TStatus::DISALLOW_TEMP
diff --git a/ydb/core/cms/ut_helpers.h b/ydb/core/cms/ut_helpers.h
index 696e6726d4f..32e2d5898e4 100644
--- a/ydb/core/cms/ut_helpers.h
+++ b/ydb/core/cms/ut_helpers.h
@@ -72,22 +72,22 @@ struct TRequestOptions {
bool Partial;
bool DryRun;
bool Schedule;
- bool Prepare;
+ bool EvictVDisks;
explicit TRequestOptions(const TString &user, bool partial, bool dry, bool schedule)
: User(user)
, Partial(partial)
, DryRun(dry)
, Schedule(schedule)
- , Prepare(false)
+ , EvictVDisks(false)
{}
explicit TRequestOptions(const TString &user)
: TRequestOptions(user, false, false, false)
{}
- TRequestOptions& WithPrepare() {
- Prepare = true;
+ TRequestOptions& WithEvictVDisks() {
+ EvictVDisks = true;
return *this;
}
};
@@ -99,7 +99,7 @@ TAutoPtr<NCms::TEvCms::TEvPermissionRequest> MakePermissionRequest(const TReques
event->Record.SetPartialPermissionAllowed(opts.Partial);
event->Record.SetDryRun(opts.DryRun);
event->Record.SetSchedule(opts.Schedule);
- event->Record.SetPrepare(opts.Prepare);
+ event->Record.SetEvictVDisks(opts.EvictVDisks);
AddActions(event, actions...);
return event;
diff --git a/ydb/core/protos/cms.proto b/ydb/core/protos/cms.proto
index c84a2f366d3..e8d9160f333 100644
--- a/ydb/core/protos/cms.proto
+++ b/ydb/core/protos/cms.proto
@@ -161,8 +161,8 @@ message TPermissionRequest {
// Availability mode is not preserved for scheduled events.
optional EAvailabilityMode AvailabilityMode = 9 [default = MODE_MAX_AVAILABILITY];
optional string MaintenanceTaskId = 10;
- // Prepare item (host/device) before granting permission
- optional bool Prepare = 11 [default = false];
+ // Evit vdisks before granting permission
+ optional bool EvictVDisks = 11 [default = false];
}
enum EExtensionType {