Skip to content

Commit 5e98e32

Browse files
committed
Fixes
1 parent 0fad848 commit 5e98e32

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

ydb/core/tx/schemeshard/schemeshard__init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3463,7 +3463,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
34633463
srcPath->DbRefCount++;
34643464
}
34653465

3466-
if (txState.TxType == TTxState::TxMoveTable || txState.TxType == TTxState::TxMoveTableIndex) {
3466+
if (txState.TxType == TTxState::TxMoveTable || txState.TxType == TTxState::TxMoveTableIndex || txState.TxType == TTxState::TxMoveSequence) {
34673467
Y_ABORT_UNLESS(txState.SourcePathId);
34683468
TPathElement::TPtr srcPath = Self->PathsById.at(txState.SourcePathId);
34693469
Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState.SourcePathId);

ydb/core/tx/schemeshard/schemeshard__operation_move_sequence.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class TConfigureParts : public TSubOperationState {
148148
class TPropose: public TSubOperationState {
149149
private:
150150
TOperationId OperationId;
151+
TTxState::ETxState& NextState;
151152

152153
TString DebugHint() const override {
153154
return TStringBuilder()
@@ -156,8 +157,9 @@ class TPropose: public TSubOperationState {
156157
}
157158

158159
public:
159-
TPropose(TOperationId id)
160+
TPropose(TOperationId id, TTxState::ETxState& nextState)
160161
: OperationId(id)
162+
, NextState(nextState)
161163
{
162164
IgnoreMessages(DebugHint(), {
163165
TEvHive::TEvCreateTabletReply::EventType, NSequenceShard::TEvSequenceShard::TEvCreateSequenceResult::EventType
@@ -178,8 +180,10 @@ class TPropose: public TSubOperationState {
178180
}
179181
Y_ABORT_UNLESS(txState->TxType == TTxState::TxMoveSequence);
180182

183+
auto srcPath = TPath::Init(txState->SourcePathId, context.SS);
184+
auto dstPath = TPath::Init(txState->TargetPathId, context.SS);
185+
181186
TPathId pathId = txState->TargetPathId;
182-
TPathElement::TPtr path = context.SS->PathsById.at(pathId);
183187

184188
Y_VERIFY_S(context.SS->Sequences.contains(pathId), "Sequence not found. PathId: " << pathId);
185189
TSequenceInfo::TPtr sequenceInfo = context.SS->Sequences.at(pathId);
@@ -196,20 +200,15 @@ class TPropose: public TSubOperationState {
196200
context.SS->PersistSequenceAlterRemove(db, pathId);
197201
context.SS->PersistSequence(db, pathId, *alterData);
198202

199-
auto parentDir = context.SS->PathsById.at(path->ParentPathId);
200-
if (parentDir->IsLikeDirectory()) {
201-
++parentDir->DirAlterVersion;
202-
context.SS->PersistPathDirAlterVersion(db, parentDir);
203-
}
204-
context.SS->ClearDescribePathCaches(parentDir);
205-
context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
203+
dstPath->StepCreated = step;
204+
context.SS->PersistCreateStep(db, pathId, step);
206205

207-
context.SS->ClearDescribePathCaches(path);
208-
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
206+
dstPath.DomainInfo()->IncPathsInside();
209207

210-
path->StepCreated = step;
211-
context.SS->PersistCreateStep(db, path->PathId, step);
208+
dstPath.Activate();
209+
IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
212210

211+
NextState = TTxState::WaitShadowPathPublication;
213212
context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
214213
return true;
215214
}
@@ -238,7 +237,7 @@ class TWaitRenamedPathPublication: public TSubOperationState {
238237

239238
TString DebugHint() const override {
240239
return TStringBuilder()
241-
<< "TMoveTableIndex TWaitRenamedPathPublication"
240+
<< "TMoveSequence TWaitRenamedPathPublication"
242241
<< " operationId: " << OperationId;
243242
}
244243

@@ -307,7 +306,7 @@ class TDeleteTableBarrier: public TSubOperationState {
307306

308307
TString DebugHint() const override {
309308
return TStringBuilder()
310-
<< "TMoveTableIndex TDeleteTableBarrier"
309+
<< "TMoveSequence TDeleteTableBarrier"
311310
<< " operationId: " << OperationId;
312311
}
313312

@@ -706,6 +705,7 @@ class TDone: public TSubOperationState {
706705
};
707706

708707
class TMoveSequence: public TSubOperation {
708+
TTxState::ETxState AfterPropose = TTxState::Invalid;
709709

710710
static TTxState::ETxState NextState() {
711711
return TTxState::CreateParts;
@@ -719,7 +719,7 @@ class TMoveSequence: public TSubOperation {
719719
case TTxState::ConfigureParts:
720720
return TTxState::Propose;
721721
case TTxState::Propose:
722-
return TTxState::WaitShadowPathPublication;
722+
return AfterPropose;
723723
case TTxState::WaitShadowPathPublication:
724724
return TTxState::DeletePathBarrier;
725725
case TTxState::DeletePathBarrier:
@@ -743,7 +743,7 @@ class TMoveSequence: public TSubOperation {
743743
case TTxState::ConfigureParts:
744744
return TPtr(new TConfigureParts(OperationId));
745745
case TTxState::Propose:
746-
return TPtr(new TPropose(OperationId));
746+
return TPtr(new TPropose(OperationId, AfterPropose));
747747
case TTxState::WaitShadowPathPublication:
748748
return MakeHolder<TWaitRenamedPathPublication>(OperationId);
749749
case TTxState::DeletePathBarrier:
@@ -772,7 +772,7 @@ class TMoveSequence: public TSubOperation {
772772
const TString& dstPathStr = moveSequence.GetDstPath();
773773

774774
LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
775-
"TMoveTableIndex Propose"
775+
"TMoveSequence Propose"
776776
<< ", from: "<< srcPathStr
777777
<< ", to: " << dstPathStr
778778
<< ", opId: " << OperationId
@@ -952,7 +952,7 @@ class TMoveSequence: public TSubOperation {
952952

953953
TTxState& txState =
954954
context.SS->CreateTx(OperationId, TTxState::TxMoveSequence, dstPath.Base()->PathId, srcPath.Base()->PathId);
955-
txState.State = TTxState::Propose;
955+
txState.State = TTxState::CreateParts;
956956

957957
Y_ABORT_UNLESS(context.SS->Sequences.contains(srcPath.Base()->PathId));
958958
TSequenceInfo::TPtr srcSequence = context.SS->Sequences.at(srcPath.Base()->PathId);

ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,21 @@ class TConfigureParts: public TSubOperationState {
9898
for (const auto& child: srcPath->GetChildren()) {
9999
auto name = child.first;
100100

101-
TPath srcIndexPath = srcPath.Child(name);
102-
Y_ABORT_UNLESS(srcIndexPath.IsResolved());
101+
TPath srcChildPath = srcPath.Child(name);
102+
Y_ABORT_UNLESS(srcChildPath.IsResolved());
103103

104-
if (srcIndexPath.IsDeleted()) {
104+
if (srcChildPath.IsDeleted()) {
105+
continue;
106+
}
107+
if (srcChildPath.IsSequence()) {
105108
continue;
106109
}
107110

108111
TPath dstIndexPath = dstPath.Child(name);
109112
Y_ABORT_UNLESS(dstIndexPath.IsResolved());
110113

111114
auto remap = move->AddReMapIndexes();
112-
PathIdFromPathId(srcIndexPath->PathId, remap->MutableSrcPathId());
115+
PathIdFromPathId(srcChildPath->PathId, remap->MutableSrcPathId());
113116
PathIdFromPathId(dstIndexPath->PathId, remap->MutableDstPathId());
114117
}
115118

0 commit comments

Comments
 (0)