Skip to content

Commit

Permalink
Merge c27620d into a1b2d93
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Oct 30, 2024
2 parents a1b2d93 + c27620d commit 55fad61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 10 additions & 0 deletions ydb/core/tx/columnshard/engines/scheme/index_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ bool TIndexInfo::DeserializeFromProto(const NKikimrSchemeOp::TColumnTableSchema&
}

Version = schema.GetVersion();
Precalculate();
Validate();
return true;
}
Expand Down Expand Up @@ -550,10 +551,19 @@ TIndexInfo::TIndexInfo(const TIndexInfo& original, const TSchemaDiffView& diff,
if (diff.GetCompressionOptions()) {
DeserializeDefaultCompressionFromProto(*diff.GetCompressionOptions());
}
Precalculate();
Validate();
}

void TIndexInfo::Precalculate() {
UsedStorageIds = std::make_shared<std::set<TString>>();
for (auto&& i : ColumnFeatures) {
UsedStorageIds->emplace(i->GetOperator()->GetStorageId());
}
}

void TIndexInfo::Validate() const {
AFL_VERIFY(!!UsedStorageIds);
AFL_VERIFY(ColumnFeatures.size() == SchemaColumnIdsWithSpecials.size());
AFL_VERIFY(ColumnFeatures.size() == (ui32)SchemaWithSpecials->num_fields());
AFL_VERIFY(ColumnFeatures.size() == (ui32)Schema->num_fields() + IIndexInfo::SpecialColumnsCount);
Expand Down
10 changes: 4 additions & 6 deletions ydb/core/tx/columnshard/engines/scheme/index_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ struct TIndexInfo: public IIndexInfo {

std::vector<std::shared_ptr<TColumnFeatures>> ColumnFeatures;
THashMap<ui32, NIndexes::TIndexMetaContainer> Indexes;
std::shared_ptr<std::set<TString>> UsedStorageIds;

bool SchemeNeedActualization = false;
std::shared_ptr<NStorageOptimizer::IOptimizerPlannerConstructor> CompactionPlannerConstructor;
Expand Down Expand Up @@ -149,6 +150,7 @@ struct TIndexInfo: public IIndexInfo {
const std::shared_ptr<TSchemaObjectsCache>& cache) const;

void Validate() const;
void Precalculate();

bool DeserializeFromProto(const NKikimrSchemeOp::TColumnTableSchema& schema, const std::shared_ptr<IStoragesManager>& operators,
const std::shared_ptr<TSchemaObjectsCache>& cache);
Expand Down Expand Up @@ -228,15 +230,11 @@ struct TIndexInfo: public IIndexInfo {
}

std::set<TString> GetUsedStorageIds(const TString& portionTierName) const {
std::set<TString> result;
if (portionTierName && portionTierName != IStoragesManager::DefaultStorageId) {
result.emplace(portionTierName);
return { portionTierName };
} else {
for (auto&& i : ColumnFeatures) {
result.emplace(i->GetOperator()->GetStorageId());
}
return *UsedStorageIds;
}
return result;
}

const THashMap<ui32, NIndexes::TIndexMetaContainer>& GetIndexes() const {
Expand Down

0 comments on commit 55fad61

Please sign in to comment.