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

fix: fetch first-event-at from storage #1130

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nikhilsinhaparseable
Copy link
Contributor

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

@coveralls
Copy link

coveralls commented Jan 22, 2025

Pull Request Test Coverage Report for Build 12975280436

Details

  • 4 of 87 (4.6%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.06%) to 12.73%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/handlers/http/modal/ingest_server.rs 0 1 0.0%
src/storage/retention.rs 0 2 0.0%
src/catalog/mod.rs 0 4 0.0%
src/handlers/http/logstream.rs 0 9 0.0%
src/metadata.rs 0 10 0.0%
src/handlers/http/modal/utils/logstream_utils.rs 0 14 0.0%
src/storage/object_storage.rs 0 43 0.0%
Totals Coverage Status
Change from base Build 12964606893: -0.06%
Covered Lines: 2443
Relevant Lines: 19191

💛 - Coveralls

@@ -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(
Copy link
Contributor

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?

/// Ok(None) => println!("first-event-at not found"),
/// Err(e) => eprintln!("Error retrieving first-event-at from storage: {}", e),
/// }
/// ```
Copy link
Contributor

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?

/// Err(e) => eprintln!("Error retrieving first-event-at from storage: {}", e),
/// }
/// ```
pub async fn get_first_event_from_storage(
Copy link
Contributor

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> {
Copy link
Contributor

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> {
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants