Avoid calling the storage engine when range scan is invalid (#4641)

This commit is contained in:
Emmanuel Keller 2024-08-30 08:40:09 +01:00 committed by GitHub
parent 1e6a3a8f9b
commit b4937b96e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -394,7 +394,7 @@ impl super::api::Transaction for Transaction {
where where
K: Into<Key> + Sprintable + Debug, K: Into<Key> + Sprintable + Debug,
{ {
// TiKV does not support verisoned queries. // TiKV does not support versioned queries.
if version.is_some() { if version.is_some() {
return Err(Error::UnsupportedVersionedQueries); return Err(Error::UnsupportedVersionedQueries);
} }

View file

@ -352,6 +352,9 @@ impl Transactor {
{ {
let beg: Key = rng.start.into(); let beg: Key = rng.start.into();
let end: Key = rng.end.into(); let end: Key = rng.end.into();
if beg > end {
return Ok(vec![]);
}
expand_inner!(&mut self.inner, v => { v.scan(beg..end, limit, version).await }) expand_inner!(&mut self.inner, v => { v.scan(beg..end, limit, version).await })
} }