-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
nsqd: persisted data repeatedly consumed #730
Conversation
The metadata file should have (eventually) been updated. It may not have been synced to disk until some time and/or more messages were processed ... but it would indeed be a bug if it could wait indefinitely before being synced. See the
Looks like, by default, the metadata file should be written and fsynced every 2 seconds. If you can reproduce a case where that does not happen, it's a bug :) |
@ploxiln it seems option |
@jinhao can you list the steps to reproduce? |
my topic is
|
@jinhao what are the command line flags you're using for |
@mreiferson
second:
both not work. |
OK, I understand what's happening.
This feels wrong, for this exact reason. We can still avoid "unnecessary" syncs, which is what I think the code was intended to guard against, by counting reads too. Thoughts @jehiah ? |
@mreiferson yeah i agree. it should count reads and writes equally |
RFR |
var r chan []byte | ||
|
||
syncTicker := time.NewTicker(d.syncTimeout) | ||
|
||
for { | ||
// dont sync all the time :) | ||
if count == d.syncEvery { | ||
count = 0 | ||
if wcount == d.syncEvery { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we want (wcount + rcount) == d.syncEvery
?
And more generally, do we need to distinguish between read and write counts, can we always use a single count
var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we always use a single count var?
That should simplify things.
da8c8aa
to
497111e
Compare
ready @jehiah |
@mreiferson I try to get the latest code from github, and rebuild the nsq
|
@jinhao That looks like you have |
hi,
i have a question about nsqd persisted meta file update.
my nsqd version:
when nsqd start up, it load persisted data from disk, and then subscriber consumed the msg, but the nsqd not update the persist meta file, and then if nsqd crash when it restart, my subscriber will consume the same messages again. I know nsqd guarantees "messages are delivered at least onceAnchor link for: messages are delivered at least once", but is this scene can improve?