-
Notifications
You must be signed in to change notification settings - Fork 552
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
cloud_storage: Fix timequery bug that triggers full scan #16503
cloud_storage: Fix timequery bug that triggers full scan #16503
Conversation
Use timestamp to generate segments.
Add new overload of the 'scan_remote_partition' function used in tests. This overload uses timequery. Also, add timestamps to the metadata.
Add extra fields without exposing them to the metrics endpoint. The fields are bytes_skipped and bytes_accepted. Also, add accessor methods so the probe values could be read programmatically.
Update bytes_skip when the batches are skipped in the segment reader. Update bytes_accept when the batches are accepted.
The new test uses remote_partition test code but performs timequery. It reproduces the issue from 16479 among other things.
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/44773#018d8045-7e81-4f48-81f3-a017d7715722 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/44773#018d806c-61f5-4915-a249-5045ba6164c6 ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/44812#018d83f2-b0e3-491f-87a6-7e51fb2da7af |
new failures in https://buildkite.com/redpanda/redpanda/builds/44773#018d806c-61f2-4b10-a0ab-6e1faf16937f:
|
auto so = manifest.get_start_kafka_offset().value_or( | ||
kafka::offset::min()); | ||
if ( | ||
model::offset_cast(config.start_offset) < so | ||
config.first_timestamp.has_value() == 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.
what is this part of the conjunction?
config.first_timestamp.has_value() == false
is that referring to this from the commit message?
didn't find the segment
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.
it checks if the timequery is used, the first_timestamp
is set in this case
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.
lgtm other than minor suggestion
The remote_partition_reader can reset to the begining of the partition in case if it didn't find the segment and both config.start_offset and config.max_offset are outside of the manifest. When this logic is applied to the timequery in case if timestamp overshoots last segment in the manifest we end up having a full partition scan. This commit fixes this by disabling this logic for timequeries.
0741a47
to
f4f6743
Compare
/backport v23.3.x |
/backport v23.2.x |
Failed to create a backport PR to v23.2.x branch. I tried:
|
Timequery can trigger full partition scan if the query overshoots the last segment. In this case if
log_reader_config.start_offset
is below the first segment in the manifest andlog_reader_config.max_offset
is above last offset in the manifest we will initialize the scan from the beginning which is very expensive.This PR adds
remote_partition_test
that performs timequery (TODO: add fuzz test).Fixes #16479
Backports Required
Release Notes
Bug Fixes