Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
MBkkt committed Sep 19, 2024
1 parent 62f8e92 commit 70d3ccd
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion ydb/core/protos/flat_scheme_op.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ message TMkDir {

enum EDropWaitPolicy {
EDropFailOnChanges = 0;
EDropAbortChanges = 1; //depricated
EDropAbortChanges = 1; //deprecated
EDropWaitChanges = 2;
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/protos/flat_tx_scheme.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ message TEvModifySchemeTransaction {
optional uint64 TxId = 2;
optional uint64 TabletId = 3;
optional string Owner = 5;
optional bool FailOnExist = 6; // depricated, TModifyScheme.FailOnExist is recomended
optional bool FailOnExist = 6; // deprecated, TModifyScheme.FailOnExist is recomended
optional string UserToken = 7 [(Ydb.sensitive) = true]; // serialized NACLib::TUserToken
optional string PeerName = 8;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ISubOperation::TPtr FinalizeIndexImplTable(TOperationContext& context, const TPa
return CreateFinalizeBuildIndexImplTable(partId, transaction);
}

ISubOperation::TPtr DropIndexImplTable(TOperationContext& /*context*/, const TPath& index, const TOperationId& nextId, const TOperationId& partId, const TString& name, const TPathId& pathId) {
ISubOperation::TPtr DropIndexImplTable(const TPath& index, const TOperationId& nextId, const TOperationId& partId, const TString& name, const TPathId& pathId, bool& rejected) {
TPath implTable = index.Child(name);
Y_ABORT_UNLESS(implTable->PathId == pathId);
Y_ABORT_UNLESS(implTable.LeafName() == name);
Expand All @@ -41,8 +41,10 @@ ISubOperation::TPtr DropIndexImplTable(TOperationContext& /*context*/, const TPa
.NotUnderDeleting()
.NotUnderOperation();
if (!checks) {
return {CreateReject(nextId, checks.GetStatus(), checks.GetError())};
rejected = true;
return CreateReject(nextId, checks.GetStatus(), checks.GetError());
}
rejected = false;
auto transaction = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
auto operation = transaction.MutableDrop();
operation->SetName(name);
Expand Down Expand Up @@ -93,7 +95,12 @@ TVector<ISubOperation::TPtr> ApplyBuildIndex(TOperationId nextId, const TTxTrans
const auto& indexImplTableName = indexChildItems.first;
const auto partId = NextPartId(nextId, result);
if (NTableIndex::IsTmpImplTable(indexImplTableName)) {
result.push_back(DropIndexImplTable(context, index, nextId, partId, indexImplTableName, indexChildItems.second));
bool rejected = false;
auto op = DropIndexImplTable(index, nextId, partId, indexImplTableName, indexChildItems.second, rejected);
if (rejected) {
return {std::move(op)};
}
result.push_back(std::move(op));
} else {
result.push_back(FinalizeIndexImplTable(context, index, partId, indexImplTableName, indexChildItems.second));
}
Expand Down Expand Up @@ -143,7 +150,12 @@ TVector<ISubOperation::TPtr> CancelBuildIndex(TOperationId nextId, const TTxTran
Y_ABORT_UNLESS(index.Base()->GetChildren().size() >= 1);
for (auto& indexChildItems : index.Base()->GetChildren()) {
const auto partId = NextPartId(nextId, result);
result.push_back(DropIndexImplTable(context, index, nextId, partId, indexChildItems.first, indexChildItems.second));
bool rejected = false;
auto op = DropIndexImplTable(index, nextId, partId, indexChildItems.first, indexChildItems.second, rejected);
if (rejected) {
return {std::move(op)};
}
result.push_back(std::move(op));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ TVector<ISubOperation::TPtr> CreateBuildIndex(TOperationId opId, const TTxTransa
.NotResolved();
}

// TODO(mbkkt) less than necessary for vector index
checks
.IsValidLeafName()
.PathsLimit(2) // index and impl-table
Expand Down
8 changes: 0 additions & 8 deletions ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,6 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> LockPropose(
modifyScheme.SetWorkingDir(path.Parent().PathString());
modifyScheme.MutableLockConfig()->SetName(path.LeafName());

if (buildInfo.IsBuildIndex()) {
buildInfo.SerializeToProto(ss, modifyScheme.MutableInitiateIndexBuild());
} else if (buildInfo.IsBuildColumns()) {
buildInfo.SerializeToProto(ss, modifyScheme.MutableInitiateColumnBuild());
} else {
Y_ABORT("Unknown operation kind while building LockPropose");
}

return propose;
}

Expand Down
29 changes: 14 additions & 15 deletions ydb/core/tx/schemeshard/schemeshard_info_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2988,30 +2988,29 @@ struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {

bool CancelRequested = false;

TTxId AlterMainTableTxId = TTxId();
NKikimrScheme::EStatus AlterMainTableTxStatus = NKikimrScheme::StatusSuccess;
bool AlterMainTableTxDone = false;

TTxId LockTxId = TTxId();
NKikimrScheme::EStatus LockTxStatus = NKikimrScheme::StatusSuccess;
bool LockTxDone = false;

TTxId InitiateTxId = TTxId();
NKikimrScheme::EStatus InitiateTxStatus = NKikimrScheme::StatusSuccess;
bool InitiateTxDone = false;
bool ApplyTxDone = false;
bool UnlockTxDone = false;

TStepId SnapshotStep;
TTxId SnapshotTxId;
bool BillingEventIsScheduled = false;

TTxId AlterMainTableTxId = TTxId();
TTxId LockTxId = TTxId();
TTxId InitiateTxId = TTxId();
TTxId ApplyTxId = TTxId();
NKikimrScheme::EStatus ApplyTxStatus = NKikimrScheme::StatusSuccess;
bool ApplyTxDone = false;

TTxId UnlockTxId = TTxId();

NKikimrScheme::EStatus AlterMainTableTxStatus = NKikimrScheme::StatusSuccess;
NKikimrScheme::EStatus LockTxStatus = NKikimrScheme::StatusSuccess;
NKikimrScheme::EStatus InitiateTxStatus = NKikimrScheme::StatusSuccess;
NKikimrScheme::EStatus ApplyTxStatus = NKikimrScheme::StatusSuccess;
NKikimrScheme::EStatus UnlockTxStatus = NKikimrScheme::StatusSuccess;
bool UnlockTxDone = false;

bool BillingEventIsScheduled = false;
TStepId SnapshotStep;
TTxId SnapshotTxId;

TDuration ReBillPeriod = TDuration::Seconds(10);

struct TShardStatus {
Expand Down
8 changes: 8 additions & 0 deletions ydb/core/tx/schemeshard/schemeshard_tx_infly.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,14 @@ struct TTxState {
case NKikimrSchemeOp::ESchemeOpCreateResourcePool: return TxCreateResourcePool;
case NKikimrSchemeOp::ESchemeOpAlterResourcePool: return TxAlterResourcePool;
case NKikimrSchemeOp::ESchemeOpDropResourcePool: return TxDropResourcePool;
case NKikimrSchemeOp::ESchemeOpAlterExtSubDomainCreateHive: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpDropExternalTable: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpDropExternalDataSource: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpCreateColumnBuild: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpCreateContinuousBackup: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpAlterContinuousBackup: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpDropContinuousBackup: return TxInvalid;
case NKikimrSchemeOp::ESchemeOpRestoreIncrementalBackup: return TxInvalid;
default: return TxInvalid;
}
}
Expand Down
4 changes: 3 additions & 1 deletion ydb/core/tx/tx_proxy/schemereq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ struct TBaseSchemeReq: public TActorBootstrapped<TDerived> {
return *modifyScheme.MutableUpgradeSubDomain()->MutableName();

case NKikimrSchemeOp::ESchemeOpCreateColumnBuild:
Y_ABORT("no implementation for ESchemeOpCreateColumnBuild");

case NKikimrSchemeOp::ESchemeOpCreateIndexBuild:
Y_ABORT("no implementation for ESchemeOpCreateIndexBuild/ESchemeOpCreateColumnBuild");
Y_ABORT("no implementation for ESchemeOpCreateIndexBuild");

case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexMainTable:
Y_ABORT("no implementation for ESchemeOpInitiateBuildIndexMainTable");
Expand Down

0 comments on commit 70d3ccd

Please sign in to comment.