-
-
Notifications
You must be signed in to change notification settings - Fork 158
fix: add stream creation time in get stats api #632
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
Changes from 6 commits
adbae20
9a5d4aa
01092c3
4c5228e
56851f9
a4173b9
b808525
58b3ee9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,7 +187,11 @@ mod action { | |
| use itertools::Itertools; | ||
| use relative_path::RelativePathBuf; | ||
|
|
||
| use crate::option::CONFIG; | ||
| use crate::{ | ||
| catalog::{self, remove_manifest_from_snapshot}, | ||
| metadata, | ||
| option::CONFIG, | ||
| }; | ||
|
|
||
| pub(super) async fn delete(stream_name: String, days: u32) { | ||
| log::info!("running retention task - delete for stream={stream_name}"); | ||
|
|
@@ -206,6 +210,7 @@ mod action { | |
| .into_iter() | ||
| .filter(|date| string_to_date(date) < retain_until) | ||
| .collect_vec(); | ||
| let dates = dates_to_delete.clone(); | ||
|
|
||
| let delete_tasks = FuturesUnordered::new(); | ||
| for date in dates_to_delete { | ||
|
|
@@ -226,6 +231,35 @@ mod action { | |
| log::error!("Failed to run delete task {err:?}") | ||
| } | ||
| } | ||
|
|
||
| let store = CONFIG.storage().get_object_store(); | ||
| let res = remove_manifest_from_snapshot(store.clone(), &stream_name, dates).await; | ||
| if let Err(err) = res { | ||
| log::error!("Failed to update manifest list in the snapshot {err:?}") | ||
| } | ||
|
|
||
| if let Ok(Some(first_event_at)) = catalog::get_first_event(store, &stream_name).await { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to do this here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is here to update the first event timestamp after cleanup because after retention cleanup, first event timestamp would be different. |
||
| if let Err(err) = CONFIG | ||
| .storage() | ||
| .get_object_store() | ||
| .put_first_event_at(&stream_name, &first_event_at) | ||
| .await | ||
| { | ||
| log::error!( | ||
| "Failed to update first_event_at in metadata for stream {:?} {err:?}", | ||
| stream_name | ||
| ); | ||
| } | ||
|
|
||
| if let Err(err) = | ||
| metadata::STREAM_INFO.set_first_event_at(&stream_name, Some(first_event_at)) | ||
| { | ||
| log::error!( | ||
| "Failed to update first_event_at in streaminfo for stream {:?} {err:?}", | ||
| stream_name | ||
| ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn get_retain_until(current_date: NaiveDate, days: u64) -> NaiveDate { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.