-
Notifications
You must be signed in to change notification settings - Fork 592
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: use remote index in cloud timequery #13011
cloud_storage: use remote index in cloud timequery #13011
Conversation
A lookup by timestamp is added to the remote index. It has the same semantics as the other lookup methods. If the index does not include the time index (i.e. it was created with serde version 1), the search comes up empty.
ea3677a
to
78454bf
Compare
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 if CI is happy
78454bf
to
0e88306
Compare
Changes in force-push:
|
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.
🔥 🚒
@@ -184,6 +184,58 @@ offset_index::find_kaf_offset(kafka::offset upper_bound) { | |||
return res; | |||
} | |||
|
|||
std::optional<offset_index::find_result> | |||
offset_index::find_timestamp(model::timestamp upper_bound) { | |||
if (_initial_time == model::timestamp::missing()) { |
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's a bummer that -1 is used to indicate missing timestamp. That -1 carries so much additional baggage in Kafka for example by indicating something specific in time queries.
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.
Yeah, it's not ideal. Not much we can do about it now though. The -1 is already encoded in a released Serde version.
@@ -315,18 +315,18 @@ remote_segment::offset_data_stream( | |||
offset_index::find_result pos; | |||
std::optional<uint16_t> prefetch_override = std::nullopt; | |||
if (first_timestamp) { |
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.
is it odd that first_timestamp
wasn't used in this conditional before?
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.
first_timestamp
indicates that this is a time-query. By this point, we have already resolved to the correct segment for the time query. Since we didn't previously used the index, it makes senes that first_timestamp
wasn't used (we'd just start from the beginning of the segment).
This commit updates the timequery read path to skip up to the first index entry with a timestamp smaller than the searched one. The result is that timequeries will hydrate/materialize a maximum of two chunks (two because the chunk boundaries don't always line up with the entries in the index). If the index is not present, or was originally created in v1, the search starts from the first chunk as it did previously.
A shard-level metric is added to track the total number of chunks that were hydrated (i.e. downloaded).
This commit makes a couple of changes to the timequery tests: 1. Run timequery on more offests (10 for each of the 12 segments) 2. Check that a maximum of two chunks are downloaded by any given timequery 3. Use the admin api to get the precise boundary between the cloud and local log. Previously, it was estimated based on record size.
604d114
to
c5df897
Compare
c5df897
to
6314700
Compare
This commit refactors the handling of the index search result. If a new result type is introduced, it's author will be reminded to handle it by the assertions.
6314700
to
de5aa53
Compare
/backport v23.2.x |
Failed to run cherry-pick command. I executed the commands below:
|
/backport v23.2.x |
Failed to run cherry-pick command. I executed the commands below:
|
This PR updates the timequery read path to skip up to the first
index entry with a timestamp smaller than the searched one. The result
is that timequeries will hydrate/materialize a maximum of two chunks
(two because the chunk boundaries don't always line up with the entries
in the index).
If the index is not present, or was originally created in v1, the search
starts from the first chunk as it did previously.
Fixes #11801
Backports Required
Release Notes
Improvements
and reduce the number of hydrated bytes required to serve the query. On average, a time query will have to download 4 times less data (if using the default segment and chunk size)