Skip to content

Commit ccf8a2c

Browse files
Little-Wallaceandylokandyekexium
authored
Add method of gettimestamp for transaction (#303)
* add interface of timestamp Signed-off-by: Little-Wallace <[email protected]> * fix comment Signed-off-by: Little-Wallace <[email protected]> * Update src/transaction/transaction.rs Co-authored-by: Andy Lok <[email protected]> Signed-off-by: Little-Wallace <[email protected]> Co-authored-by: Andy Lok <[email protected]> Co-authored-by: Ziqian Qin <[email protected]>
1 parent dc793a5 commit ccf8a2c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/transaction/client.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ impl Client {
183183

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

src/transaction/transaction.rs

+5
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,11 @@ impl<PdC: PdClient> Transaction<PdC> {
635635
res
636636
}
637637

638+
/// Get the start timestamp of this transaction.
639+
pub fn start_timestamp(&self) -> Timestamp {
640+
self.timestamp.clone()
641+
}
642+
638643
/// Send a heart beat message to keep the transaction alive on the server and update its TTL.
639644
///
640645
/// Returns the TTL set on the transaction's locks by TiKV.

0 commit comments

Comments
 (0)