Skip to content

Extract password verification to a separate actor #19687

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yurikiselev
Copy link
Collaborator

Changelog entry

Password verification is extracted to a separate actor from TSchemeShard local transaction.

Changelog category

  • Performance improvement

Description for reviewers

Existing TTxLogin transaction does not make all login actions now, but checks if password cache may be used for login verification. If hash check is needed, TEvVerifyPassword event is emitted and is handled in a new TLoginHelper actor. A new transaction TTxLoginFinalize is used for sending response on a TEvLoginFinalize event.

Copy link

github-actions bot commented Jun 16, 2025

2025-06-16 10:59:38 UTC Pre-commit check linux-x86_64-release-asan for 322d0d2 has started.
2025-06-16 10:59:49 UTC Artifacts will be uploaded here
2025-06-16 11:03:31 UTC ya make is running...
🟡 2025-06-16 13:20:20 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
15933 15704 0 91 112 26

2025-06-16 13:21:41 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-06-16 13:55:45 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1582 (only retried tests) 1436 0 55 70 21

2025-06-16 13:56:02 UTC ya make is running... (failed tests rerun, try 3)
🟡 2025-06-16 14:27:54 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1310 (only retried tests) 1139 0 52 97 22

🟢 2025-06-16 14:28:10 UTC Build successful.
🟡 2025-06-16 14:28:40 UTC ydbd size 3.9 GiB changed* by +290.7 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 19e7e45 merge: 322d0d2 diff diff %
ydbd size 4 163 911 448 Bytes 4 164 209 096 Bytes +290.7 KiB +0.007%
ydbd stripped size 1 445 078 296 Bytes 1 445 130 424 Bytes +50.9 KiB +0.004%

*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 Jun 16, 2025

2025-06-16 10:59:44 UTC Pre-commit check linux-x86_64-relwithdebinfo for 322d0d2 has started.
2025-06-16 11:00:11 UTC Artifacts will be uploaded here
2025-06-16 11:04:34 UTC ya make is running...
🟡 2025-06-16 12:51:33 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?
38145 35459 0 1 2658 27

2025-06-16 12:54:47 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-06-16 13:05:39 UTC Some tests failed, follow the links below. Going to retry failed tests...

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
437 (only retried tests) 415 0 1 0 21

2025-06-16 13:05:50 UTC ya make is running... (failed tests rerun, try 3)
🟢 2025-06-16 13:17:10 UTC Tests successful.

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
424 (only retried tests) 404 0 0 0 20

🟢 2025-06-16 13:17:18 UTC Build successful.
🟡 2025-06-16 13:17:42 UTC ydbd size 2.2 GiB changed* by +194.9 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 19e7e45 merge: 322d0d2 diff diff %
ydbd size 2 367 263 648 Bytes 2 367 463 208 Bytes +194.9 KiB +0.008%
ydbd stripped size 496 773 160 Bytes 496 792 616 Bytes +19.0 KiB +0.004%

*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 Jun 16, 2025

🟢 2025-06-19 14:30:01 UTC The validation of the Pull Request description is successful.

Copy link

github-actions bot commented Jun 17, 2025

2025-06-17 06:51:05 UTC Pre-commit check linux-x86_64-relwithdebinfo for 0e5eec0 has started.
2025-06-17 06:51:16 UTC Artifacts will be uploaded here
2025-06-17 06:55:05 UTC ya make is running...
🟡 2025-06-17 08:47:56 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?
38175 35459 0 4 2664 48

2025-06-17 08:51:06 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-06-17 09:01:59 UTC Some tests failed, follow the links below. Going to retry failed tests...

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
747 (only retried tests) 721 0 1 0 25

2025-06-17 09:02:10 UTC ya make is running... (failed tests rerun, try 3)
🟢 2025-06-17 09:10:55 UTC Tests successful.

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
416 (only retried tests) 395 0 0 0 21

🟢 2025-06-17 09:11:05 UTC Build successful.
🟡 2025-06-17 09:11:27 UTC ydbd size 2.2 GiB changed* by +186.4 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 6bddb61 merge: 0e5eec0 diff diff %
ydbd size 2 369 235 800 Bytes 2 369 426 712 Bytes +186.4 KiB +0.008%
ydbd stripped size 497 125 640 Bytes 497 136 712 Bytes +10.8 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 Jun 17, 2025

2025-06-17 06:51:07 UTC Pre-commit check linux-x86_64-release-asan for 0e5eec0 has started.
2025-06-17 06:51:19 UTC Artifacts will be uploaded here
2025-06-17 06:55:08 UTC ya make is running...
🟡 2025-06-17 09:23:50 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
15920 15608 0 131 157 24

2025-06-17 09:25:13 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-06-17 10:07:12 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
2016 (only retried tests) 1827 0 67 102 20

2025-06-17 10:07:32 UTC ya make is running... (failed tests rerun, try 3)
🟡 2025-06-17 10:44:10 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1731 (only retried tests) 1585 0 61 65 20

🟢 2025-06-17 10:44:27 UTC Build successful.
🟡 2025-06-17 10:45:00 UTC ydbd size 3.9 GiB changed* by +285.2 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 6bddb61 merge: 0e5eec0 diff diff %
ydbd size 4 167 354 616 Bytes 4 167 646 704 Bytes +285.2 KiB +0.007%
ydbd stripped size 1 446 053 048 Bytes 1 446 100 376 Bytes +46.2 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

@yurikiselev yurikiselev requested a review from ijon June 17, 2025 07:15
@azevaykin azevaykin changed the title Extract password verification to a saparate actor Extract password verification to a separate actor Jun 19, 2025
<< " at schemeshard: " << Self->TabletID());

const auto& event = *LoginFinalizeEventPtr->Get();
if (event.NeedUpdateCache) {
Copy link
Collaborator

@azevaykin azevaykin Jun 19, 2025

Choose a reason for hiding this comment

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

Есть ли тест на разные значения NeedUpdateCache?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Я ещё до ПРа хотел проверять, но внешнему наблюдателю кеш вряд ли заметить. Может есть мысли, как тест должен выглядеть?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Может @ijon подскажет, как и нужно ли писать такой тест

Comment on lines 72 to 77
ctx.Send(
Self->SelfId(),
MakeHolder<TEvPrivate::TEvLoginFinalize>(loginRequest, Response, Request->Sender, "", /*needUpdateCache*/ false),
0,
Request->Cookie
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Предлагаю здесь вместо посылки сообщения выставить флаг и в DoComplete инициировать локальную транзакцию TTxLoginFinalize (Self->Execute(Self->CreateTxLoginFinalize(...), ctx)).

Посылка сообщения самому себе -- это хорошо и нормально. Но в случае, если schemeshard будет перегружен, то событие будет долго висеть в очереди и будет обработано с большой задержкой. То есть получается, что обработка закешированных логинов (которая должна бы быть быстрой) на самом деле зависит от загрузки schemeshard'а и может быть пропорционально медленной.
Инициирование локальной транзакции напрямую поможет проверке закешированных логинов не так тормозиться при перегрузке. Execute тоже не выполнит транзакцию "прямо здесь", но это в любом случае будет быстрее, чем ещё и дожидаться прохода события через возможно загруженный mailbox.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Поправил, но передача параметров туда выглядит немного грязно – с реинтерпрет-кастом по сути. Не резолвлю пока комментарий этот.

…errors; add comments to source actorId; faster hash check
Copy link

github-actions bot commented Jun 20, 2025

2025-06-20 12:14:58 UTC Pre-commit check linux-x86_64-release-asan for 6914662 has started.
2025-06-20 12:15:20 UTC Artifacts will be uploaded here
2025-06-20 12:19:45 UTC ya make is running...
🟡 2025-06-20 14:47:46 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16010 15679 0 113 190 28

2025-06-20 14:49:21 UTC ya make is running... (failed tests rerun, try 2)
🟡 2025-06-20 15:31:07 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet Going to retry failed tests...

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1851 (only retried tests) 1551 0 78 196 26

2025-06-20 15:31:27 UTC ya make is running... (failed tests rerun, try 3)
🟡 2025-06-20 16:09:48 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
1618 (only retried tests) 1360 0 53 180 25

🟢 2025-06-20 16:10:05 UTC Build successful.
🟡 2025-06-20 16:10:38 UTC ydbd size 3.9 GiB changed* by +297.7 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: ce274a4 merge: 6914662 diff diff %
ydbd size 4 180 699 536 Bytes 4 181 004 416 Bytes +297.7 KiB +0.007%
ydbd stripped size 1 449 321 432 Bytes 1 449 372 696 Bytes +50.1 KiB +0.004%

*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 Jun 20, 2025

2025-06-20 12:20:06 UTC Pre-commit check linux-x86_64-relwithdebinfo for 6914662 has started.
2025-06-20 12:20:15 UTC Artifacts will be uploaded here
2025-06-20 12:23:59 UTC ya make is running...
🟡 2025-06-20 14:07:20 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?
38307 35589 0 4 2665 49

2025-06-20 14:11:03 UTC ya make is running... (failed tests rerun, try 2)
🟢 2025-06-20 14:22:26 UTC Tests successful.

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

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
620 (only retried tests) 590 0 0 0 30

🟢 2025-06-20 14:22:35 UTC Build successful.
🟡 2025-06-20 14:22:54 UTC ydbd size 2.2 GiB changed* by +191.5 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: ce274a4 merge: 6914662 diff diff %
ydbd size 2 376 655 024 Bytes 2 376 851 128 Bytes +191.5 KiB +0.008%
ydbd stripped size 498 045 256 Bytes 498 057 224 Bytes +11.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

@yurikiselev yurikiselev requested review from ijon and azevaykin June 20, 2025 12:37
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.

Extract login handler from schemeshard local transactions to separate actor
3 participants