Skip to content

Commit e250218

Browse files
authored
fix check MaxInternalPathId (#20071)
1 parent ddcd276 commit e250218

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ydb/core/tx/columnshard/tables_manager.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ bool TTablesManager::InitFromDB(NIceDb::TNiceDb& db) {
7878
if (!Schema::GetSpecialValueOpt(db, Schema::EValueIds::MaxInternalPathId, maxPathId)) {
7979
return false;
8080
}
81-
if (maxPathId) {
81+
if (GenerateInternalPathId && maxPathId) {
8282
MaxInternalPathId =TInternalPathId::FromRawValue(*maxPathId);
8383
AFL_VERIFY(MaxInternalPathId >= GetInitialMaxInternalPathId(TabletId));
8484
}
@@ -246,8 +246,7 @@ bool TTablesManager::HasTable(const TInternalPathId pathId, const bool withDelet
246246
}
247247

248248
TInternalPathId TTablesManager::CreateInternalPathId(const TSchemeShardLocalPathId schemeShardLocalPathId) {
249-
if (NYDBTest::TControllers::GetColumnShardController()->IsForcedGenerateInternalPathId() ||
250-
AppData()->ColumnShardConfig.GetGenerateInternalPathId()) {
249+
if (GenerateInternalPathId) {
251250
const auto result = TInternalPathId::FromRawValue(MaxInternalPathId.GetRawValue() + 1);
252251
MaxInternalPathId = result;
253252
return result;
@@ -306,7 +305,9 @@ void TTablesManager::RegisterTable(TTableInfo&& table, NIceDb::TNiceDb& db) {
306305
AFL_VERIFY(Tables.emplace(pathId, std::move(table)).second)("path_id", pathId)("size", Tables.size());
307306
AFL_VERIFY(SchemeShardLocalToInternal.emplace(table.GetPathId().SchemeShardLocalPathId, table.GetPathId().InternalPathId).second);
308307
Schema::SaveTableSchemeShardLocalPathId(db, table.GetPathId().InternalPathId, table.GetPathId().SchemeShardLocalPathId);
309-
Schema::SaveSpecialValue(db, Schema::EValueIds::MaxInternalPathId, MaxInternalPathId.GetRawValue());
308+
if (GenerateInternalPathId) {
309+
Schema::SaveSpecialValue(db, Schema::EValueIds::MaxInternalPathId, MaxInternalPathId.GetRawValue());
310+
}
310311
if (PrimaryIndex) {
311312
PrimaryIndex->RegisterTable(pathId);
312313
}
@@ -405,6 +406,10 @@ TTablesManager::TTablesManager(const std::shared_ptr<NOlap::IStoragesManager>& s
405406
, SchemaObjectsCache(schemaCache)
406407
, PortionsStats(portionsStats)
407408
, TabletId(tabletId)
409+
, GenerateInternalPathId(
410+
AppData()->ColumnShardConfig.GetGenerateInternalPathId() ||
411+
NYDBTest::TControllers::GetColumnShardController()->IsForcedGenerateInternalPathId()
412+
)
408413
, MaxInternalPathId(GetInitialMaxInternalPathId(TabletId)) {
409414
}
410415

ydb/core/tx/columnshard/tables_manager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ class TTablesManager: public NOlap::IPathIdTranslator {
216216
NBackgroundTasks::TControlInterfaceContainer<NOlap::TSchemaObjectsCache> SchemaObjectsCache;
217217
std::shared_ptr<TPortionIndexStats> PortionsStats;
218218
ui64 TabletId = 0;
219+
bool GenerateInternalPathId;
219220
TInternalPathId MaxInternalPathId;
220221

221222
friend class TTxInit;

0 commit comments

Comments
 (0)