From b4937b96e97409d6d90eaffc02d6b8ab16a73fb3 Mon Sep 17 00:00:00 2001 From: Emmanuel Keller Date: Fri, 30 Aug 2024 08:40:09 +0100 Subject: [PATCH] Avoid calling the storage engine when range scan is invalid (#4641) --- core/src/kvs/tikv/mod.rs | 2 +- core/src/kvs/tr.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/kvs/tikv/mod.rs b/core/src/kvs/tikv/mod.rs index a4dbd5a7..913d52ee 100644 --- a/core/src/kvs/tikv/mod.rs +++ b/core/src/kvs/tikv/mod.rs @@ -394,7 +394,7 @@ impl super::api::Transaction for Transaction { where K: Into + Sprintable + Debug, { - // TiKV does not support verisoned queries. + // TiKV does not support versioned queries. if version.is_some() { return Err(Error::UnsupportedVersionedQueries); } diff --git a/core/src/kvs/tr.rs b/core/src/kvs/tr.rs index d9a1287d..ac03aa2d 100644 --- a/core/src/kvs/tr.rs +++ b/core/src/kvs/tr.rs @@ -352,6 +352,9 @@ impl Transactor { { let beg: Key = rng.start.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 }) }