Skip to content

write to next file if writePos == maxBytesPerFile #8

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

Merged
merged 1 commit into from
Dec 24, 2019

Conversation

SwanSpouse
Copy link
Contributor

when d.writePos == maxBytesPerFile, "writeOne" func continues to write a message to current file, this will make current file one message larger than expected.

@ploxiln
Copy link
Member

ploxiln commented Dec 24, 2019

Makes sense, thanks.

(It seems like it would be even more correct to see if the current message will fit under the maxBytesPerFile before writing it, because even with this change there will usually be some trailing bytes of the last message which go past maxBytesPerFile in typical usage. But that can be a later improvement IMHO.)

@ploxiln ploxiln merged commit d3d0698 into nsqio:master Dec 24, 2019
@SwanSpouse SwanSpouse deleted the fix_write_pos_limit branch December 25, 2019 02:30
@SwanSpouse
Copy link
Contributor Author

there will usually be some trailing bytes of the last message which go past maxBytesPerFile in typical usage

About this question, if we want current message fits under themaxBytesPerFile, we should make sure that maxMsgSize is smaller than maxBytesPerFile in dq's constructor.

moredure pushed a commit to cloudlinux/go-diskqueue that referenced this pull request Jan 10, 2023
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 this pull request may close these issues.

2 participants