Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query_ranges_to_vnodes_generator: fix for exclusive boundaries #12755

Closed

Conversation

gusev-p
Copy link

@gusev-p gusev-p commented Feb 6, 2023

Let the initial range passed to query_partition_key_range be [1, 2) where 2 is the successor of 1 in terms
of ring_position order and 1 is equal to vnode.
Then query_ranges_to_vnodes_generator() -> [[1, 1], (1, 2)], so we get an empty range (1,2) and subsequently will make a data request with this empty range in
storage_proxy::query_partition_key_range_concurrent, which will be redundant.

The patch checks for this condition after the main loop in process_one_range.

A test case is added for this scenario in
test_get_restricted_ranges. The helper
lambda check is changed so that not to limit
the number of ranges to the length of expected
ranges, otherwise this check passes without
the change in process_one_range.

Fixes: #12566

@scylladb-promoter
Copy link
Contributor

query_ranges_to_vnodes.cc Outdated Show resolved Hide resolved
query_ranges_to_vnodes.cc Outdated Show resolved Hide resolved
Let the initial range passed to query_partition_key_range
be [1, 2) where 2 is the successor of 1 in terms
of ring_position order and 1 is equal to vnode.
Then query_ranges_to_vnodes_generator() -> [[1, 1], (1, 2)],
so we get an empty range (1,2) and subsequently will
make a data request with this empty range in
storage_proxy::query_partition_key_range_concurrent,
which will be redundant.

The patch adds a check for this condition after
making a split in the main loop in process_one_range.

The patch does not attempt to handle cases where the
original ranges were empty, since this check is the
responsibility of the caller. We only take care
not to add empty ranges to the result as an
unintentional artifact of the algorithm in
query_ranges_to_vnodes_generator.

A test case is added in test_get_restricted_ranges.
The helper lambda check is changed so that not to limit
the number of ranges to the length of expected
ranges, otherwise this check passes without
the change in process_one_range.

Fixes: scylladb#12566
@gusev-p gusev-p force-pushed the query_ranges_to_vnodes_generator_fix branch from 46f67e9 to b2a4829 Compare February 7, 2023 08:48
@scylladb-promoter
Copy link
Contributor

@denesb
Copy link
Contributor

denesb commented Feb 7, 2023

I'll wait for @gleb-cloudius to review too.

@gusev-p
Copy link
Author

gusev-p commented Feb 8, 2023

@denesb let's merge this?

@denesb
Copy link
Contributor

denesb commented Feb 8, 2023

@denesb let's merge this?

Already queued yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

query_partition_key_range_concurrent: strict predecessor of the exclusive right boundary is equal to vnode
4 participants