Avoid calling the storage engine when range scan is invalid (#4641)
This commit is contained in:
parent
1e6a3a8f9b
commit
b4937b96e9
2 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue