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

add missing table stats for column shards #7140

Merged
merged 19 commits into from
Aug 1, 2024

Conversation

swalrus1
Copy link
Collaborator

Track missing table stats in column shard similarly to data shard. New stats are available in DescribeTable.

@swalrus1 swalrus1 linked an issue Jul 26, 2024 that may be closed by this pull request
@swalrus1 swalrus1 force-pushed the add-missing-table-stats branch 2 times, most recently from ed8764e to 2e29022 Compare July 26, 2024 11:58
Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 12:01:06 UTC Pre-commit check for 27721f5 has started.
2024-07-26 12:03:51 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-07-26 12:19:33 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 12:01:49 UTC Pre-commit check for 27721f5 has started.
2024-07-26 12:04:59 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-07-26 12:10:54 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 12:21:53 UTC Pre-commit check for 27721f5 has started.
2024-07-26 12:24:40 UTC Check linux-x86_64-release-asan is running...
2024-07-26 12:37:26 UTC Check cancelled

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 12:42:11 UTC Pre-commit check for 342cc3f has started.
2024-07-26 12:45:33 UTC Check linux-x86_64-release-asan is running...
🔴 2024-07-26 12:59:17 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 12:45:23 UTC Pre-commit check for 342cc3f has started.
2024-07-26 12:48:13 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-07-26 13:02:51 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 12:45:42 UTC Pre-commit check for 342cc3f has started.
2024-07-26 12:48:58 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-07-26 12:53:37 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 13:08:13 UTC Pre-commit check for fa6f346 has started.
2024-07-26 13:11:16 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-07-26 13:17:45 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 13:09:02 UTC Pre-commit check for fa6f346 has started.
2024-07-26 13:12:06 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-07-26 13:28:31 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 26, 2024

2024-07-26 13:15:58 UTC Pre-commit check for fa6f346 has started.
2024-07-26 13:18:51 UTC Check linux-x86_64-release-asan is running...
🔴 2024-07-26 13:32:29 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 29, 2024

2024-07-29 17:05:19 UTC Pre-commit check for c2972a5 has started.
2024-07-29 17:08:37 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-07-29 17:14:03 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 29, 2024

2024-07-29 17:07:29 UTC Pre-commit check for c2972a5 has started.
2024-07-29 17:12:57 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-07-29 17:30:38 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 29, 2024

2024-07-29 17:07:33 UTC Pre-commit check for c2972a5 has started.
2024-07-29 17:10:41 UTC Check linux-x86_64-release-asan is running...
🔴 2024-07-29 17:25:34 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 30, 2024

2024-07-30 09:29:20 UTC Pre-commit check for 99aad4a has started.
2024-07-30 09:32:20 UTC Check linux-x86_64-release-clang14 is running...
2024-07-30 09:36:23 UTC Check cancelled

Copy link

github-actions bot commented Jul 30, 2024

2024-07-30 09:29:35 UTC Pre-commit check for 99aad4a has started.
2024-07-30 09:32:33 UTC Check linux-x86_64-release-asan is running...
2024-07-30 09:36:24 UTC Check cancelled

Copy link

github-actions bot commented Jul 30, 2024

2024-07-30 09:31:05 UTC Pre-commit check for 99aad4a has started.
2024-07-30 09:33:51 UTC Check linux-x86_64-relwithdebinfo is running...
2024-07-30 09:36:19 UTC Check cancelled

@swalrus1 swalrus1 force-pushed the add-missing-table-stats branch from 31faa1f to 893089b Compare July 30, 2024 09:35
Copy link

github-actions bot commented Jul 30, 2024

2024-07-30 09:38:42 UTC Pre-commit check for 5572e48 has started.
2024-07-30 09:41:41 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-07-30 09:47:45 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 30, 2024

2024-07-30 09:38:52 UTC Pre-commit check for 5572e48 has started.
2024-07-30 09:41:44 UTC Check linux-x86_64-release-asan is running...
🔴 2024-07-30 09:55:56 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 30, 2024

2024-07-30 09:38:58 UTC Pre-commit check for 5572e48 has started.
2024-07-30 09:41:55 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-07-30 09:58:12 UTC Build failed. see the logs.

namespace NKikimr::NColumnShard {

void TTableStatsBuilder::FillColumnTableStats(const TSingleColumnTableCounters& stats) {
stats.FillStats(TableStats);
Copy link
Collaborator Author

@swalrus1 swalrus1 Jul 30, 2024

Choose a reason for hiding this comment

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

не знаю, насколько хорошо уносить заполнение частей протобуфа в каунтеры

@@ -1,6 +1,8 @@
#pragma once
#include "engines/changes/abstract/compaction_info.h"
#include "engines/portions/meta.h"
#include <ydb/core/tx/columnshard/counters/statistics_store.h>
#include <ydb/core/base/appdata.h>
Copy link
Collaborator

Choose a reason for hiding this comment

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

эту зависимость, лучше, в h-файлы не тянуть

bool ActiveCleanupPortions = false;
bool ActiveCleanupTables = false;
bool ActiveCleanupInsertTable = false;
YDB_READONLY(TMonotonic, LastIndexationInstant, TMonotonic::Zero());
public:
TBackgroundController(TBackgroundControllerCounters& stats) : Stats(stats) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

на разных строчках по style guide

@@ -15,11 +17,15 @@ class TBackgroundController {
using TCurrentCompaction = THashMap<ui64, NOlap::TPlanCompactionInfo>;
TCurrentCompaction ActiveCompactionInfo;

TBackgroundControllerCounters& Stats;
Copy link
Collaborator

Choose a reason for hiding this comment

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

давай, лучше, std::shared_ptr<>

}
}

TInstant GetLastCompactionFinishInstant(ui64 pathId) const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

const ui64 pathId рекомендую
и в private, поскольку не используется снаружи

}
}

TInstant GetLastCompactionFinishInstant(ui64 pathId) const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

лучше отдавать std::optional


namespace NKikimr::NColumnShard {

class TStatisticsStore {
Copy link
Collaborator

Choose a reason for hiding this comment

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

TCountersManager

@@ -193,17 +193,17 @@ TConclusionStatus TGeneralCompactColumnEngineChanges::DoConstructBlobs(TConstruc
void TGeneralCompactColumnEngineChanges::DoWriteIndexOnComplete(NColumnShard::TColumnShard* self, TWriteIndexCompleteContext& context) {
TBase::DoWriteIndexOnComplete(self, context);
if (self) {
self->IncCounter(
self->Stats.GetTabletCounters().IncCounter(
Copy link
Collaborator

Choose a reason for hiding this comment

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

лучше сагрегировать в 1 метод

self->IncCounter(NColumnShard::COUNTER_INDEXING_BLOBS_WRITTEN, context.BlobsWritten);
self->IncCounter(NColumnShard::COUNTER_INDEXING_BYTES_WRITTEN, context.BytesWritten);
self->IncCounter(NColumnShard::COUNTER_INDEXING_TIME, context.Duration.MilliSeconds());
self->Stats.GetTabletCounters().IncCounter(NColumnShard::COUNTER_INDEXING_BLOBS_WRITTEN, context.BlobsWritten);
Copy link
Collaborator

Choose a reason for hiding this comment

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

в 1 метод

Self->IncCounter(NColumnShard::COUNTER_READ_INDEX_BLOBS, statsDelta.Blobs);
Self->IncCounter(NColumnShard::COUNTER_READ_INDEX_ROWS, statsDelta.Rows);
Self->IncCounter(NColumnShard::COUNTER_READ_INDEX_BYTES, statsDelta.Bytes);
Self->Stats.GetTabletCounters().IncCounter(NColumnShard::COUNTER_READ_INDEX_PORTIONS, statsDelta.Portions);
Copy link
Collaborator

Choose a reason for hiding this comment

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

1 метод

owner.IncCounter(COUNTER_BLOBS_COMMITTED, counters.Rows);
owner.IncCounter(COUNTER_BYTES_COMMITTED, counters.Bytes);
owner.IncCounter(COUNTER_RAW_BYTES_COMMITTED, counters.RawBytes);
owner.Stats.GetTabletCounters().IncCounter(COUNTER_BLOBS_COMMITTED, counters.Rows);
Copy link
Collaborator

Choose a reason for hiding this comment

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

1 метод

@swalrus1 swalrus1 force-pushed the add-missing-table-stats branch from 893089b to 7a579d0 Compare July 31, 2024 11:33
Copy link

github-actions bot commented Jul 31, 2024

2024-07-31 11:34:41 UTC Pre-commit check for 97ff086 has started.
2024-07-31 11:45:22 UTC Check cancelled

Copy link

github-actions bot commented Jul 31, 2024

2024-07-31 11:52:48 UTC Pre-commit check for dd8c3d7 has started.
2024-07-31 11:55:54 UTC Check linux-x86_64-release-asan is running...
🔴 2024-07-31 12:08:22 UTC Build failed. see the logs.

Copy link

github-actions bot commented Jul 31, 2024

2024-07-31 11:53:08 UTC Pre-commit check for dd8c3d7 has started.
2024-07-31 11:56:15 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-07-31 12:12:54 UTC Build failed. see the logs.

@swalrus1 swalrus1 force-pushed the add-missing-table-stats branch from f069a43 to 0bdba01 Compare July 31, 2024 13:55
Copy link

github-actions bot commented Jul 31, 2024

2024-07-31 16:14:05 UTC Pre-commit check for 8a28945 has started.
2024-07-31 16:17:10 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-07-31 16:22:38 UTC Build failed. see the logs.

@swalrus1 swalrus1 force-pushed the add-missing-table-stats branch from e617484 to 5b8f168 Compare August 1, 2024 10:40
Copy link

github-actions bot commented Aug 1, 2024

2024-08-01 10:42:07 UTC Pre-commit check for 42b7faf has started.
2024-08-01 10:44:55 UTC Check linux-x86_64-relwithdebinfo is running...
🔴 2024-08-01 10:49:36 UTC Build failed. see the logs.

Copy link

github-actions bot commented Aug 1, 2024

2024-08-01 10:42:26 UTC Pre-commit check for 42b7faf has started.
2024-08-01 10:46:13 UTC Check linux-x86_64-release-asan is running...
🔴 2024-08-01 10:52:46 UTC Build failed. see the logs.

Copy link

github-actions bot commented Aug 1, 2024

2024-08-01 10:44:15 UTC Pre-commit check for 42b7faf has started.
2024-08-01 10:47:13 UTC Check linux-x86_64-release-clang14 is running...
🔴 2024-08-01 10:52:10 UTC Build failed. see the logs.

Copy link

github-actions bot commented Aug 1, 2024

2024-08-01 18:09:25 UTC Pre-commit check for 018f002 has started.
2024-08-01 18:12:24 UTC Check linux-x86_64-relwithdebinfo is running...
🟡 2024-08-01 20:04:34 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
39646 34324 0 3 5307 12

2024-08-01 20:10:06 UTC Failed tests rerun (try 2) linux-x86_64-relwithdebinfo is running...
🟡 2024-08-01 20:17:51 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
18 (only retried tests) 9 0 1 0 8

2024-08-01 20:21:26 UTC Failed tests rerun (try 3) linux-x86_64-relwithdebinfo is running...
🔴 2024-08-01 20:29:43 UTC Some tests failed, follow the links below.

Test history | Ya make output

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
10 (only retried tests) 1 0 1 0 8

🟢 2024-08-01 20:33:09 UTC Build successful.
🟡 2024-08-01 20:33:44 UTC ydbd size 8.1 GiB changed* by +1.3 MiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: b08c9a5 merge: 018f002 diff diff %
ydbd size 8 672 679 560 Bytes 8 674 062 064 Bytes +1.3 MiB +0.016%
ydbd stripped size 472 081 000 Bytes 472 097 128 Bytes +15.8 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

Copy link

github-actions bot commented Aug 1, 2024

2024-08-01 18:08:59 UTC Pre-commit check for 018f002 has started.
2024-08-01 18:12:00 UTC Check linux-x86_64-release-asan is running...
🔴 2024-08-01 20:16:26 UTC Some tests failed, follow the links below.

Test history | Ya make output

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
10891 10837 0 16 24 14

🟢 2024-08-01 20:17:41 UTC Build successful.
🟡 2024-08-01 20:18:10 UTC ydbd size 5.4 GiB changed* by +518.2 KiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: b08c9a5 merge: 018f002 diff diff %
ydbd size 5 841 768 136 Bytes 5 842 298 792 Bytes +518.2 KiB +0.009%
ydbd stripped size 1 463 994 448 Bytes 1 464 044 944 Bytes +49.3 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

Copy link

github-actions bot commented Aug 1, 2024

2024-08-01 11:56:35 UTC Pre-commit check for 018f002 has started.
2024-08-01 12:00:05 UTC Check linux-x86_64-release-clang14 is running...
🟢 2024-08-01 12:08:01 UTC Build successful.

wBuffer.RemoveData(aggr, StoragesManager->GetInsertOperator());
continue;
}

if (putResult.GetPutStatus() != NKikimrProto::OK) {
CSCounters.OnWritePutBlobsFail(TMonotonic::Now() - writeMeta.GetWriteStartInstant());
IncCounter(COUNTER_WRITE_FAIL);
Counters.GetCSCounters().OnWritePutBlobsFail(TMonotonic::Now() - writeMeta.GetWriteStartInstant());
Copy link
Collaborator

Choose a reason for hiding this comment

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

объединить

@@ -162,6 +156,8 @@ void TColumnShard::Handle(TEvColumnShard::TEvWrite::TPtr& ev, const TActorContex
const TString dedupId = record.GetDedupId();
const auto source = ev->Sender;

Counters.GetColumnTablesCounters()->GetPathIdCounter(tableId)->OnUpdate();
Copy link
Collaborator

Choose a reason for hiding this comment

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

либо OnWriteEvent либо UpdateLastEventTime

@@ -379,7 +375,7 @@ void TColumnShard::Handle(NEvents::TDataEvents::TEvWrite::TPtr& ev, const TActor
return;
}

auto wg = WritesMonitor.RegisterWrite(arrowData->GetSize());
auto wg = Counters.GetWritesMonitor()->OnStartWrite(arrowData->GetSize());
Copy link
Collaborator

Choose a reason for hiding this comment

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

On*** это методы-сообщения, возврат значений из которых не предполагается

Copy link
Collaborator

Choose a reason for hiding this comment

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

попробовать удалить Guard. сделать UpdateCounters сразу

auto* tabletStats = ev->Record.MutableTableStats();
FillTxTableStats(tabletStats);

TTableStatsBuilder statsBuilder(*ev->Record.MutableTableStats());
Copy link
Collaborator

Choose a reason for hiding this comment

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

давай сделаем тогда так
TTableStatsBuilder statsFiller(counters, executor, columnsEngine);
statsFiller.SerializeToProto(*ev->Record.MutableTableStats());
тогда при добавлении объектов все будет происходить локально внутри TTableStatsBuilder

  • Counters заполняют свои поля самостоятельно ОДНИМ методом из Counters

auto* tableStats = periodicTableStats->MutableTableStats();
FillTxTableStats(tableStats);
ConfigureStats(*columnStats, tableStats);
TTableStatsBuilder statsBuilder(*periodicTableStats->MutableTableStats());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Аналогично пред. комментарию.

ConfigureStats(*columnStats, tableStats);
TTableStatsBuilder statsBuilder(*periodicTableStats->MutableTableStats());
statsBuilder.FillColumnTableStats(*Counters.GetColumnTablesCounters()->GetPathIdCounter(pathId));
statsBuilder.FillTabletStats(*Counters.GetTabletCounters());
Copy link
Collaborator

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.

пока-что, лучше, данные по таблице, не относящиеся к таблице убрать.

@swalrus1 swalrus1 merged commit c0c6ab2 into ydb-platform:main Aug 1, 2024
8 of 12 checks passed
@swalrus1 swalrus1 deleted the add-missing-table-stats branch September 3, 2024 15:01
swalrus1 added a commit to swalrus1/ydb that referenced this pull request Sep 3, 2024
swalrus1 added a commit to swalrus1/ydb that referenced this pull request Sep 3, 2024
swalrus1 added a commit to swalrus1/ydb that referenced this pull request Sep 4, 2024
zverevgeny pushed a commit to zverevgeny/ydb that referenced this pull request Sep 9, 2024
zverevgeny pushed a commit to zverevgeny/ydb that referenced this pull request Sep 10, 2024
zverevgeny pushed a commit to zverevgeny/ydb that referenced this pull request Sep 11, 2024
zverevgeny pushed a commit to zverevgeny/ydb that referenced this pull request Sep 12, 2024
zverevgeny pushed a commit to zverevgeny/ydb that referenced this pull request Sep 14, 2024
zverevgeny pushed a commit to zverevgeny/ydb that referenced this pull request Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report Table Stats for column tables
2 participants