Skip to content

Commit 2dc7acb

Browse files
committed
Show KMeans state & Sample in monitoring (#19592)
1 parent 05ccfa6 commit 2dc7acb

File tree

2 files changed

+91
-78
lines changed

2 files changed

+91
-78
lines changed

ydb/core/tx/schemeshard/schemeshard__monitoring.cpp

Lines changed: 75 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -812,61 +812,63 @@ struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBas
812812
const auto& info = *indexInfoPtr->Get();
813813
TAG(TH4) {str << "Fields";}
814814
PRE () {
815-
str << "BuildInfoId: " << info.Id << Endl
816-
<< "Uid: " << info.Uid << Endl
815+
str << "BuildInfoId: " << info.Id << Endl
816+
<< "Uid: " << info.Uid << Endl
817817

818-
<< "CancelRequested: " << (info.CancelRequested ? "YES" : "NO") << Endl
818+
<< "CancelRequested: " << (info.CancelRequested ? "YES" : "NO") << Endl
819819

820-
<< "State: " << info.State << Endl
821-
<< "IsBroken: " << info.IsBroken << Endl
822-
<< "Issue: " << info.GetIssue() << Endl
820+
<< "State: " << info.State << Endl
821+
<< "KMeans: " << info.KMeans.DebugString() << Endl
822+
<< "Sample: " << info.Sample.DebugString() << Endl
823+
<< "IsBroken: " << info.IsBroken << Endl
824+
<< "Issue: " << info.GetIssue() << Endl
823825

824-
<< "Shards.size: " << info.Shards.size() << Endl
825-
<< "ToUploadShards.size: " << info.ToUploadShards.size() << Endl
826-
<< "DoneShards.size: " << info.DoneShards.size() << Endl
827-
<< "InProgressShards.size: " << info.InProgressShards.size() << Endl
826+
<< "Shards.size: " << info.Shards.size() << Endl
827+
<< "ToUploadShards.size: " << info.ToUploadShards.size() << Endl
828+
<< "DoneShards.size: " << info.DoneShards.size() << Endl
829+
<< "InProgressShards.size: " << info.InProgressShards.size() << Endl
828830

829-
<< "DomainPathId: " << LinkToPathInfo(info.DomainPathId) << Endl
830-
<< "DomainPath: " << TPath::Init(info.DomainPathId, Self).PathString() << Endl
831+
<< "DomainPathId: " << LinkToPathInfo(info.DomainPathId) << Endl
832+
<< "DomainPath: " << TPath::Init(info.DomainPathId, Self).PathString() << Endl
831833

832-
<< "TablePathId: " << LinkToPathInfo(info.TablePathId) << Endl
833-
<< "TablePath: " << TPath::Init(info.TablePathId, Self).PathString() << Endl
834+
<< "TablePathId: " << LinkToPathInfo(info.TablePathId) << Endl
835+
<< "TablePath: " << TPath::Init(info.TablePathId, Self).PathString() << Endl
834836

835-
<< "IndexType: " << NKikimrSchemeOp::EIndexType_Name(info.IndexType) << Endl
837+
<< "IndexType: " << NKikimrSchemeOp::EIndexType_Name(info.IndexType) << Endl
836838

837-
<< "IndexName: " << info.IndexName << Endl;
839+
<< "IndexName: " << info.IndexName << Endl;
838840

839-
for (const auto& column: info.IndexColumns) {
840-
str << "IndexColumns: " << column << Endl;
841-
}
841+
for (const auto& column: info.IndexColumns) {
842+
str << "IndexColumns: " << column << Endl;
843+
}
842844

843-
str << "Subscribers.size: " << info.Subscribers.size() << Endl
845+
str << "Subscribers.size: " << info.Subscribers.size() << Endl
844846

845-
<< "AlterMainTableTxId: " << info.AlterMainTableTxId << Endl
846-
<< "AlterMainTableTxStatus: " << NKikimrScheme::EStatus_Name(info.AlterMainTableTxStatus) << Endl
847-
<< "AlterMainTableTxDone: " << (info.AlterMainTableTxDone ? "DONE": "not done") << Endl
847+
<< "AlterMainTableTxId: " << info.AlterMainTableTxId << Endl
848+
<< "AlterMainTableTxStatus: " << NKikimrScheme::EStatus_Name(info.AlterMainTableTxStatus) << Endl
849+
<< "AlterMainTableTxDone: " << (info.AlterMainTableTxDone ? "DONE": "not done") << Endl
848850

849-
<< "LockTxId: " << info.LockTxId << Endl
850-
<< "LockTxStatus: " << NKikimrScheme::EStatus_Name(info.LockTxStatus) << Endl
851+
<< "LockTxId: " << info.LockTxId << Endl
852+
<< "LockTxStatus: " << NKikimrScheme::EStatus_Name(info.LockTxStatus) << Endl
851853
<< "LockTxDone " << (info.LockTxDone ? "DONE" : "not done") << Endl
852854

853-
<< "InitiateTxId: " << info.InitiateTxId << Endl
854-
<< "InitiateTxStatus: " << NKikimrScheme::EStatus_Name(info.InitiateTxStatus) << Endl
855+
<< "InitiateTxId: " << info.InitiateTxId << Endl
856+
<< "InitiateTxStatus: " << NKikimrScheme::EStatus_Name(info.InitiateTxStatus) << Endl
855857
<< "InitiateTxDone " << (info.InitiateTxDone ? "DONE" : "not done") << Endl
856858

857-
<< "ApplyTxId: " << info.ApplyTxId << Endl
858-
<< "ApplyTxStatus: " << NKikimrScheme::EStatus_Name(info.ApplyTxStatus) << Endl
859+
<< "ApplyTxId: " << info.ApplyTxId << Endl
860+
<< "ApplyTxStatus: " << NKikimrScheme::EStatus_Name(info.ApplyTxStatus) << Endl
859861
<< "ApplyTxDone " << (info.ApplyTxDone ? "DONE" : "not done") << Endl
860862

861-
<< "UnlockTxId: " << info.UnlockTxId << Endl
862-
<< "UnlockTxStatus: " << NKikimrScheme::EStatus_Name(info.UnlockTxStatus) << Endl
863+
<< "UnlockTxId: " << info.UnlockTxId << Endl
864+
<< "UnlockTxStatus: " << NKikimrScheme::EStatus_Name(info.UnlockTxStatus) << Endl
863865
<< "UnlockTxDone " << (info.UnlockTxDone ? "DONE" : "not done") << Endl
864866

865-
<< "SnapshotStep: " << info.SnapshotStep << Endl
866-
<< "SnapshotTxId: " << info.SnapshotTxId << Endl
867+
<< "SnapshotStep: " << info.SnapshotStep << Endl
868+
<< "SnapshotTxId: " << info.SnapshotTxId << Endl
867869

868-
<< "Processed: " << info.Processed << Endl
869-
<< "Billed: " << info.Billed << Endl;
870+
<< "Processed: " << info.Processed << Endl
871+
<< "Billed: " << info.Billed << Endl;
870872

871873
}
872874

@@ -1047,10 +1049,10 @@ struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBas
10471049

10481050
TAG(TH4) {str << "Shard idx " << shardIdx << "</a>";}
10491051
PRE () {
1050-
str << "TabletID: " << shard.TabletID<< Endl
1051-
<< "CurrentTxId: " << shard.CurrentTxId << Endl
1052-
<< "PathId: " << LinkToPathInfo(shard.PathId) << Endl
1053-
<< "TabletType: " << TTabletTypes::TypeToStr(shard.TabletType) << Endl;
1052+
str << "TabletID: " << shard.TabletID<< Endl
1053+
<< "CurrentTxId: " << shard.CurrentTxId << Endl
1054+
<< "PathId: " << LinkToPathInfo(shard.PathId) << Endl
1055+
<< "TabletType: " << TTabletTypes::TypeToStr(shard.TabletType) << Endl;
10541056
}
10551057

10561058
TAG(TH4) {str << "BindedChannels for shard idx " << shardIdx << "</a>";}
@@ -1120,25 +1122,25 @@ struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBas
11201122

11211123
TAG(TH4) {str << "Path info " << pathId << "</a>";}
11221124
PRE () {
1123-
str << "Path: " << Self->PathToString(path) << Endl
1124-
<< "PathId: " << pathId << Endl
1125-
<< "Parent Path Id: " << LinkToPathInfo(path->ParentPathId) << Endl
1126-
<< "Name: " << path->Name << Endl
1127-
<< "Owner: " << path->Owner << Endl
1128-
<< "ACL: " << localACL.ToString() << Endl
1129-
<< "ACLVersion: " << path->ACLVersion << Endl
1130-
<< "EffectiveACL: " << effectiveACL.ToString() << Endl
1131-
<< "Path Type: " << NKikimrSchemeOp::EPathType_Name(path->PathType) << Endl
1132-
<< "Path State: " << NKikimrSchemeOp::EPathState_Name(path->PathState) << Endl
1133-
<< "Created step: " << path->StepCreated << Endl
1134-
<< "Dropped step: " << path->StepDropped << Endl
1135-
<< "Created tx: " << path->CreateTxId << Endl
1136-
<< "Dropped tx: " << path->DropTxId << Endl
1137-
<< "Last tx: " << path->LastTxId << Endl
1125+
str << "Path: " << Self->PathToString(path) << Endl
1126+
<< "PathId: " << pathId << Endl
1127+
<< "Parent Path Id: " << LinkToPathInfo(path->ParentPathId) << Endl
1128+
<< "Name: " << path->Name << Endl
1129+
<< "Owner: " << path->Owner << Endl
1130+
<< "ACL: " << localACL.ToString() << Endl
1131+
<< "ACLVersion: " << path->ACLVersion << Endl
1132+
<< "EffectiveACL: " << effectiveACL.ToString() << Endl
1133+
<< "Path Type: " << NKikimrSchemeOp::EPathType_Name(path->PathType) << Endl
1134+
<< "Path State: " << NKikimrSchemeOp::EPathState_Name(path->PathState) << Endl
1135+
<< "Created step: " << path->StepCreated << Endl
1136+
<< "Dropped step: " << path->StepDropped << Endl
1137+
<< "Created tx: " << path->CreateTxId << Endl
1138+
<< "Dropped tx: " << path->DropTxId << Endl
1139+
<< "Last tx: " << path->LastTxId << Endl
11381140
<< "Has PreSerializedChildrenListing: " << !path->PreSerializedChildrenListing.empty() << Endl
1139-
<< "Children count: " << path->GetChildren().size() << Endl
1140-
<< "Alive children count: " << path->GetAliveChildren() << Endl
1141-
<< "Dir alter version: " << path->DirAlterVersion << Endl
1141+
<< "Children count: " << path->GetChildren().size() << Endl
1142+
<< "Alive children count: " << path->GetAliveChildren() << Endl
1143+
<< "Dir alter version: " << path->DirAlterVersion << Endl
11421144
<< "User attrs alter version " << path->UserAttrs->AlterVersion << Endl
11431145
<< "User attrs count " << path->UserAttrs->Attrs.size() << Endl
11441146
<< "DbRefCount count " << path->DbRefCount << Endl
@@ -1256,22 +1258,22 @@ struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBas
12561258

12571259
TAG(TH4) {str << "TxState info " << opId << "</a>";}
12581260
PRE () {
1259-
str << "TxType: " << TTxState::TypeName(txState.TxType) << Endl
1260-
<< "TargetPathId: " << LinkToPathInfo(txState.TargetPathId) << Endl
1261-
<< "SourcePathId: " << LinkToPathInfo(txState.SourcePathId) << Endl
1262-
<< "State: " << TTxState::StateName(txState.State) << Endl
1263-
<< "MinStep: " << txState.MinStep << Endl
1264-
<< "ReadyForNotifications: " << txState.ReadyForNotifications << Endl
1265-
<< "DataTotalSize: " << txState.DataTotalSize << Endl
1266-
<< "TxShardsListFinalized: " << txState.TxShardsListFinalized << Endl
1267-
<< "SchemeOpSeqNo: " << txState.SchemeOpSeqNo.Generation << ":" << txState.SchemeOpSeqNo.Round << Endl
1268-
<< "StartTime: " << txState.StartTime << Endl
1269-
<< "Shards count: " << txState.Shards.size() << Endl
1270-
<< "Shards in progress count: " << txState.ShardsInProgress.size() << Endl
1271-
<< "SchemeChangeNotificationReceived count: " << txState.SchemeChangeNotificationReceived.size() << Endl
1272-
<< "SplitDescription: " << (txState.SplitDescription ? txState.SplitDescription->ShortDebugString() : "") << Endl
1273-
<< "Dependent operations count: " << operation->DependentOperations.size() << Endl
1274-
<< "Wait operations count: " << operation->WaitOperations.size() << Endl;
1261+
str << "TxType: " << TTxState::TypeName(txState.TxType) << Endl
1262+
<< "TargetPathId: " << LinkToPathInfo(txState.TargetPathId) << Endl
1263+
<< "SourcePathId: " << LinkToPathInfo(txState.SourcePathId) << Endl
1264+
<< "State: " << TTxState::StateName(txState.State) << Endl
1265+
<< "MinStep: " << txState.MinStep << Endl
1266+
<< "ReadyForNotifications: " << txState.ReadyForNotifications << Endl
1267+
<< "DataTotalSize: " << txState.DataTotalSize << Endl
1268+
<< "TxShardsListFinalized: " << txState.TxShardsListFinalized << Endl
1269+
<< "SchemeOpSeqNo: " << txState.SchemeOpSeqNo.Generation << ":" << txState.SchemeOpSeqNo.Round << Endl
1270+
<< "StartTime: " << txState.StartTime << Endl
1271+
<< "Shards count: " << txState.Shards.size() << Endl
1272+
<< "Shards in progress count: " << txState.ShardsInProgress.size() << Endl
1273+
<< "SchemeChangeNotificationReceived count: " << txState.SchemeChangeNotificationReceived.size() << Endl
1274+
<< "SplitDescription: " << (txState.SplitDescription ? txState.SplitDescription->ShortDebugString() : "") << Endl
1275+
<< "Dependent operations count: " << operation->DependentOperations.size() << Endl
1276+
<< "Wait operations count: " << operation->WaitOperations.size() << Endl;
12751277
}
12761278

12771279
TAG(TH4) {str << "Dependent operations for txId " << opId.GetTxId() << "</a>";}

ydb/core/tx/schemeshard/schemeshard_info_types.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,7 +3105,6 @@ struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
31053105

31063106
ui64 TableSize = 0;
31073107

3108-
31093108
ui64 ParentEnd() const noexcept { // included
31103109
return ChildBegin - 1;
31113110
}
@@ -3122,11 +3121,14 @@ struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
31223121

31233122
TString DebugString() const {
31243123
return TStringBuilder()
3125-
<< "{ K = " << K
3124+
<< "{ "
3125+
<< "State = " << State
31263126
<< ", Level = " << Level << " / " << Levels
3127-
<< ", Parent = [" << ParentBegin << ".." << Parent << ".." << ParentEnd()
3128-
<< "], Child = [" << ChildBegin << ".." << Child << ".." << ChildEnd()
3129-
<< "], State = " << State << " }";
3127+
<< ", K = " << K
3128+
<< ", Parent = [" << ParentBegin << ".." << Parent << ".." << ParentEnd() << "]"
3129+
<< ", Child = [" << ChildBegin << ".." << Child << ".." << ChildEnd() << "]"
3130+
<< ", TableSize = " << TableSize
3131+
<< " }";
31303132
}
31313133

31323134
bool NeedsAnotherLevel() const noexcept {
@@ -3372,6 +3374,15 @@ struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
33723374
};
33733375
EState State = EState::Collect;
33743376

3377+
TString DebugString() const {
3378+
return TStringBuilder()
3379+
<< "{ "
3380+
<< "State = " << State
3381+
<< ", Rows = " << Rows.size()
3382+
<< ", MaxProbability = " << MaxProbability
3383+
<< " }";
3384+
}
3385+
33753386
bool MakeWeakTop(ui64 k) {
33763387
// 2 * k is needed to make it linear, 2 * N at all.
33773388
// x * k approximately is x / (x - 1) * N, but with larger x more memory used

0 commit comments

Comments
 (0)