From 1c4a54a73c4b466db8bb0121db082d7ab3c618b2 Mon Sep 17 00:00:00 2001 From: Duy Dang <55247256+ddwalias@users.noreply.github.com> Date: Tue, 7 Oct 2025 19:46:26 +0700 Subject: [PATCH] Add comment explaining the 0 for infinity timestamp --- core/mvcc/database/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/mvcc/database/mod.rs b/core/mvcc/database/mod.rs index 5fa28c19c..9adeb1e75 100644 --- a/core/mvcc/database/mod.rs +++ b/core/mvcc/database/mod.rs @@ -1755,6 +1755,15 @@ impl MvStore { match ts_or_id { Some(TxTimestampOrID::Timestamp(ts)) => *ts, Some(TxTimestampOrID::TxID(tx_id)) => self.txs.get(tx_id).unwrap().value().begin_ts, + // This function is intended to be used in the ordering of row versions within the row version chain in `insert_version_raw`. + // + // The row version chain should be append-only (aside from garbage collection), + // so the specific ordering handled by this function may not be critical. We might + // be able to append directly to the row version chain in the future. + // + // The value 0 is used here to represent an infinite timestamp value. This is a deliberate + // choice for a planned future bitpacking optimization, reserving 0 for this purpose, + // while actual timestamps will start from 1. None => 0, } }