Skip to content
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

Feature: transaction api #5030

Merged
merged 14 commits into from
Apr 26, 2022
Merged

Feature: transaction api #5030

merged 14 commits into from
Apr 26, 2022

Conversation

lichuang
Copy link
Contributor

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Feature: transaction api

Changelog

  • New Feature

Related Issues

Fixes #4918

@vercel
Copy link

vercel bot commented Apr 24, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
databend ✅ Ready (Inspect) Visit Preview Apr 26, 2022 at 10:48AM (UTC)

@mergify
Copy link
Contributor

mergify bot commented Apr 24, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Apr 24, 2022
Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

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

Not yet reviewed the execution part. As having some question about the datatype definition.

Comment on lines 24 to 28
message TxnKey {
string key = 1;
string tenant = 2;
string tree = 3;
}
Copy link
Member

Choose a reason for hiding this comment

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

tenant should be part of the key IMHO.

Txn is only meant to be used on the sled tree kv thus we may not need to specify a tree.

The TxnKey could be a simple string. Or I missed something?

Copy link
Member

Choose a reason for hiding this comment

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

is it possible that we may introduce some features like tenant isolation inside the metasrv in the future? if so, a metadata about tenent inside each key maybe helpful.

likewise we have an JWT inside the user session, each JWT is associated with a limitted scope of JWT, we may pass the JWT alongside to the metasrv, and metasrv can restrict the session can only access the data inside one tenant.

Copy link
Member

Choose a reason for hiding this comment

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

is it possible that we may introduce some features like tenant isolation inside the metasrv in the future? if so, a metadata about tenent inside each key maybe helpful.

It can be done. But if to add this feature is still up to the design principle:
Whether to keep the metasrv a pure kv service like etcd or it has to understand some of the business logic.

Currently tenant is embedded into the key thus metasrv do not need to understand tenant. Are we gonna break this rule?

common/meta/types/src/transaction.rs Outdated Show resolved Hide resolved
common/meta/types/proto/request.proto Outdated Show resolved Hide resolved
common/meta/types/proto/request.proto Outdated Show resolved Hide resolved
Comment on lines 59 to 63
message DeleteResponse {
TxnKey key = 1;
bool success = 2;
optional SeqV prev_value = 3;
}
Copy link
Member

Choose a reason for hiding this comment

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

Will there be an unsuccess delete? If the txn conditions are not satisfied, the txn should not run at all. Otherwise, delete should always succeed.

Copy link
Contributor Author

@lichuang lichuang Apr 25, 2022

Choose a reason for hiding this comment

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

i just follow etcd api define, how about let transaction API user to judge these param
may be user get in condition use another key, so i think notify if or not success if fine:)

Copy link
Member

Choose a reason for hiding this comment

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

Is there any progress?

common/meta/types/src/seq_value.rs Outdated Show resolved Hide resolved
common/meta/types/proto/meta.proto Outdated Show resolved Hide resolved
common/meta/types/src/cmd.rs Outdated Show resolved Hide resolved
common/meta/types/src/transaction.rs Outdated Show resolved Hide resolved
common/meta/types/proto/meta.proto Outdated Show resolved Hide resolved
common/meta/types/proto/meta.proto Outdated Show resolved Hide resolved
common/meta/types/proto/meta.proto Outdated Show resolved Hide resolved
common/meta/types/proto/request.proto Show resolved Hide resolved
Comment on lines 59 to 63
message DeleteResponse {
TxnKey key = 1;
bool success = 2;
optional SeqV prev_value = 3;
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there any progress?

common/meta/types/src/cmd.rs Outdated Show resolved Hide resolved
common/meta/types/src/seq_value.rs Outdated Show resolved Hide resolved
common/meta/types/src/seq_value.rs Outdated Show resolved Hide resolved
common/meta/types/src/seq_value.rs Outdated Show resolved Hide resolved
metasrv/src/api/grpc/grpc_service.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
Comment on lines 141 to 144
message TxnReply {
bool success = 1;
repeated TxnOpResponse responses = 2;
}
Copy link
Member

Choose a reason for hiding this comment

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

Just a thought: if txn is aborted, the client may need to know which condition is not satisfied?

metasrv/src/watcher/watcher_manager.rs Outdated Show resolved Hide resolved
common/meta/api/src/kv_api_test_suite.rs Outdated Show resolved Hide resolved
common/meta/api/src/kv_api_test_suite.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
common/meta/raft-store/src/state_machine/sm.rs Outdated Show resolved Hide resolved
Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@BohuTANG BohuTANG left a comment

Choose a reason for hiding this comment

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

💯

@mergify mergify bot merged commit 66e5104 into databendlabs:main Apr 26, 2022
@lichuang lichuang deleted the transaction_api branch April 27, 2022 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction API. High prio
6 participants