Skip to content

Add manual request approval to CMS #21593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 11, 2025

Conversation

SammyVimes
Copy link
Collaborator

@SammyVimes SammyVimes commented Jul 23, 2025

Changelog entry

Adds ability to manually approve scheduled CMS request and receive permissions. This allows, for example, locking an already failed node.

Changelog category

  • Experimental feature

Description for reviewers

...

@SammyVimes SammyVimes requested review from Copilot and removed request for stanislav-shchetinin July 23, 2025 23:50
Copilot

This comment was marked as resolved.

@SammyVimes SammyVimes requested a review from Copilot July 23, 2025 23:52
@SammyVimes SammyVimes changed the title Add manual request approve to CMS Add manual request approval to CMS Jul 23, 2025
Copilot

This comment was marked as outdated.

Copy link

github-actions bot commented Jul 23, 2025

🟢 2025-07-29 13:02:43 UTC The validation of the Pull Request description is successful.

Copy link

github-actions bot commented Jul 24, 2025

2025-07-24 00:05:27 UTC Pre-commit check linux-x86_64-release-asan for 4d87dcf has started.
2025-07-24 00:05:40 UTC Artifacts will be uploaded here
2025-07-24 00:09:22 UTC ya make is running...
🟡 2025-07-24 02:36:49 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16581 16176 0 97 281 27

🟢 2025-07-24 02:38:13 UTC Build successful.
🟢 2025-07-24 02:38:41 UTC ydbd size 3.9 GiB changed* by +72.3 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 9911a2e merge: 4d87dcf diff diff %
ydbd size 4 218 876 648 Bytes 4 218 950 720 Bytes +72.3 KiB +0.002%
ydbd stripped size 1 461 975 544 Bytes 1 461 999 192 Bytes +23.1 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Jul 24, 2025

2025-07-24 00:39:09 UTC Pre-commit check linux-x86_64-relwithdebinfo for 4d87dcf has started.
2025-07-24 00:39:16 UTC Artifacts will be uploaded here
2025-07-24 00:43:50 UTC ya make is running...
🟡 2025-07-24 02:41:40 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39075 36281 0 6 2749 39

2025-07-24 02:45:02 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-07-24 02:57:24 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
534 (only retried tests) 457 0 0 52 25

🟢 2025-07-24 02:57:33 UTC Build successful.
🟢 2025-07-24 02:57:55 UTC ydbd size 2.2 GiB changed* by +41.9 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 9911a2e merge: 4d87dcf diff diff %
ydbd size 2 399 470 712 Bytes 2 399 513 632 Bytes +41.9 KiB +0.002%
ydbd stripped size 501 723 016 Bytes 501 730 344 Bytes +7.2 KiB +0.001%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Jul 29, 2025

2025-07-29 12:59:11 UTC Pre-commit check linux-x86_64-release-asan for fc21cf7 has started.
2025-07-29 12:59:27 UTC Artifacts will be uploaded here
2025-07-29 13:03:15 UTC ya make is running...
2025-07-29 13:28:55 UTC Check cancelled

Copilot

This comment was marked as outdated.

Copy link

github-actions bot commented Jul 29, 2025

2025-07-29 13:00:41 UTC Pre-commit check linux-x86_64-relwithdebinfo for fc21cf7 has started.
2025-07-29 13:00:49 UTC Artifacts will be uploaded here
2025-07-29 13:04:39 UTC ya make is running...
2025-07-29 13:28:55 UTC Check cancelled

@SammyVimes SammyVimes requested a review from Copilot July 29, 2025 13:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces manual approval functionality for CMS (Cluster Management Service) requests, allowing administrators to approve previously rejected scheduled requests and receive permissions even when normal safety checks would prevent approval.

  • Adds a new APPROVE action type to the CMS management API
  • Implements CLI command support for approving scheduled requests
  • Provides manual override capability for requests that fail automatic approval due to availability constraints

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ydb/core/protos/cms.proto Adds APPROVE enum value and ManuallyApprovedPermissions field to protobuf definitions
ydb/core/driver_lib/cli_utils/cli_cmds_cms.cpp Implements CLI command class for approving requests
ydb/core/cms/cms_ut_common.h Adds test helper method declaration for approval testing
ydb/core/cms/cms_ut_common.cpp Implements test helper method for approval operations
ydb/core/cms/cms_ut.cpp Adds comprehensive unit tests for manual approval scenarios
ydb/core/cms/cms_impl.h Declares ManuallyApproveRequest method in CMS implementation
ydb/core/cms/cms.cpp Implements core manual approval logic with dedicated actor

Copy link

github-actions bot commented Jul 29, 2025

2025-07-29 13:41:04 UTC Pre-commit check linux-x86_64-release-asan for cfb8b4c has started.
2025-07-29 13:41:18 UTC Artifacts will be uploaded here
2025-07-29 13:44:59 UTC ya make is running...
🟡 2025-07-29 16:08:46 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16631 16229 0 102 275 25

🟢 2025-07-29 16:10:14 UTC Build successful.
🟢 2025-07-29 16:10:42 UTC ydbd size 3.9 GiB changed* by +92.8 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 7e2a921 merge: cfb8b4c diff diff %
ydbd size 4 226 323 912 Bytes 4 226 418 984 Bytes +92.8 KiB +0.002%
ydbd stripped size 1 463 845 688 Bytes 1 463 876 408 Bytes +30.0 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Jul 29, 2025

2025-07-29 13:41:19 UTC Pre-commit check linux-x86_64-relwithdebinfo for cfb8b4c has started.
2025-07-29 13:41:34 UTC Artifacts will be uploaded here
2025-07-29 13:45:19 UTC ya make is running...
🟡 2025-07-29 15:41:01 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39151 36380 0 4 2741 26

2025-07-29 15:44:35 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-07-29 15:57:16 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
294 (only retried tests) 222 0 0 49 23

🟢 2025-07-29 15:57:26 UTC Build successful.
🟢 2025-07-29 15:57:45 UTC ydbd size 2.2 GiB changed* by -57.6 KiB, which is <= 0 Bytes vs main: OK

ydbd size dash main: b8a39bb merge: cfb8b4c diff diff %
ydbd size 2 403 977 048 Bytes 2 403 918 088 Bytes -57.6 KiB -0.002%
ydbd stripped size 502 381 608 Bytes 502 368 808 Bytes -12.5 KiB -0.003%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@SammyVimes SammyVimes requested a review from CyberROFL July 29, 2025 13:50
Copy link

github-actions bot commented Aug 6, 2025

2025-08-06 14:26:31 UTC Pre-commit check linux-x86_64-release-asan for 969e324 has started.
2025-08-06 14:26:38 UTC Artifacts will be uploaded here
2025-08-06 14:30:20 UTC ya make is running...
2025-08-06 16:20:37 UTC Check cancelled

Copy link

github-actions bot commented Aug 6, 2025

2025-08-06 14:27:39 UTC Pre-commit check linux-x86_64-relwithdebinfo for 969e324 has started.
2025-08-06 14:27:54 UTC Artifacts will be uploaded here
2025-08-06 14:31:39 UTC ya make is running...
🟢 2025-08-06 16:21:17 UTC ydbd size 2.2 GiB changed* by +51.7 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: c6be5ef merge: 969e324 diff diff %
ydbd size 2 413 179 232 Bytes 2 413 232 176 Bytes +51.7 KiB +0.002%
ydbd stripped size 503 896 904 Bytes 503 909 352 Bytes +12.2 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation
2025-08-06 16:21:19 UTC Check cancelled

@SammyVimes SammyVimes requested a review from pixcc August 6, 2025 16:21
Copy link

github-actions bot commented Aug 6, 2025

2025-08-06 16:23:50 UTC Pre-commit check linux-x86_64-relwithdebinfo for aee3fab has started.
2025-08-06 16:24:05 UTC Artifacts will be uploaded here
2025-08-06 16:27:48 UTC ya make is running...
🟡 2025-08-06 18:20:36 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39314 36534 0 5 2745 30

2025-08-06 18:24:13 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-08-06 18:36:38 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
457 (only retried tests) 384 0 0 53 20

🟢 2025-08-06 18:36:47 UTC Build successful.
🟢 2025-08-06 18:37:07 UTC ydbd size 2.2 GiB changed* by +51.6 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 6adfabd merge: aee3fab diff diff %
ydbd size 2 413 587 088 Bytes 2 413 639 968 Bytes +51.6 KiB +0.002%
ydbd stripped size 503 981 896 Bytes 503 994 280 Bytes +12.1 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Aug 6, 2025

2025-08-06 16:23:57 UTC Pre-commit check linux-x86_64-release-asan for aee3fab has started.
2025-08-06 16:24:12 UTC Artifacts will be uploaded here
2025-08-06 16:28:09 UTC ya make is running...
🟡 2025-08-06 19:09:56 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16744 16246 0 140 335 23

🟢 2025-08-06 19:11:28 UTC Build successful.
🟢 2025-08-06 19:11:57 UTC ydbd size 4.0 GiB changed* by +79.6 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 6adfabd merge: aee3fab diff diff %
ydbd size 4 242 992 424 Bytes 4 243 073 936 Bytes +79.6 KiB +0.002%
ydbd stripped size 1 468 767 416 Bytes 1 468 791 640 Bytes +23.7 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Aug 7, 2025

2025-08-07 15:25:57 UTC Pre-commit check linux-x86_64-release-asan for 82d5f41 has started.
2025-08-07 15:26:21 UTC Artifacts will be uploaded here
2025-08-07 15:30:54 UTC ya make is running...
🟡 2025-08-07 18:09:26 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16751 16258 0 155 315 23

🟢 2025-08-07 18:11:05 UTC Build successful.
🟢 2025-08-07 18:11:34 UTC ydbd size 4.0 GiB changed* by +79.3 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 47f183f merge: 82d5f41 diff diff %
ydbd size 4 247 837 272 Bytes 4 247 918 488 Bytes +79.3 KiB +0.002%
ydbd stripped size 1 469 922 040 Bytes 1 469 946 136 Bytes +23.5 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Aug 7, 2025

2025-08-07 15:27:51 UTC Pre-commit check linux-x86_64-relwithdebinfo for 82d5f41 has started.
2025-08-07 15:28:05 UTC Artifacts will be uploaded here
2025-08-07 15:31:57 UTC ya make is running...
🟡 2025-08-07 17:34:14 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39334 36534 0 3 2759 38

2025-08-07 17:37:39 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-08-07 17:50:38 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1103 (only retried tests) 1025 0 0 56 22

🟢 2025-08-07 17:50:51 UTC Build successful.
🟢 2025-08-07 17:51:15 UTC ydbd size 2.2 GiB changed* by +51.7 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 47f183f merge: 82d5f41 diff diff %
ydbd size 2 414 537 464 Bytes 2 414 590 360 Bytes +51.7 KiB +0.002%
ydbd stripped size 504 890 664 Bytes 504 903 016 Bytes +12.1 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Aug 8, 2025

2025-08-08 11:11:50 UTC Pre-commit check linux-x86_64-relwithdebinfo for b5dca56 has started.
2025-08-08 11:12:04 UTC Artifacts will be uploaded here
2025-08-08 11:15:54 UTC ya make is running...
2025-08-08 13:08:41 UTC Check cancelled

Copy link

github-actions bot commented Aug 8, 2025

2025-08-08 11:13:19 UTC Pre-commit check linux-x86_64-release-asan for b5dca56 has started.
2025-08-08 11:13:33 UTC Artifacts will be uploaded here
2025-08-08 11:17:23 UTC ya make is running...
2025-08-08 13:08:42 UTC Check cancelled

pixcc
pixcc previously approved these changes Aug 8, 2025
@SammyVimes SammyVimes removed the request for review from CyberROFL August 8, 2025 11:26
Copy link

github-actions bot commented Aug 8, 2025

2025-08-08 13:10:29 UTC Pre-commit check linux-x86_64-release-asan for 099825e has started.
2025-08-08 13:10:37 UTC Artifacts will be uploaded here
2025-08-08 13:14:27 UTC ya make is running...
🟡 2025-08-08 15:54:26 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16785 16304 0 131 320 30

🟢 2025-08-08 15:55:54 UTC Build successful.
🟢 2025-08-08 15:56:25 UTC ydbd size 4.0 GiB changed* by +79.9 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 604a3ec merge: 099825e diff diff %
ydbd size 4 248 580 528 Bytes 4 248 662 320 Bytes +79.9 KiB +0.002%
ydbd stripped size 1 470 133 720 Bytes 1 470 157 880 Bytes +23.6 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Aug 8, 2025

2025-08-08 13:11:55 UTC Pre-commit check linux-x86_64-relwithdebinfo for 099825e has started.
2025-08-08 13:12:10 UTC Artifacts will be uploaded here
2025-08-08 13:16:03 UTC ya make is running...
🟡 2025-08-08 15:13:29 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39374 36588 0 1 2753 32

2025-08-08 15:17:09 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-08-08 15:30:03 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
898 (only retried tests) 826 0 0 50 22

🟢 2025-08-08 15:30:16 UTC Build successful.
🟢 2025-08-08 15:30:36 UTC ydbd size 2.2 GiB changed* by +52.3 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 604a3ec merge: 099825e diff diff %
ydbd size 2 414 897 984 Bytes 2 414 951 528 Bytes +52.3 KiB +0.002%
ydbd stripped size 504 955 912 Bytes 504 968 392 Bytes +12.2 KiB +0.002%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@SammyVimes SammyVimes merged commit 8b7713d into ydb-platform:main Aug 11, 2025
12 checks passed
SammyVimes added a commit to SammyVimes/ydb that referenced this pull request Aug 11, 2025
SammyVimes added a commit to SammyVimes/ydb that referenced this pull request Aug 11, 2025
{}

void Handle(TEvCms::TEvPermissionResponse::TPtr &ev) {
auto resp = ev->Get();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto resp = ev->Get();
const auto& resp = ev->Get();


const NKikimrCms::TStatus status = resp->Record.GetStatus();

THolder<TEvCms::TEvManageRequestResponse> manageResponse = MakeHolder<TEvCms::TEvManageRequestResponse>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
THolder<TEvCms::TEvManageRequestResponse> manageResponse = MakeHolder<TEvCms::TEvManageRequestResponse>();
auto manageResponse = MakeHolder<TEvCms::TEvManageRequestResponse>();

Не нужно повторять, а читаемость только улучшается.

ev, TStatus::WRONG_REQUEST, "Unknown request for manual approval", ctx);
}

THolder<TRequestInfo> copy = MakeHolder<TRequestInfo>(it->second);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
THolder<TRequestInfo> copy = MakeHolder<TRequestInfo>(it->second);
auto copy = MakeHolder<TRequestInfo>(it->second);

То же самое.

THolder<TRequestInfo> copy = MakeHolder<TRequestInfo>(it->second);

// Create a permission for each action in the scheduled request
THolder<TEvCms::TEvPermissionResponse> resp = MakeHolder<TEvCms::TEvPermissionResponse>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
THolder<TEvCms::TEvPermissionResponse> resp = MakeHolder<TEvCms::TEvPermissionResponse>();
auto resp = MakeHolder<TEvCms::TEvPermissionResponse>();

resp->Record.MutableStatus()->SetCode(TStatus::ALLOW);
for (const auto& action : copy->Request.GetActions()) {
auto items = ClusterInfo->FindLockedItems(action, &ctx);
for (const auto& item : items) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут двойной indirection, т.к. item — это указатель.

duration += TDuration::MicroSeconds(copy->Request.GetDuration());
// To get permissions ASAP and not in the priority order.
item->DeactivateScheduledLocks(Min<i32>());
bool isLocked = item->IsLocked(error, State->Config.DefaultRetryTime, TActivationContext::Now(), duration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool isLocked = item->IsLocked(error, State->Config.DefaultRetryTime, TActivationContext::Now(), duration);
const bool isLocked = item->IsLocked(error, State->Config.DefaultRetryTime, ctx.Now(), duration);


auto* perm = resp->Record.AddPermissions();
perm->MutableAction()->CopyFrom(action);
TInstant deadline = TActivationContext::Now() + TDuration::MicroSeconds(copy->Request.GetDuration());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
TInstant deadline = TActivationContext::Now() + TDuration::MicroSeconds(copy->Request.GetDuration());
const TInstant deadline = ctx.Now() + TDuration::MicroSeconds(copy->Request.GetDuration());

Там, откуда ты скопировал TActivationContext::Now() нет TActorContext, а тут есть.

PavelEfarinov pushed a commit to PavelEfarinov/ydb that referenced this pull request Aug 18, 2025
PavelEfarinov pushed a commit to PavelEfarinov/ydb that referenced this pull request Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants