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

find_offset_to_start read wrong length of bytes #146

Closed
flearc opened this issue Apr 11, 2024 · 0 comments · Fixed by #148
Closed

find_offset_to_start read wrong length of bytes #146

flearc opened this issue Apr 11, 2024 · 0 comments · Fixed by #148

Comments

@flearc
Copy link
Contributor

flearc commented Apr 11, 2024

find_offset_to_start read 4 bytes from the idx file as the offset.

But write_index use 8 bytes to store it.

fn write_index(&self, time: u64, offset: u64) -> Result<()> {
    // Use BigEndian here to keep consistent with DataOutputStream in Java.
    let mut idx_out = self.cur_metric_idx_file.as_ref().unwrap().write().unwrap();
    idx_out.write_all(&time.to_be_bytes())?;
    idx_out.write_all(&offset.to_be_bytes())?;
    idx_out.flush()?;
    Ok(())
}
flearc added a commit to flearc/sentinel-rust that referenced this issue Apr 16, 2024
1. fix
find_offset_to_start(sentinel-group#146)
2. fix
read_metrics_one_file_by_end_time(sentinel-group#145)
Forsworns pushed a commit that referenced this issue Apr 21, 2024
1. fix
find_offset_to_start(#146)
2. fix
read_metrics_one_file_by_end_time(#145)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant