def linear_search_from_cursor(search_cursor, key)
Innodb::Stats.increment :linear_search_from_cursor
this_rec = search_cursor.record
if Innodb.debug?
puts "linear_search_from_cursor: page=%i, level=%i, start=(%s)" % [
offset,
level,
this_rec && this_rec.key_string,
]
end
while this_rec && next_rec = search_cursor.record
Innodb::Stats.increment :linear_search_from_cursor_record_scans
if Innodb.debug?
puts "linear_search_from_cursor: page=%i, level=%i, current=(%s)" % [
offset,
level,
this_rec && this_rec.key_string,
]
end
return this_rec if next_rec.header[:type] == :supremum
if this_rec.compare_key(key) < 0
return this_rec
end
if (this_rec.compare_key(key) >= 0) &&
(next_rec.compare_key(key) < 0)
return this_rec
end
this_rec = next_rec
end
this_rec
end