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

Transactional API #15

Open
Hoverbear opened this issue Jan 11, 2019 · 6 comments

Comments

Projects
None yet
4 participants
@Hoverbear
Copy link
Member

commented Jan 11, 2019

In #14 we enabled the Raw client, and scaffolded much of the code needed for the transactional client. This issue tracks the completion of the first release of the Transactional API.

In order to close this issue you'll need to replace all unimplemented!() in the src/transaction.rs file with working code. You can reference the src/raw.rs code to help with this, however transactions are quite a bit more complicated than the raw client.

@Kerollmops

This comment has been minimized.

Copy link
Contributor

commented Jan 19, 2019

I would like to use this client but I will need the transaction API. Would it be possible to add some hints about where to find the current go transaction implementation if any?

I am currently searching in the tidb repository with github but it is hard to find anything interresting...

I also find the kv directory in tidb but it seems that there only is the go Storage interfaces, no code related to the transaction aquierement.

Ok, so I found the implementation in tidb/store/tikv/kv.go and tidb/store/tikv/txn.go.

@sunxiaoguang

This comment has been minimized.

Copy link
Collaborator

commented Jan 20, 2019

I would like to use this client but I will need the transaction API. Would it be possible to add some hints about where to find the current go transaction implementation if any?

I am currently searching in the tidb repository with github but it is hard to find anything interresting...

I also find the kv directory in tidb but it seems that there only is the go Storage interfaces, no code related to the transaction aquierement.

Ok, so I found the implementation in tidb/store/tikv/kv.go and tidb/store/tikv/txn.go.

There is on going work to move TiKV client out of TiDB code base. You can take a look at it.

@Kerollmops

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2019

Thank you for the link @sunxiaoguang but it doesn't show me how I can implement the transactional Rust client so I fallback on the previous links I posted.

Would it be possible to have some kind of mentoring?

I saw that the transaction::Client::begin method could follow the steps of the Go client by creating a new TiKV transaction.

I do not know how to retrieve the snapshot based on the timestamp like the Go function do.
I found the rpc::client::txn function which, based on a key, return a TxnContext.
Internally it use the key to locate in which "region" it is, is it useful for me to implement the transactional client?

This TxnContext could be used to call functions prefixed by kv_ present in the rpc/tikv/client.rs are related to transactions. These functions need to specify the version at which the transaction must run, is this something related to the RocksDB timestamp/snapshot?

The only way I found to retrieve a version/timestamp is highly related to the TxnContext/Region.

@sunxiaoguang

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2019

Thank you for the link @sunxiaoguang but it doesn't show me how I can implement the transactional Rust client so I fallback on the previous links I posted.

Would it be possible to have some kind of mentoring?

I saw that the transaction::Client::begin method could follow the steps of the Go client by creating a new TiKV transaction.

I do not know how to retrieve the snapshot based on the timestamp like the Go function do.
I found the rpc::client::txn function which, based on a key, return a TxnContext.
Internally it use the key to locate in which "region" it is, is it useful for me to implement the transactional client?

This TxnContext could be used to call functions prefixed by kv_ present in the rpc/tikv/client.rs are related to transactions. These functions need to specify the version at which the transaction must run, is this something related to the RocksDB timestamp/snapshot?

The only way I found to retrieve a version/timestamp is highly related to the TxnContext/Region.

Although we haven't reached final design of transactional API yet. You may find more about the internal implementation detail from client-go. It involves many implementation details therefore is hard to describe here in couple of sentences. BTW: Maybe reading google percolator paper could help you a lot understanding TiKV's transaction model.

@sunxiaoguang

This comment has been minimized.

Copy link
Collaborator

commented Jan 22, 2019

Thank you for the link @sunxiaoguang but it doesn't show me how I can implement the transactional Rust client so I fallback on the previous links I posted.

Would it be possible to have some kind of mentoring?

I saw that the transaction::Client::begin method could follow the steps of the Go client by creating a new TiKV transaction.

I do not know how to retrieve the snapshot based on the timestamp like the Go function do.
I found the rpc::client::txn function which, based on a key, return a TxnContext.
Internally it use the key to locate in which "region" it is, is it useful for me to implement the transactional client?

This TxnContext could be used to call functions prefixed by kv_ present in the rpc/tikv/client.rs are related to transactions. These functions need to specify the version at which the transaction must run, is this something related to the RocksDB timestamp/snapshot?

The only way I found to retrieve a version/timestamp is highly related to the TxnContext/Region.

In case I didn't make it clear. The transactional part has lots of work at client side, it's probably different from what people normally think about implementing transactional api for relational databases. Although reading a paper sounds like too much, but I'm afraid that's probably the most efficient way to understand it.

@brson

This comment has been minimized.

Copy link
Collaborator

commented Jan 30, 2019

Thanks @sunxiaoguang for the pointers.

cc @nrc here's some important work going on that might be notable to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.