Skip to content
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

Preload followers data #5835

Merged
merged 13 commits into from
Jul 1, 2024
Merged

Conversation

kunga
Copy link
Member

@kunga kunga commented Jun 21, 2024

Changelog entry

...

Changelog category

  • Not for changelog (changelog entry is not required)

Additional information

Resolves #4744

Latencies become a bit better

https://gist.github.com/kunga/12af041b01499117cb40042ecaf7e1c8

https://nda.ya.ru/t/6HpGDKpA76ZF8r

Before:

image

After:

image

KeysEnv->Save(cookie, std::move(loaded));
if (Stage == EStage::PartView || Stage == EStage::Slice || Stage == EStage::PreloadData) {
for (auto& loaded : loadedPages) {
LoaderEnv->Save(cookie, std::move(loaded));
Copy link
Member Author

Choose a reason for hiding this comment

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

Сделал чтобы все страницы шли через кэширующий Env, а то предзагрузка индекса который не пинится может бесконечно зациклиться

if (BTreeGroupIndexes) {
// Note: preload root nodes only because we don't want to have multiple restarts here
for (const auto& meta : BTreeGroupIndexes) {
if (meta.LevelCount) getPage(meta.PageId);
Copy link
Member Author

Choose a reason for hiding this comment

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

Вообще можно и страницу с данными тут грузить, если она одна, но не знаю насколько интересно

Copy link

github-actions bot commented Jun 21, 2024

2024-06-21 14:13:48 UTC Pre-commit check for dd30a8c has started.
2024-06-21 14:16:02 UTC Check cancelled

@@ -361,6 +361,7 @@ void TDataShard::OnActivateExecutor(const TActorContext& ctx) {
SyncConfig();
State = TShardState::Readonly;
FollowerState = { };
Executor()->SetPreloadTablesData({Schema::Sys::TableId, Schema::UserTables::TableId, Schema::Snapshots::TableId});
Copy link
Member Author

@kunga kunga Jun 21, 2024

Choose a reason for hiding this comment

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

Если будут варианты покрасивше чем HashSet полем в executor - послушаю

Copy link
Member

Choose a reason for hiding this comment

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

Как вариант можно было бы сделать callback'ом у ITablet, типа нужно ли грузить данные таблицы X. Можно было бы также вызывать во время начальной загрузки, т.к. сейчас это похоже используются только в part switch'ах, и OnActivateExecutor в принципе вызывается только когда уже таблетка готова к работе.

Copy link
Member Author

Choose a reason for hiding this comment

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

Можно было бы также вызывать во время начальной загрузки

А вот тут по комментарию мне показалось, что в момент загрузки у нас может и не быть системных таблиц на фолловере вовсе?

// Check that TxInit from leader has been already replicated to the follower

Я правда не смог понять, что за TxInit тут имели ввиду.

Copy link
Member

Choose a reason for hiding this comment

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

На фолловерах TxInit (транзакция) не вызывается совсем. Этот комментарий относится к тому, что мы здесь проверяем проинициализировался ли шард вообще - конкретно накатил ли он схему. Потому что фолловер ничего проинициализировать не может, под ним асинхронно схема и данные постоянно меняются.

Copy link

github-actions bot commented Jun 21, 2024

2024-06-21 14:36:55 UTC Pre-commit check for 2471020 has started.
2024-06-21 14:39:33 UTC Build linux-x86_64-release-asan is running...
🔴 2024-06-21 14:58:19 UTC Build failed. see the build logs.

Copy link

github-actions bot commented Jun 21, 2024

2024-06-21 14:42:43 UTC Pre-commit check for 2471020 has started.
2024-06-21 14:45:19 UTC Build linux-x86_64-release-clang14 is running...
2024-06-21 15:08:06 UTC Check cancelled

Copy link

github-actions bot commented Jun 21, 2024

2024-06-21 14:48:56 UTC Pre-commit check for 2471020 has started.
2024-06-21 14:51:30 UTC Build linux-x86_64-relwithdebinfo is running...
2024-06-21 15:08:07 UTC Check cancelled

@kunga kunga force-pushed the preload-followers-data branch from d9887f7 to a9c1cd8 Compare June 21, 2024 15:07
Copy link

github-actions bot commented Jun 21, 2024

2024-06-21 15:14:07 UTC Pre-commit check for 4502318 has started.
2024-06-21 15:16:37 UTC Build linux-x86_64-release-asan is running...
🟢 2024-06-21 15:24:35 UTC Build successful.
2024-06-21 15:24:48 UTC Tests are running...
🔴 2024-06-21 17:25:35 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
10957 10370 0 89 328 170

🟢 2024-06-21 17:26:21 UTC ydbd size 5.5 GiB changed* by +62.8 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 59298b8 merge: 4502318 diff diff %
ydbd size 5 855 347 296 Bytes 5 855 411 552 Bytes +62.8 KiB +0.001%
ydbd stripped size 1 255 652 680 Bytes 1 255 665 768 Bytes +12.8 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 Jun 21, 2024

2024-06-21 15:18:41 UTC Pre-commit check for 4502318 has started.
2024-06-21 15:21:17 UTC Build linux-x86_64-release-clang14 is running...
🟢 2024-06-21 15:31:25 UTC Build successful.

Copy link

github-actions bot commented Jun 21, 2024

2024-06-21 15:33:18 UTC Pre-commit check for 4502318 has started.
2024-06-21 15:35:58 UTC Build linux-x86_64-relwithdebinfo is running...
🟢 2024-06-21 15:44:58 UTC Build successful.
2024-06-21 15:45:12 UTC Tests are running...
🔴 2024-06-21 17:51:54 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39290 34094 0 14 5165 17

🟢 2024-06-21 17:52:36 UTC ydbd size 8.3 GiB changed* by +55.2 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 59298b8 merge: 4502318 diff diff %
ydbd size 8 961 691 128 Bytes 8 961 747 648 Bytes +55.2 KiB +0.001%
ydbd stripped size 488 403 752 Bytes 488 406 248 Bytes +2.4 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 Jun 22, 2024

2024-06-22 13:32:05 UTC Pre-commit check for a8854c7 has started.
2024-06-22 13:34:51 UTC Build linux-x86_64-release-clang14 is running...
🟢 2024-06-22 14:11:55 UTC Build successful.

Copy link

github-actions bot commented Jun 22, 2024

2024-06-22 13:32:23 UTC Pre-commit check for a8854c7 has started.
2024-06-22 13:35:07 UTC Build linux-x86_64-release-asan is running...
🟢 2024-06-22 13:55:43 UTC Build successful.
2024-06-22 13:56:07 UTC Tests are running...
🔴 2024-06-22 16:04:06 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
10964 10383 0 89 322 170

🟢 2024-06-22 16:04:56 UTC ydbd size 5.5 GiB changed* by +25.2 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 8cc0e51 merge: a8854c7 diff diff %
ydbd size 5 853 374 536 Bytes 5 853 400 328 Bytes +25.2 KiB +0.000%
ydbd stripped size 1 255 453 064 Bytes 1 255 458 472 Bytes +5.3 KiB +0.000%

*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 22, 2024

2024-06-22 13:34:27 UTC Pre-commit check for a8854c7 has started.
2024-06-22 13:37:10 UTC Build linux-x86_64-relwithdebinfo is running...
🟢 2024-06-22 13:57:00 UTC Build successful.
2024-06-22 13:57:20 UTC Tests are running...
🔴 2024-06-22 16:03:44 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39398 34151 0 8 5222 17

🟢 2024-06-22 16:04:30 UTC ydbd size 8.3 GiB changed* by +39.0 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 8cc0e51 merge: a8854c7 diff diff %
ydbd size 8 958 642 328 Bytes 8 958 682 256 Bytes +39.0 KiB +0.000%
ydbd stripped size 488 345 896 Bytes 488 350 376 Bytes +4.4 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 Jun 22, 2024

2024-06-22 17:54:01 UTC Pre-commit check for 53b5f9a has started.
2024-06-22 17:56:42 UTC Build linux-x86_64-relwithdebinfo is running...
🟢 2024-06-22 17:59:19 UTC Build successful.
2024-06-22 17:59:36 UTC Tests are running...
🔴 2024-06-22 20:06:29 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39396 34158 0 8 5219 11

🟢 2024-06-22 20:07:17 UTC ydbd size 8.3 GiB changed* by +39.0 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 8cc0e51 merge: 53b5f9a diff diff %
ydbd size 8 958 642 328 Bytes 8 958 682 256 Bytes +39.0 KiB +0.000%
ydbd stripped size 488 345 896 Bytes 488 350 376 Bytes +4.4 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 Jun 22, 2024

2024-06-22 17:54:13 UTC Pre-commit check for 53b5f9a has started.
2024-06-22 17:56:54 UTC Build linux-x86_64-release-asan is running...
🟢 2024-06-22 17:59:36 UTC Build successful.
2024-06-22 17:59:54 UTC Tests are running...
🔴 2024-06-22 20:09:14 UTC Some tests failed, follow the links below.

Test history | Test log

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
10968 10374 0 96 328 170

🟢 2024-06-22 20:10:14 UTC ydbd size 5.5 GiB changed* by +25.2 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: 8cc0e51 merge: 53b5f9a diff diff %
ydbd size 5 853 374 536 Bytes 5 853 400 328 Bytes +25.2 KiB +0.000%
ydbd stripped size 1 255 453 064 Bytes 1 255 458 472 Bytes +5.3 KiB +0.000%

*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 22, 2024

2024-06-22 17:54:27 UTC Pre-commit check for 53b5f9a has started.
2024-06-22 17:57:08 UTC Build linux-x86_64-release-clang14 is running...
🟢 2024-06-22 17:59:26 UTC Build successful.

@kunga kunga requested a review from snaury June 24, 2024 06:59
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.

Preload indexes on followers
2 participants