|
| 1 | +#include "schemeshard__operation_alter_cdc_stream.h" |
| 2 | + |
1 | 3 | #include "schemeshard__operation_part.h" |
2 | 4 | #include "schemeshard__operation_common.h" |
3 | 5 | #include "schemeshard_impl.h" |
@@ -471,6 +473,40 @@ class TAlterCdcStreamAtTable: public TSubOperation { |
471 | 473 |
|
472 | 474 | } // anonymous |
473 | 475 |
|
| 476 | +namespace NCdc { |
| 477 | + |
| 478 | +void DoAlterStream( |
| 479 | + const NKikimrSchemeOp::TAlterCdcStream& op, |
| 480 | + const TOperationId& opId, |
| 481 | + const TPath& workingDirPath, |
| 482 | + const TPath& tablePath, |
| 483 | + TVector<ISubOperation::TPtr>& result) |
| 484 | +{ |
| 485 | + { |
| 486 | + auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl); |
| 487 | + outTx.MutableAlterCdcStream()->CopyFrom(op); |
| 488 | + |
| 489 | + if (op.HasGetReady()) { |
| 490 | + outTx.MutableLockGuard()->SetOwnerTxId(op.GetGetReady().GetLockTxId()); |
| 491 | + } |
| 492 | + |
| 493 | + result.push_back(CreateAlterCdcStreamImpl(NextPartId(opId, result), outTx)); |
| 494 | + } |
| 495 | + |
| 496 | + { |
| 497 | + auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable); |
| 498 | + outTx.MutableAlterCdcStream()->CopyFrom(op); |
| 499 | + |
| 500 | + if (op.HasGetReady()) { |
| 501 | + outTx.MutableLockGuard()->SetOwnerTxId(op.GetGetReady().GetLockTxId()); |
| 502 | + } |
| 503 | + |
| 504 | + result.push_back(CreateAlterCdcStreamAtTable(NextPartId(opId, result), outTx, op.HasGetReady())); |
| 505 | + } |
| 506 | +} |
| 507 | + |
| 508 | +} // namespace NCdc |
| 509 | + |
474 | 510 | ISubOperation::TPtr CreateAlterCdcStreamImpl(TOperationId id, const TTxTransaction& tx) { |
475 | 511 | return MakeSubOperation<TAlterCdcStream>(id, tx); |
476 | 512 | } |
@@ -547,27 +583,7 @@ TVector<ISubOperation::TPtr> CreateAlterCdcStream(TOperationId opId, const TTxTr |
547 | 583 |
|
548 | 584 | TVector<ISubOperation::TPtr> result; |
549 | 585 |
|
550 | | - { |
551 | | - auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl); |
552 | | - outTx.MutableAlterCdcStream()->CopyFrom(op); |
553 | | - |
554 | | - if (op.HasGetReady()) { |
555 | | - outTx.MutableLockGuard()->SetOwnerTxId(op.GetGetReady().GetLockTxId()); |
556 | | - } |
557 | | - |
558 | | - result.push_back(CreateAlterCdcStreamImpl(NextPartId(opId, result), outTx)); |
559 | | - } |
560 | | - |
561 | | - { |
562 | | - auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable); |
563 | | - outTx.MutableAlterCdcStream()->CopyFrom(op); |
564 | | - |
565 | | - if (op.HasGetReady()) { |
566 | | - outTx.MutableLockGuard()->SetOwnerTxId(op.GetGetReady().GetLockTxId()); |
567 | | - } |
568 | | - |
569 | | - result.push_back(CreateAlterCdcStreamAtTable(NextPartId(opId, result), outTx, op.HasGetReady())); |
570 | | - } |
| 586 | + NCdc::DoAlterStream(op, opId, workingDirPath, tablePath, result); |
571 | 587 |
|
572 | 588 | if (op.HasGetReady()) { |
573 | 589 | auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropLock); |
|
0 commit comments