Add method of gettimestamp for transaction (#303)

* add interface of timestamp

Signed-off-by: Little-Wallace <bupt2013211450@gmail.com>

* fix comment

Signed-off-by: Little-Wallace <bupt2013211450@gmail.com>

* Update src/transaction/transaction.rs

Co-authored-by: Andy Lok <andylokandy@hotmail.com>
Signed-off-by: Little-Wallace <bupt2013211450@gmail.com>

Co-authored-by: Andy Lok <andylokandy@hotmail.com>
Co-authored-by: Ziqian Qin <ekexium@gmail.com>
This commit is contained in:
Wallace 2021-06-21 14:31:42 +08:00 committed by GitHub
parent dc793a519b
commit ccf8a2c15d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -183,7 +183,9 @@ impl Client {
/// Request garbage collection (GC) of the TiKV cluster.
///
/// GC deletes MVCC records whose timestamp is lower than the given `safepoint`.
/// GC deletes MVCC records whose timestamp is lower than the given `safepoint`. We must guarantee
/// that all transactions started before this timestamp had committed. We can keep an active
/// transaction list in application to decide which is the minimal start timestamp of them.
///
/// For each key, the last mutation record (unless it's a deletion) before `safepoint` is retained.
///

View File

@ -635,6 +635,11 @@ impl<PdC: PdClient> Transaction<PdC> {
res
}
/// Get the start timestamp of this transaction.
pub fn start_timestamp(&self) -> Timestamp {
self.timestamp.clone()
}
/// Send a heart beat message to keep the transaction alive on the server and update its TTL.
///
/// Returns the TTL set on the transaction's locks by TiKV.