Skip to content

Commit

Permalink
fix(server): change log level from warn to trace for empty file checks (
Browse files Browse the repository at this point in the history
#1544)

This commit updates the log level from `warn` to `trace` for messages
indicating that index or log files are empty. This change is made to
reduce the verbosity of warnings in the logs when encountering empty
files, which may be a normal condition in some scenarios.
  • Loading branch information
hubcio authored Feb 17, 2025
1 parent e94a0a1 commit bdac9c8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.4.204"
version = "0.4.205"
edition = "2021"
build = "src/build.rs"
license = "Apache-2.0"
Expand Down
10 changes: 6 additions & 4 deletions server/src/streaming/segments/indexes/index_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl SegmentIndexReader {
pub async fn load_all_indexes_impl(&self) -> Result<Vec<Index>, IggyError> {
let file_size = self.file_size();
if file_size == 0 {
warn!("Index {} file is empty.", self.file_path);
trace!("Index file {} is empty.", self.file_path);
return Ok(Vec::new());
}

Expand Down Expand Up @@ -97,15 +97,17 @@ impl SegmentIndexReader {
segment_start_offset: u64,
) -> Result<Option<IndexRange>, IggyError> {
if index_start_offset > index_end_offset {
warn!(
trace!(
"Index start offset {} is greater than index end offset {} for file {}.",
index_start_offset, index_end_offset, self.file_path
index_start_offset,
index_end_offset,
self.file_path
);
return Ok(None);
}
let file_size = self.file_size();
if file_size == 0 {
warn!("Index {} file is empty.", self.file_path);
trace!("Index file {} is empty.", self.file_path);
return Ok(None);
}
trace!("Index file length: {} bytes.", file_size);
Expand Down
8 changes: 4 additions & 4 deletions server/src/streaming/segments/logs/log_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl SegmentLogReader {
) -> Result<Vec<RetainedMessageBatch>, IggyError> {
let mut file_size = self.file_size();
if file_size == 0 {
warn!("Log file {} is empty.", self.file_path);
trace!("Log file {} is empty.", self.file_path);
return Ok(Vec::new());
}

Expand Down Expand Up @@ -111,7 +111,7 @@ impl SegmentLogReader {
pub async fn load_message_ids_impl(&self) -> Result<Vec<u128>, IggyError> {
let mut file_size = self.file_size();
if file_size == 0 {
warn!("Log file {} is empty.", self.file_path);
trace!("Log file {} is empty.", self.file_path);
return Ok(Vec::new());
}

Expand Down Expand Up @@ -149,7 +149,7 @@ impl SegmentLogReader {
{
let mut file_size = self.file_size();
if file_size == 0 {
warn!("Log file {} is empty.", self.file_path);
trace!("Log file {} is empty.", self.file_path);
return Ok(());
}

Expand Down Expand Up @@ -186,7 +186,7 @@ impl SegmentLogReader {
) -> Result<(), IggyError> {
let mut file_size = self.file_size();
if file_size == 0 {
warn!("Log file {} is empty.", self.file_path);
trace!("Log file {} is empty.", self.file_path);
return Ok(());
}

Expand Down

0 comments on commit bdac9c8

Please sign in to comment.