@@ -148,6 +148,7 @@ class TConfigureParts : public TSubOperationState {
148
148
class TPropose : public TSubOperationState {
149
149
private:
150
150
TOperationId OperationId;
151
+ TTxState::ETxState& NextState;
151
152
152
153
TString DebugHint () const override {
153
154
return TStringBuilder ()
@@ -156,8 +157,9 @@ class TPropose: public TSubOperationState {
156
157
}
157
158
158
159
public:
159
- TPropose (TOperationId id)
160
+ TPropose (TOperationId id, TTxState::ETxState& nextState )
160
161
: OperationId(id)
162
+ , NextState(nextState)
161
163
{
162
164
IgnoreMessages (DebugHint (), {
163
165
TEvHive::TEvCreateTabletReply::EventType, NSequenceShard::TEvSequenceShard::TEvCreateSequenceResult::EventType
@@ -178,8 +180,10 @@ class TPropose: public TSubOperationState {
178
180
}
179
181
Y_ABORT_UNLESS (txState->TxType == TTxState::TxMoveSequence);
180
182
183
+ auto srcPath = TPath::Init (txState->SourcePathId , context.SS );
184
+ auto dstPath = TPath::Init (txState->TargetPathId , context.SS );
185
+
181
186
TPathId pathId = txState->TargetPathId ;
182
- TPathElement::TPtr path = context.SS ->PathsById .at (pathId);
183
187
184
188
Y_VERIFY_S (context.SS ->Sequences .contains (pathId), " Sequence not found. PathId: " << pathId);
185
189
TSequenceInfo::TPtr sequenceInfo = context.SS ->Sequences .at (pathId);
@@ -196,20 +200,15 @@ class TPropose: public TSubOperationState {
196
200
context.SS ->PersistSequenceAlterRemove (db, pathId);
197
201
context.SS ->PersistSequence (db, pathId, *alterData);
198
202
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);
206
205
207
- context.SS ->ClearDescribePathCaches (path);
208
- context.OnComplete .PublishToSchemeBoard (OperationId, pathId);
206
+ dstPath.DomainInfo ()->IncPathsInside ();
209
207
210
- path-> StepCreated = step ;
211
- context. SS -> PersistCreateStep (db, path-> PathId , step );
208
+ dstPath. Activate () ;
209
+ IncParentDirAlterVersionWithRepublish (OperationId, dstPath, context );
212
210
211
+ NextState = TTxState::WaitShadowPathPublication;
213
212
context.SS ->ChangeTxState (db, OperationId, TTxState::WaitShadowPathPublication);
214
213
return true ;
215
214
}
@@ -238,7 +237,7 @@ class TWaitRenamedPathPublication: public TSubOperationState {
238
237
239
238
TString DebugHint () const override {
240
239
return TStringBuilder ()
241
- << " TMoveTableIndex TWaitRenamedPathPublication"
240
+ << " TMoveSequence TWaitRenamedPathPublication"
242
241
<< " operationId: " << OperationId;
243
242
}
244
243
@@ -307,7 +306,7 @@ class TDeleteTableBarrier: public TSubOperationState {
307
306
308
307
TString DebugHint () const override {
309
308
return TStringBuilder ()
310
- << " TMoveTableIndex TDeleteTableBarrier"
309
+ << " TMoveSequence TDeleteTableBarrier"
311
310
<< " operationId: " << OperationId;
312
311
}
313
312
@@ -706,6 +705,7 @@ class TDone: public TSubOperationState {
706
705
};
707
706
708
707
class TMoveSequence : public TSubOperation {
708
+ TTxState::ETxState AfterPropose = TTxState::Invalid;
709
709
710
710
static TTxState::ETxState NextState () {
711
711
return TTxState::CreateParts;
@@ -719,7 +719,7 @@ class TMoveSequence: public TSubOperation {
719
719
case TTxState::ConfigureParts:
720
720
return TTxState::Propose;
721
721
case TTxState::Propose:
722
- return TTxState::WaitShadowPathPublication ;
722
+ return AfterPropose ;
723
723
case TTxState::WaitShadowPathPublication:
724
724
return TTxState::DeletePathBarrier;
725
725
case TTxState::DeletePathBarrier:
@@ -743,7 +743,7 @@ class TMoveSequence: public TSubOperation {
743
743
case TTxState::ConfigureParts:
744
744
return TPtr (new TConfigureParts (OperationId));
745
745
case TTxState::Propose:
746
- return TPtr (new TPropose (OperationId));
746
+ return TPtr (new TPropose (OperationId, AfterPropose ));
747
747
case TTxState::WaitShadowPathPublication:
748
748
return MakeHolder<TWaitRenamedPathPublication>(OperationId);
749
749
case TTxState::DeletePathBarrier:
@@ -772,7 +772,7 @@ class TMoveSequence: public TSubOperation {
772
772
const TString& dstPathStr = moveSequence.GetDstPath ();
773
773
774
774
LOG_NOTICE_S (context.Ctx , NKikimrServices::FLAT_TX_SCHEMESHARD,
775
- " TMoveTableIndex Propose"
775
+ " TMoveSequence Propose"
776
776
<< " , from: " << srcPathStr
777
777
<< " , to: " << dstPathStr
778
778
<< " , opId: " << OperationId
@@ -952,7 +952,7 @@ class TMoveSequence: public TSubOperation {
952
952
953
953
TTxState& txState =
954
954
context.SS ->CreateTx (OperationId, TTxState::TxMoveSequence, dstPath.Base ()->PathId , srcPath.Base ()->PathId );
955
- txState.State = TTxState::Propose ;
955
+ txState.State = TTxState::CreateParts ;
956
956
957
957
Y_ABORT_UNLESS (context.SS ->Sequences .contains (srcPath.Base ()->PathId ));
958
958
TSequenceInfo::TPtr srcSequence = context.SS ->Sequences .at (srcPath.Base ()->PathId );
0 commit comments