-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
fix: fetch first-event-at from storage #1130
base: main
Are you sure you want to change the base?
fix: fetch first-event-at from storage #1130
Conversation
Pull Request Test Coverage Report for Build 12975280436Details
💛 - Coveralls |
src/storage/object_storage.rs
Outdated
@@ -747,3 +783,27 @@ pub fn ingestor_metadata_path(id: Option<&str>) -> RelativePathBuf { | |||
&format!("ingestor.{}.json", INGESTOR_META.get_ingestor_id()), | |||
]) | |||
} | |||
|
|||
pub async fn get_stream_meta_from_storage( |
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.
Can we associate this with ObjectStore
?
src/catalog/mod.rs
Outdated
/// Ok(None) => println!("first-event-at not found"), | ||
/// Err(e) => eprintln!("Error retrieving first-event-at from storage: {}", e), | ||
/// } | ||
/// ``` |
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.
The code comments aren't very helpful, can we restrict to only pointing out working and edge-cases?
src/catalog/mod.rs
Outdated
/// Err(e) => eprintln!("Error retrieving first-event-at from storage: {}", e), | ||
/// } | ||
/// ``` | ||
pub async fn get_first_event_from_storage( |
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.
Function should be associated to the storage object
/// Err(e) => eprintln!("Error removing first-event-at from STREAM_INFO: {}", e), | ||
/// } | ||
/// ``` | ||
pub fn reset_first_event_at(&self, stream_name: &str) -> Result<(), MetadataError> { |
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 feel a good comment would explain where we are using this function, e.g. when retention threshold is met and we are removing first event time since that information is outdated.
/// None => eprintln!("Failed to update first-event-at"), | ||
/// } | ||
/// ``` | ||
pub async fn update_first_event_at(stream_name: &str, first_event_at: &str) -> Option<String> { |
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.
Maybe we should pass DateTime
/NaiveDateTime
instead of using &str
to represent this information?
current: query server fetches first-event-at from all the live ingestors but, this logic fails when ingestor which ingested the events for a stream is not reachable anymore, query server gets `None` change: fetch the first-event-at from all the stream jsons from storage find the earliest value, and update in server's memory map
988c060
to
b618c47
Compare
current: query server fetches first-event-at from all the live ingestors
but, this logic fails when ingestor which ingested the events for a stream is not reachable anymore, query server gets
None
change: fetch the first-event-at from all the stream jsons from storage,
find the earliest value, and update in server's memory map