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.