aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSemyon Danilov <senya@ydb.tech>2025-01-02 17:14:43 +0400
committerGitHub <noreply@github.com>2025-01-02 17:14:43 +0400
commit2490271b33a0fb3fb3bc57c4411827f3d00b58ea (patch)
tree975ac43b7d36f1ee0992db22a1a97349c804b35c
parentd0c941eff7407b04b24b4368ceeed2d328bbe580 (diff)
downloadydb-2490271b33a0fb3fb3bc57c4411827f3d00b58ea.tar.gz
Add option to restart PDisk without any checks (#13149)
-rw-r--r--ydb/core/blobstorage/base/blobstorage_events.h4
-rw-r--r--ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp2
-rw-r--r--ydb/core/blobstorage/nodewarden/node_warden_impl.cpp2
-rw-r--r--ydb/core/blobstorage/nodewarden/node_warden_impl.h2
-rw-r--r--ydb/core/blobstorage/nodewarden/node_warden_pdisk.cpp13
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp6
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_http.cpp58
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp2
8 files changed, 74 insertions, 15 deletions
diff --git a/ydb/core/blobstorage/base/blobstorage_events.h b/ydb/core/blobstorage/base/blobstorage_events.h
index 78c2f633f9..c7da3105d4 100644
--- a/ydb/core/blobstorage/base/blobstorage_events.h
+++ b/ydb/core/blobstorage/base/blobstorage_events.h
@@ -380,9 +380,11 @@ namespace NKikimr {
struct TEvBlobStorage::TEvAskWardenRestartPDisk : TEventLocal<TEvAskWardenRestartPDisk, EvAskWardenRestartPDisk> {
const ui32 PDiskId;
+ const bool IgnoreChecks;
- TEvAskWardenRestartPDisk(const ui32& pdiskId)
+ TEvAskWardenRestartPDisk(const ui32 pdiskId, const bool ignoreChecks)
: PDiskId(pdiskId)
+ , IgnoreChecks(ignoreChecks)
{}
};
diff --git a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
index dc66563311..d607d2dd73 100644
--- a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
+++ b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
@@ -898,7 +898,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageWardenTest) {
runtime.RegisterService(pdiskServiceId, pdiskActorId);
- runtime.Send(new IEventHandle(nodeWarden, pdiskActorId, new TEvBlobStorage::TEvAskWardenRestartPDisk(pdiskId), 0, cookie), nodeId);
+ runtime.Send(new IEventHandle(nodeWarden, pdiskActorId, new TEvBlobStorage::TEvAskWardenRestartPDisk(pdiskId, false), 0, cookie), nodeId);
auto responseEvent = new TEvBlobStorage::TEvControllerConfigResponse();
diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
index 975c7b4aa0..2b38b422fe 100644
--- a/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
+++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.cpp
@@ -723,7 +723,7 @@ void TNodeWarden::Handle(TEvBlobStorage::TEvAskWardenRestartPDisk::TPtr ev) {
PDiskRestartRequests[requestCookie] = pdiskId;
- AskBSCToRestartPDisk(pdiskId, requestCookie);
+ AskBSCToRestartPDisk(pdiskId, ev->Get()->IgnoreChecks, requestCookie);
}
void TNodeWarden::Handle(TEvBlobStorage::TEvNotifyWardenPDiskRestarted::TPtr ev) {
diff --git a/ydb/core/blobstorage/nodewarden/node_warden_impl.h b/ydb/core/blobstorage/nodewarden/node_warden_impl.h
index 6a07faac3c..092479760b 100644
--- a/ydb/core/blobstorage/nodewarden/node_warden_impl.h
+++ b/ydb/core/blobstorage/nodewarden/node_warden_impl.h
@@ -221,7 +221,7 @@ namespace NKikimr::NStorage {
TIntrusivePtr<TPDiskConfig> CreatePDiskConfig(const NKikimrBlobStorage::TNodeWardenServiceSet::TPDisk& pdisk);
void StartLocalPDisk(const NKikimrBlobStorage::TNodeWardenServiceSet::TPDisk& pdisk, bool temporary);
- void AskBSCToRestartPDisk(ui32 pdiskId, ui64 requestCookie);
+ void AskBSCToRestartPDisk(ui32 pdiskId, bool ignoreDegradedGroups, ui64 requestCookie);
void OnPDiskRestartFinished(ui32 pdiskId, NKikimrProto::EReplyStatus status);
void DestroyLocalPDisk(ui32 pdiskId);
diff --git a/ydb/core/blobstorage/nodewarden/node_warden_pdisk.cpp b/ydb/core/blobstorage/nodewarden/node_warden_pdisk.cpp
index 0102f70dc5..5ab2900a24 100644
--- a/ydb/core/blobstorage/nodewarden/node_warden_pdisk.cpp
+++ b/ydb/core/blobstorage/nodewarden/node_warden_pdisk.cpp
@@ -261,10 +261,19 @@ namespace NKikimr::NStorage {
SendToController(std::move(report));
}
- void TNodeWarden::AskBSCToRestartPDisk(ui32 pdiskId, ui64 requestCookie) {
+ void TNodeWarden::AskBSCToRestartPDisk(ui32 pdiskId, bool ignoreDegradedGroups, ui64 requestCookie) {
auto ev = std::make_unique<TEvBlobStorage::TEvControllerConfigRequest>();
- NKikimrBlobStorage::TRestartPDisk* cmd = ev->Record.MutableRequest()->AddCommand()->MutableRestartPDisk();
+ NKikimrBlobStorage::TConfigRequest* request = ev->Record.MutableRequest();
+
+ NKikimrBlobStorage::TRestartPDisk* cmd = request->AddCommand()->MutableRestartPDisk();
+
+ if (ignoreDegradedGroups) {
+ request->SetIgnoreGroupFailModelChecks(true);
+ request->SetIgnoreDegradedGroupsChecks(true);
+ request->SetIgnoreDisintegratedGroupsChecks(true);
+ request->SetIgnoreGroupSanityChecks(true);
+ }
auto targetPDiskId = cmd->MutableTargetPDiskId();
targetPDiskId->SetNodeId(LocalNodeId);
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
index 932117716b..53f26c1e72 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
@@ -1223,10 +1223,12 @@ public:
}
}
if (cgi.Has("restartPDisk")) {
+ bool ignoreChecks = "true" == cgi.Get("ignoreChecks");
+
ui32 cookieIdxPart = NextRestartRequestCookie++;
- ui64 fullCookie = (((ui64) PCtx->PDiskId) << 32) | cookieIdxPart; // This way cookie will be unique no matter the disk.
+ ui64 fullCookie = (((ui64) PCtx->PDiskId) << 32) | cookieIdxPart; // This way cookie will be unique regardless of the disk.
- Send(NodeWardenServiceId, new TEvBlobStorage::TEvAskWardenRestartPDisk(PCtx->PDiskId), fullCookie);
+ Send(NodeWardenServiceId, new TEvBlobStorage::TEvAskWardenRestartPDisk(PCtx->PDiskId, ignoreChecks), fullCookie);
// Send responce later when restart command will be received.
PendingRestartResponse = [this, actor = ev->Sender] (bool restartAllowed, TString& details) {
TStringStream jsonBuilder;
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_http.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_http.cpp
index edf805e725..7128748f62 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_http.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_http.cpp
@@ -111,13 +111,32 @@ void TPDisk::RenderState(IOutputStream &str, THttpInfo &httpInfo) {
}
}
+ function toggleButtonColor() {
+ var checkbox = document.getElementById("ignoreChecks");
+ var okButton = document.getElementById("restartOkButton");
+
+ if (checkbox.checked) {
+ okButton.classList.remove("btn-primary");
+ okButton.classList.add("btn-danger");
+ } else {
+ okButton.classList.remove("btn-danger");
+ okButton.classList.add("btn-primary");
+ }
+ }
+
function sendRestartRequest() {
+ let ignoreChecks = document.getElementById("ignoreChecks").checked;
+ let requestData = "restartPDisk=";
+ if (ignoreChecks) {
+ requestData += "&ignoreChecks=true";
+ }
$.ajax({
url: "",
- data: "restartPDisk=",
+ data: requestData,
method: "POST",
success: reloadPage
});
+ $('#restartModal').modal('hide');
}
function sendStopRequest() {
@@ -130,11 +149,38 @@ void TPDisk::RenderState(IOutputStream &str, THttpInfo &httpInfo) {
}
</script>
)___";
- str << "<button onclick='sendRestartRequest()' name='restartPDisk' class='btn btn-default' ";
- str << "style='background:LightGray; margin:5px' ";
- str << ">";
- str << "Restart";
- str << "</button>";
+
+ str << R"___(
+ <button type="button" class="btn btn-default" style="background: LightGray; margin: 5px"
+ data-toggle="modal" data-target="#restartModal">
+ Restart
+ </button>
+
+ <div id="restartModal" class="modal fade" tabindex="-1">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal">
+ <span aria-hidden="true">&times;</span>
+ </button>
+ <h4 class="modal-title">Confirm Restart</h4>
+ </div>
+ <div class="modal-body">
+ <p>Are you sure you want to restart?</p>
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" id="ignoreChecks" onchange="toggleButtonColor()"> Ignore all checks
+ </label>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-primary" id="restartOkButton" onclick="sendRestartRequest()">Restart</button>
+ </div>
+ </div>
+ </div>
+ </div>
+ )___";
if (Cfg->SectorMap) {
str << "<button onclick='sendStopRequest()' name='stopPDisk' class='btn btn-default' ";
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp
index 287b4d0bb8..dd7eb73b8f 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_ut_actions.cpp
@@ -1138,7 +1138,7 @@ void TTestChunkUnlockRestart::TestFSM(const TActorContext &ctx) {
SignalDoneEvent();
break;
}
- ctx.Send(NodeWardenId, new TEvBlobStorage::TEvAskWardenRestartPDisk(LastResponse.whiteboardPDiskResult->Record.GetPDiskId()));
+ ctx.Send(NodeWardenId, new TEvBlobStorage::TEvAskWardenRestartPDisk(LastResponse.whiteboardPDiskResult->Record.GetPDiskId(), false));
break;
case 30:
TEST_RESPONSE(EvHarakiri, OK);