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

Bug-fix: Undo logic error in how database timestamp filtering criteria was set (fixes #69). #70

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions components/core/src/streaming_archive/MetadataDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,18 @@ namespace streaming_archive {
// Add clauses
bool clause_exists = false;
if (cEpochTimeMin != ts_begin) {
fmt::format_to(statement_buffer_ix, " WHERE {} >= ?{}", streaming_archive::cMetadataDB::File::BeginTimestamp,
// If the end-timestamp of the file is less than the given begin-
// timestamp, messages within the file are guaranteed to be outside
// the timestamp range. So this filters for the opposite.
fmt::format_to(statement_buffer_ix, " WHERE {} >= ?{}", streaming_archive::cMetadataDB::File::EndTimestamp,
enum_to_underlying_type(FilesTableFieldIndexes::BeginTimestamp) + 1);
clause_exists = true;
}
if (cEpochTimeMax != ts_end) {
fmt::format_to(statement_buffer_ix, " {} {} <= ?{}", clause_exists ? "AND" : "WHERE", streaming_archive::cMetadataDB::File::EndTimestamp,
// If the begin-timestamp of the file is greater than the given end-
// timestamp, messages within the file are guaranteed to be outside
// the timestamp range. So this filters for the opposite.
fmt::format_to(statement_buffer_ix, " {} {} <= ?{}", clause_exists ? "AND" : "WHERE", streaming_archive::cMetadataDB::File::BeginTimestamp,
enum_to_underlying_type(FilesTableFieldIndexes::EndTimestamp) + 1);
clause_exists = true;
}
Expand Down