Skip to content

Commit c0cae6c

Browse files
committed
Fix shard key types verify in SS monitoring (#19632)
1 parent f0def09 commit c0cae6c

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

ydb/core/tx/schemeshard/schemeshard__monitoring.cpp

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,20 @@ struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBas
872872

873873
}
874874

875-
TVector<NScheme::TTypeInfo> keyTypes;
876-
if (Self->Tables.contains(info.TablePathId)) {
877-
TTableInfo::TPtr tableInfo = Self->Tables.at(info.TablePathId);
878-
for (ui32 keyPos: tableInfo->KeyColumnIds) {
879-
keyTypes.push_back(tableInfo->Columns.at(keyPos).PType);
875+
auto getKeyTypes = [&](TPathId pathId) {
876+
TVector<NScheme::TTypeInfo> keyTypes;
877+
878+
auto tableInfo = Self->Tables.FindPtr(pathId);
879+
if (!tableInfo) {
880+
return keyTypes;
881+
}
882+
883+
for (ui32 keyPos: tableInfo->Get()->KeyColumnIds) {
884+
keyTypes.push_back(tableInfo->Get()->Columns.at(keyPos).PType);
880885
}
881-
}
886+
887+
return keyTypes;
888+
};
882889

883890
{
884891
TAG(TH3) {str << "Shards : " << info.Shards.size() << "\n";}
@@ -907,23 +914,31 @@ struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBas
907914
if (Self->ShardInfos.contains(idx)) {
908915
str << Self->ShardInfos.at(idx).TabletID;
909916
} else {
910-
str << "shard " << idx << " has been dropped";
917+
str << "deleted shard";
911918
}
912919
}
913920
TABLED() {
914-
if (keyTypes) {
915-
str << DebugPrintRange(keyTypes, status.Range.ToTableRange(), *AppData()->TypeRegistry);
921+
if (Self->ShardInfos.contains(idx)) {
922+
if (auto keyTypes = getKeyTypes(Self->ShardInfos.at(idx).PathId)) {
923+
str << DebugPrintRange(keyTypes, status.Range.ToTableRange(), *AppData()->TypeRegistry);
924+
} else {
925+
str << "deleted table";
926+
}
916927
} else {
917-
str << "table has been dropped";
928+
str << "deleted shard";
918929
}
919930
}
920931
TABLED() {
921-
if (keyTypes) {
922-
TSerializedCellVec vec;
923-
vec.Parse(status.LastKeyAck);
924-
str << DebugPrintPoint(keyTypes, vec.GetCells(), *AppData()->TypeRegistry);
932+
if (Self->ShardInfos.contains(idx)) {
933+
if (auto keyTypes = getKeyTypes(Self->ShardInfos.at(idx).PathId)) {
934+
TSerializedCellVec vec;
935+
vec.Parse(status.LastKeyAck);
936+
str << DebugPrintPoint(keyTypes, vec.GetCells(), *AppData()->TypeRegistry);
937+
} else {
938+
str << "deleted table";
939+
}
925940
} else {
926-
str << "table has been dropped";
941+
str << "deleted shard";
927942
}
928943
}
929944
TABLED() {

0 commit comments

Comments
 (0)