File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -556,7 +556,19 @@ impl KvClient {
556
556
start_key
557
557
. map ( |k| req. set_start_key ( k. into_inner ( ) ) )
558
558
. unwrap ( ) ;
559
- end_key. map ( |k| req. set_end_key ( k. into_inner ( ) ) ) . unwrap ( ) ;
559
+ end_key
560
+ . map ( |k| {
561
+ // Scan in TiKV has a weird particularity to it.
562
+ // The **start** of a scan is inclusive, unless appended with an '\0', then it is exclusive.
563
+ // The **end** of a scan is exclusive, unless appended with an '\0', then it is inclusive.
564
+ //
565
+ // We work around this behavior in this client by making all our scans (Inclusive, Inclusive),
566
+ // if we have exclusive bounds our own bounds calculation adjusts it.
567
+ let mut end_key = k. into_inner ( ) ;
568
+ end_key. append ( & mut vec ! [ 0 ] ) ;
569
+ req. set_end_key ( end_key) ;
570
+ } )
571
+ . unwrap ( ) ;
560
572
req. set_limit ( limit) ;
561
573
req. set_key_only ( key_only) ;
562
574
You can’t perform that action at this time.
0 commit comments