Skip to content

Commit 72bf195

Browse files
authored
Merge 'core/mvcc/cursor: rowid don't seek first rowid' from Pere Diaz Bou
rowid should only try to use the current's position. So if we are not pointing to a `Loaded` row, then it should return None <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Change `rowid()` to return `None` unless cursor is on a `Loaded` row, removing the implicit seek from `BeforeFirst`. > > - **Core MVCC Cursor (`core/mvcc/cursor.rs`)**: > - Adjust `rowid()` behavior: remove implicit first-row seek when `BeforeFirst`; return `None` unless position is `Loaded`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8848775. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Reviewed-by: Jussi Saurio <[email protected]> Closes #3977
2 parents e61234d + 8848775 commit 72bf195

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

core/mvcc/cursor.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -385,23 +385,7 @@ impl<Clock: LogicalClock + 'static> CursorTrait for MvccLazyCursor<Clock> {
385385
in_btree: _,
386386
btree_consumed: _,
387387
} => Some(row_id.row_id),
388-
CursorPosition::BeforeFirst => {
389-
// If we are before first, we need to try and find the first row.
390-
let maybe_rowid =
391-
self.db
392-
.get_next_row_id_for_table(self.table_id, i64::MIN, self.tx_id);
393-
if let Some(id) = maybe_rowid {
394-
self.current_pos.replace(CursorPosition::Loaded {
395-
row_id: id,
396-
in_btree: false,
397-
btree_consumed: true,
398-
});
399-
Some(id.row_id)
400-
} else {
401-
self.current_pos.replace(CursorPosition::BeforeFirst);
402-
None
403-
}
404-
}
388+
CursorPosition::BeforeFirst => None,
405389
CursorPosition::End => None,
406390
};
407391
Ok(IOResult::Done(rowid))

0 commit comments

Comments
 (0)