From fc7e1639a04419784d526b6176eda4dd0980f155 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Mon, 6 Oct 2025 13:29:10 +0200 Subject: [PATCH] core/mvcc: filter out seek results where is not same table_id --- core/mvcc/database/mod.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/mvcc/database/mod.rs b/core/mvcc/database/mod.rs index f00690aff..2ac663acd 100644 --- a/core/mvcc/database/mod.rs +++ b/core/mvcc/database/mod.rs @@ -1322,7 +1322,7 @@ impl MvStore { let tx = self.txs.get(&tx_id).unwrap(); let tx = tx.value(); - if lower_bound { + let res = if lower_bound { self.rows .lower_bound(bound) .and_then(|entry| self.find_last_visible_version(tx, entry)) @@ -1330,7 +1330,19 @@ impl MvStore { self.rows .upper_bound(bound) .and_then(|entry| self.find_last_visible_version(tx, entry)) - } + }; + tracing::trace!( + "seek_rowid(bound={:?}, lower_bound={}, found={:?})", + bound, + lower_bound, + res + ); + let table_id_expect = match bound { + Bound::Included(rowid) => rowid.table_id, + Bound::Excluded(rowid) => rowid.table_id, + Bound::Unbounded => unreachable!(), + }; + res.filter(|&rowid| rowid.table_id == table_id_expect) } /// Begins an exclusive write transaction that prevents concurrent writes.