@@ -95,13 +95,13 @@ bool TTablesManager::InitFromDB(NIceDb::TNiceDb& db) {
95
95
return false ;
96
96
}
97
97
98
- THashMap<ui64, TRowVersion > lastVersion;
98
+ THashMap<ui64, NOlap::TSnapshot > lastVersion;
99
99
while (!rowset.EndOfSet ()) {
100
100
const ui64 pathId = rowset.GetValue <Schema::TableVersionInfo::PathId>();
101
101
Y_ABORT_UNLESS (Tables.contains (pathId));
102
- TRowVersion version (
102
+ NOlap::TSnapshot version (
103
103
rowset.GetValue <Schema::TableVersionInfo::SinceStep>(),
104
- rowset.GetValue <Schema::TableVersionInfo::SinceTxId>());
104
+ rowset.GetValue <Schema::TableVersionInfo::SinceTxId>());
105
105
106
106
auto & table = Tables.at (pathId);
107
107
TTableInfo::TTableVersionInfo versionInfo;
@@ -112,10 +112,11 @@ bool TTablesManager::InitFromDB(NIceDb::TNiceDb& db) {
112
112
if (!table.IsDropped ()) {
113
113
auto & ttlSettings = versionInfo.GetTtlSettings ();
114
114
if (ttlSettings.HasEnabled ()) {
115
- if (!lastVersion.contains (pathId) || lastVersion[pathId] < version) {
115
+ auto vIt = lastVersion.find (pathId);
116
+ if (vIt == lastVersion.end () || vIt->second < version) {
116
117
TTtl::TDescription description (ttlSettings.GetEnabled ());
117
118
Ttl.SetPathTtl (pathId, std::move (description));
118
- lastVersion[ pathId] = version;
119
+ lastVersion. emplace ( pathId, version) ;
119
120
}
120
121
}
121
122
}
@@ -136,7 +137,7 @@ bool TTablesManager::InitFromDB(NIceDb::TNiceDb& db) {
136
137
const ui32 id = rowset.GetValue <Schema::SchemaPresetVersionInfo::Id>();
137
138
Y_ABORT_UNLESS (SchemaPresets.contains (id));
138
139
auto & preset = SchemaPresets.at (id);
139
- TRowVersion version (
140
+ NOlap::TSnapshot version (
140
141
rowset.GetValue <Schema::SchemaPresetVersionInfo::SinceStep>(),
141
142
rowset.GetValue <Schema::SchemaPresetVersionInfo::SinceTxId>());
142
143
@@ -208,18 +209,18 @@ ui64 TTablesManager::GetMemoryUsage() const {
208
209
return memory;
209
210
}
210
211
211
- void TTablesManager::DropTable (const ui64 pathId, const TRowVersion & version, NIceDb::TNiceDb& db) {
212
+ void TTablesManager::DropTable (const ui64 pathId, const NOlap::TSnapshot & version, NIceDb::TNiceDb& db) {
212
213
auto & table = Tables.at (pathId);
213
214
table.SetDropVersion (version);
214
215
PathsToDrop.insert (pathId);
215
216
Ttl.DropPathTtl (pathId);
216
217
if (PrimaryIndex) {
217
218
PrimaryIndex->OnTieringModified (nullptr , Ttl);
218
219
}
219
- Schema::SaveTableDropVersion (db, pathId, version.Step , version.TxId );
220
+ Schema::SaveTableDropVersion (db, pathId, version.GetPlanStep () , version.GetTxId () );
220
221
}
221
222
222
- void TTablesManager::DropPreset (const ui32 presetId, const TRowVersion & version, NIceDb::TNiceDb& db) {
223
+ void TTablesManager::DropPreset (const ui32 presetId, const NOlap::TSnapshot & version, NIceDb::TNiceDb& db) {
223
224
auto & preset = SchemaPresets.at (presetId);
224
225
Y_ABORT_UNLESS (preset.GetName () != " default" , " Cannot drop the default preset" );
225
226
preset.SetDropVersion (version);
@@ -247,14 +248,14 @@ bool TTablesManager::RegisterSchemaPreset(const TSchemaPreset& schemaPreset, NIc
247
248
return true ;
248
249
}
249
250
250
- void TTablesManager::AddSchemaVersion (const ui32 presetId, const TRowVersion & version, const NKikimrSchemeOp::TColumnTableSchema& schema, NIceDb::TNiceDb& db) {
251
+ void TTablesManager::AddSchemaVersion (const ui32 presetId, const NOlap::TSnapshot & version, const NKikimrSchemeOp::TColumnTableSchema& schema, NIceDb::TNiceDb& db) {
251
252
Y_ABORT_UNLESS (SchemaPresets.contains (presetId));
252
253
auto preset = SchemaPresets.at (presetId);
253
254
254
255
TSchemaPreset::TSchemaPresetVersionInfo versionInfo;
255
256
versionInfo.SetId (presetId);
256
- versionInfo.SetSinceStep (version.Step );
257
- versionInfo.SetSinceTxId (version.TxId );
257
+ versionInfo.SetSinceStep (version.GetPlanStep () );
258
+ versionInfo.SetSinceTxId (version.GetTxId () );
258
259
*versionInfo.MutableSchema () = schema;
259
260
260
261
auto & schemaPreset = SchemaPresets.at (presetId);
@@ -268,7 +269,7 @@ void TTablesManager::AddSchemaVersion(const ui32 presetId, const TRowVersion& ve
268
269
}
269
270
}
270
271
271
- void TTablesManager::AddTableVersion (const ui64 pathId, const TRowVersion & version, const TTableInfo::TTableVersionInfo& versionInfo, NIceDb::TNiceDb& db) {
272
+ void TTablesManager::AddTableVersion (const ui64 pathId, const NOlap::TSnapshot & version, const TTableInfo::TTableVersionInfo& versionInfo, NIceDb::TNiceDb& db) {
272
273
auto & table = Tables.at (pathId);
273
274
274
275
if (versionInfo.HasSchemaPresetId ()) {
@@ -300,8 +301,7 @@ void TTablesManager::AddTableVersion(const ui64 pathId, const TRowVersion& versi
300
301
table.AddVersion (version, versionInfo);
301
302
}
302
303
303
- void TTablesManager::IndexSchemaVersion (const TRowVersion& version, const NKikimrSchemeOp::TColumnTableSchema& schema) {
304
- NOlap::TSnapshot snapshot{version.Step , version.TxId };
304
+ void TTablesManager::IndexSchemaVersion (const NOlap::TSnapshot& snapshot, const NKikimrSchemeOp::TColumnTableSchema& schema) {
305
305
NOlap::TIndexInfo indexInfo = DeserializeIndexInfoFromProto (schema);
306
306
indexInfo.SetAllKeys ();
307
307
const bool isFirstPrimaryIndexInitialization = !PrimaryIndex;
@@ -341,7 +341,7 @@ bool TTablesManager::TryFinalizeDropPath(NTabletFlatExecutor::TTransactionContex
341
341
NIceDb::TNiceDb db (txc.DB );
342
342
NColumnShard::Schema::EraseTableInfo (db, pathId);
343
343
const auto & table = Tables.find (pathId);
344
- Y_ABORT_UNLESS (table != Tables.end (), " No schema for path %lu" , pathId);
344
+ Y_ABORT_UNLESS (table != Tables.end (), " No schema for path %lu" , pathId);
345
345
for (auto && tableVersion : table->second .GetVersions ()) {
346
346
NColumnShard::Schema::EraseTableVersionInfo (db, pathId, tableVersion.first );
347
347
}
0 commit comments