Skip to content

Commit

Permalink
fix paths in modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
swalrus1 committed Oct 28, 2024
1 parent ddfdc4a commit 828600d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 14 deletions.
8 changes: 4 additions & 4 deletions ydb/core/tx/schemeshard/operations/metadata/update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TConclusionStatus TMetadataUpdateCreate::DoInitializeImpl(const TUpdateInitializ

Behaviour.reset(IMetadataUpdateBehaviour::TFactoryByPropertiesImpl::Construct(request.GetProperties().GetPropertiesImplCase()));
if (!Behaviour) {
return TConclusionStatus::Fail("Updates are not supported for given object");
return TConclusionStatus::Fail("Metadata updates are not supported for given object");
}
const auto validator = Behaviour->MakeValidator(
TPath::Resolve(modification->GetWorkingDir(), context.GetSSOperationContext()->SS), request.GetName(), *context.GetSSOperationContext());
Expand Down Expand Up @@ -50,7 +50,7 @@ TConclusionStatus TMetadataUpdateAlter::DoInitializeImpl(const TUpdateInitializa

Behaviour.reset(IMetadataUpdateBehaviour::TFactoryByPropertiesImpl::Construct(request.GetProperties().GetPropertiesImplCase()));
if (!Behaviour) {
return TConclusionStatus::Fail("Updates are not supported for given object");
return TConclusionStatus::Fail("Metadata updates are not supported for given object");
}
const auto validator = Behaviour->MakeValidator(
TPath::Resolve(modification->GetWorkingDir(), context.GetSSOperationContext()->SS), request.GetName(), *context.GetSSOperationContext());
Expand Down Expand Up @@ -82,15 +82,15 @@ TConclusionStatus TMetadataUpdateDrop::DoInitializeImpl(const TUpdateInitializat
const auto& modification = context.GetModification();
const auto& request = modification->GetDrop();
const auto& originalEntity = context.GetOriginalEntityAsVerified<TMetadataEntity>();
const TPath objectPath = TPath::Resolve(modification->GetWorkingDir(), context.GetSSOperationContext()->SS);
const TPath objectPath = TPath::Init(originalEntity.GetPathId(), context.GetSSOperationContext()->SS);

if (!objectPath.IsResolved()) {
return TConclusionStatus::Fail("Object not found at " + objectPath.PathString());
}

Behaviour.reset(IMetadataUpdateBehaviour::TFactoryByPath::Construct(objectPath->PathType));
if (!Behaviour) {
return TConclusionStatus::Fail("Updates are not supported for given object");
return TConclusionStatus::Fail(TStringBuilder() << "Metadata updates are not supported for this object: " << objectPath->PathType);
}
const auto validator = Behaviour->MakeValidator(objectPath, request.GetName(), *context.GetSSOperationContext());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class TAlterMetadataObject : public TSubOperation {
THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
Y_UNUSED(owner);

const TString pathString = NMetadataObject::GetDestinationPath(Transaction);
const TString pathString = JoinPath({Transaction.GetWorkingDir(), Transaction.GetCreateMetadataObject().GetName()});
LOG_N("TAlterMetadataObject Propose: opId# " << OperationId << ", path# " << pathString);

auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,4 @@ void PersistOperation(const TOperationId& operationId, const TOperationContext&
context.SS->PersistTxState(db, operationId);
}

TString GetDestinationPath(const NKikimrSchemeOp::TModifyScheme& transaction) {
return JoinPath({transaction.GetWorkingDir(), transaction.GetCreateMetadataObject().GetName()});
}


} // namespace NKikimr::NSchemeShard::NMetadataObject
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@ void AdvanceTransactionStateToPropose(const TOperationId& operationId, const TOp
void PersistOperation(const TOperationId& operationId, const TOperationContext& context, NIceDb::TNiceDb& db,
const TPathElement::TPtr& objectPath, const TString& acl, const bool created);

TString GetDestinationPath(const NKikimrSchemeOp::TModifyScheme& transaction);

} // namespace NKikimr::NSchemeShard::NMetadataObject
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class TCreateMetadataObject : public TSubOperation {
using TSubOperation::TSubOperation;

THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
const TString pathString = NMetadataObject::GetDestinationPath(Transaction);
const TString pathString = JoinPath({Transaction.GetWorkingDir(), Transaction.GetCreateMetadataObject().GetName()});
LOG_N("TCreateMetadataObject Propose: opId# " << OperationId << ", path# " << pathString);

auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class TDropMetadataObject : public TSubOperation {
THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
Y_UNUSED(owner);

const TString pathString = NMetadataObject::GetDestinationPath(Transaction);
const TString pathString = JoinPath({Transaction.GetWorkingDir(), Transaction.GetDrop().GetName()});
LOG_N("TDropMetadataObject Propose: opId# " << OperationId << ", path# " << pathString);

auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted,
Expand Down

0 comments on commit 828600d

Please sign in to comment.