diff --git a/src/transaction/client.rs b/src/transaction/client.rs index 50ddd76..c4e8557 100644 --- a/src/transaction/client.rs +++ b/src/transaction/client.rs @@ -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. /// diff --git a/src/transaction/transaction.rs b/src/transaction/transaction.rs index 8b6f962..c089244 100644 --- a/src/transaction/transaction.rs +++ b/src/transaction/transaction.rs @@ -635,6 +635,11 @@ impl Transaction { 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.