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] First log has no records when target-file-size < LogFileFormat::encoded_len() #270

Closed
LykxSassinator opened this issue Sep 6, 2022 · 1 comment

Comments

@LykxSassinator
Copy link
Contributor

Referring to pr: #269, after we refactored the sync, we found that the first log (file_seq == 1) is always empty when setting target-file-size < LogFileFormat::encoded_len().

The root cause is that we will check whether to do rotate before each real write, in the processing of append.

if active_file.writer.offset() >= self.target_file_size {
if let Err(e) = self.rotate_imp(&mut active_file) {

And if we set target-file-size with a abnormal value, such as 1, the startup of Pipe will automatically generate the first seq file with sequence number 1. Any append to this Pipe will not be added to the first file, which will be added to the next seq file, file_seq == 2.

@tabokie
Copy link
Member

tabokie commented Sep 6, 2022

It's not a bug. You can switch the order (between write and rotate) if it makes testing easier.

@tabokie tabokie closed this as completed Sep 6, 2022
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

No branches or pull requests

2 participants