Skip to content

Commit 99f69af

Browse files
committed
fix lock
1 parent 2a4ec1d commit 99f69af

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,19 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropBuildPropose(
265265
auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo.ApplyTxId), ss->TabletID());
266266
propose->Record.SetFailOnExist(true);
267267

268-
auto path = TPath::Init(buildInfo.TablePathId, ss).Dive(buildInfo.IndexName);
268+
auto path = TPath::Init(buildInfo.TablePathId, ss)
269+
.Dive(buildInfo.IndexName)
270+
.Dive(buildInfo.KMeans.WriteTo(true));
269271

270272
NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
271273
modifyScheme.SetInternal(true);
272-
modifyScheme.SetWorkingDir(path.PathString());
273-
if (path.LockedBy()) {
274+
modifyScheme.SetWorkingDir(path.Parent().PathString());
275+
if (path.IsLocked()) {
274276
modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo.LockTxId));
275277
}
276278

277279
modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
278-
modifyScheme.MutableDrop()->SetName(buildInfo.KMeans.WriteTo(true));
280+
modifyScheme.MutableDrop()->SetName(path->Name);
279281

280282
LOG_DEBUG_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX,
281283
"DropBuildPropose " << buildInfo.Id << " " << buildInfo.State << " " << propose->Record.ShortDebugString());
@@ -474,9 +476,7 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CancelPropose(
474476
NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
475477
modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCancelIndexBuild);
476478
modifyScheme.SetInternal(true);
477-
478479
modifyScheme.SetWorkingDir(TPath::Init(buildInfo.DomainPathId, ss).PathString());
479-
480480
modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo.LockTxId));
481481

482482
auto& indexBuild = *modifyScheme.MutableCancelIndexBuild();
@@ -1328,12 +1328,12 @@ struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuil
13281328
auto path = GetBuildPath(Self, buildInfo, buildInfo.KMeans.ReadFrom());
13291329
table = Self->Tables.at(path->PathId);
13301330

1331-
if (!path.IsLocked()) {
1332-
// lock is needed to prevent its shards from beeing split
1331+
if (!path.IsLocked()) { // lock is needed to prevent its shards from beeing split
13331332
ChangeState(buildInfo.Id, TIndexBuildInfo::EState::LockBuild);
13341333
Progress(buildInfo.Id);
13351334
return false;
13361335
}
1336+
Y_ASSERT(path.LockedBy() == buildInfo.LockTxId);
13371337
}
13381338
auto tableColumns = NTableIndex::ExtractInfo(table); // skip dropped columns
13391339
TSerializedTableRange shardRange = InfiniteRange(tableColumns.Keys.size());

0 commit comments

Comments
 (0)