Skip to content

Support DDL operations (including IF EXISTS/IF NOT EXISTS) for objects with type secret #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

UgnineSirdis
Copy link
Collaborator

No description provided.

case EActivityType::Undefined:
return TYqlConclusionStatus::Fail("undefined action type");
}
Y_DEBUG_ABORT_UNLESS(operationProto);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We return Success in release mode, is that what we want? Maybe we should use Y_ENSURE here and abort the request?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't return Success here: we will simply segfault because we use operationProto :)
I think this is an internal logical error, because all options for ActivityType are listed here. Futher more, the compiler would tell us if additional option exists.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer Y_ENSURE to get an exception in release instead of a segfault nonetheless

if (ev->Get()->GetStatus() == Ydb::StatusIds::PRECONDITION_FAILED && ExistingOk) {
NRequest::TDialogYQLRequest::TResponse resp;
this->Send(this->SelfId(), new NRequest::TEvRequestResult<NRequest::TDialogYQLRequest>(std::move(resp)));
this->Requests.clear(); // Remove history request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we remove all requests, if one fails?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is rather complicated code :) This second request is here: https://github.com/ydb-platform/ydb/blob/main/ydb/services/metadata/manager/modification.h#L93
It is history insertion and we don't need it in case we haven't inserted main thing.

switch (schemeOperation.GetOperationCase()) {
case NKqpProto::TKqpSchemeOperation::kUpsertObject:
internalContext.SetActivityType(EActivityType::Upsert);
modifyObjectCommand = std::make_shared<TUpsertObjectCommand<T>>(BuildPatchFromProto(schemeOperation.GetUpsertObject()), manager, controller, internalContext);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We make a fresh TOperationsController pointer for each ObjectCommand, and we copy it inside. Also we copy it in TInsertObjectsActor constructor. Do we really need those copies, or maybe we could use unique pointer? Can ObjectCommand remain, if corresponding TOperationsController is destroyed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only refactored this code and I don't know why it is shared. But as I see, it can be simplified as you suggested. Thank you, I will try :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use unique_ptr and noticed it: https://github.com/ydb-platform/ydb/blob/main/ydb/services/metadata/initializer/accessor_init.h#L27
I am afraid that we need shared_ptr :(

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I avoided extra copying here using std::move - it is all that I can do :)

Copy link

github-actions bot commented Jan 3, 2024

Note

This is an automated comment that will be appended during run.

🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit 27ecbff.

Test history

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
59616 50436 0 3 9173 4

🔴 linux-x86_64-release-asan: some tests FAILED for commit 27ecbff.

Test history

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
15749 15644 0 25 73 7

@UgnineSirdis UgnineSirdis force-pushed the query-service-secrets-ddl branch from 31f42c3 to 2d1bdf2 Compare January 4, 2024 06:34
qrort
qrort previously approved these changes Jan 4, 2024
@UgnineSirdis UgnineSirdis merged commit 72fc8a4 into ydb-platform:main Jan 4, 2024
@niksaveliev niksaveliev mentioned this pull request Jan 11, 2024
This was referenced Jan 11, 2024
@UgnineSirdis UgnineSirdis deleted the query-service-secrets-ddl branch January 15, 2024 18:01
@pavelvelikhov pavelvelikhov mentioned this pull request Feb 3, 2024
@niksaveliev niksaveliev mentioned this pull request Feb 5, 2024
@vitstn vitstn mentioned this pull request Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants