-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Conversation
@@ -2219,6 +2220,7 @@ read_only::get_table_rows_result read_only::get_kv_table_rows_context( const rea | |||
const string &index_value = *p.index_value; | |||
p.lower_bound = p.index_value; | |||
unbounded = true; | |||
p.reverse = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the crash when --reverse is enabled with --index_value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your review comment explaining how it fixes a particular problem.
if( p.reverse && !point_query && !exact_match ) { | ||
status_ub = ub_itr->kv_it_prev(&ub_key_size, &ub_value_size); | ||
if( !point_query && !exact_match ) { | ||
status_ub = ub_itr->kv_it_prev(&ub_key_size, &ub_value_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the incorrect end iterator resulting empty set.
@@ -2326,7 +2328,7 @@ read_only::get_table_rows_result read_only::get_kv_table_rows_context( const rea | |||
} | |||
|
|||
unsigned int count = 0; | |||
for( count = 0; cur_time <= end_time && count < p.limit && cmp < 0; cur_time = fc::time_point::now() ) { | |||
for( count = 0; cur_time <= end_time && count < p.limit && cmp <= 0; cur_time = fc::time_point::now() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmp<=0 for inclusive range
@@ -2219,6 +2220,7 @@ read_only::get_table_rows_result read_only::get_kv_table_rows_context( const rea | |||
const string &index_value = *p.index_value; | |||
p.lower_bound = p.index_value; | |||
unbounded = true; | |||
p.reverse = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your review comment explaining how it fixes a particular problem.
Change Description
Fixed issues:
-fixed a crash when --reverse and --index_value used at the same time.
-fixed the behavior or end range to be inclusive as in other get_table apis.
Before upper was exclusive [lower, upper), now inclusive [lower, upper]
-fixed a incorrect end of range problem when iterator doesn't have an exact match
Change Type
Select ONE
Consensus Changes
API Changes
Range is now inclusive on both ends like in get_table_rows.
--lower value1 --upper value2 : Return result from value1 to value2 (now value2 is included)
ex) data set:1, 2, 3, 4, 5
--lower 1 --upper 3 will return [1, 2, 3] instead of [1, 2]
-r -lower value1 --upper value2 : In reverse mode, return result from value2 to value1 (value1 is included)
ex) data set:1, 2, 3, 4, 5
-r --lower 1 --upper 3 will return [3, 2, 1] instead of [3, 2]
Documentation Additions